diff options
Diffstat (limited to 'library/test/robotest/src/com/android/setupwizardlib/shadow/ShadowMediaPlayer.java')
-rw-r--r-- | library/test/robotest/src/com/android/setupwizardlib/shadow/ShadowMediaPlayer.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/library/test/robotest/src/com/android/setupwizardlib/shadow/ShadowMediaPlayer.java b/library/test/robotest/src/com/android/setupwizardlib/shadow/ShadowMediaPlayer.java index 2ef2b7d..7bcefd0 100644 --- a/library/test/robotest/src/com/android/setupwizardlib/shadow/ShadowMediaPlayer.java +++ b/library/test/robotest/src/com/android/setupwizardlib/shadow/ShadowMediaPlayer.java @@ -34,6 +34,15 @@ import java.util.Map; @Implements(MediaPlayer.class) public class ShadowMediaPlayer extends org.robolectric.shadows.ShadowMediaPlayer { + private int mVideoWidth; + private int mVideoHeight; + + public ShadowMediaPlayer() { + super(); + mVideoWidth = -1; + mVideoHeight = -1; + } + @Implementation public void setDataSource( @NonNull Context context, @@ -48,4 +57,26 @@ public class ShadowMediaPlayer extends org.robolectric.shadows.ShadowMediaPlayer public void seekTo(long msec, int mode) { seekTo((int) msec); } + + public void setVideoSize(int width, int height) { + if (width < 0) { + throw new IllegalArgumentException("Unexpected negative width=" + width); + } + if (height < 0) { + throw new IllegalArgumentException("Unexpected negative height=" + height); + } + + mVideoWidth = width; + mVideoHeight = height; + } + + @Override + public int getVideoWidth() { + return mVideoWidth; + } + + @Override + public int getVideoHeight() { + return mVideoHeight; + } } |