| Index: content/public/android/javatests/src/org/chromium/content/browser/MediaResourceGetterTest.java
|
| diff --git a/content/public/android/javatests/src/org/chromium/content/browser/MediaResourceGetterTest.java b/content/public/android/javatests/src/org/chromium/content/browser/MediaResourceGetterTest.java
|
| index 7eae2d653793082d92db1cfe7b9389deaa345595..a6adc96909b1262c6abd5e1858ed448fa48257a9 100644
|
| --- a/content/public/android/javatests/src/org/chromium/content/browser/MediaResourceGetterTest.java
|
| +++ b/content/public/android/javatests/src/org/chromium/content/browser/MediaResourceGetterTest.java
|
| @@ -27,7 +27,7 @@ import java.util.Map;
|
| @SuppressLint("SdCardPath")
|
| public class MediaResourceGetterTest extends InstrumentationTestCase {
|
| private static final String TEST_HTTP_URL = "http://example.com";
|
| - private static final String TEST_USER_AGENT = // Anyhting, really
|
| + private static final String TEST_USER_AGENT = // Anything, really
|
| "Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 " +
|
| "(KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36";
|
| private static final String TEST_FILE_PATH = "/mnt/sdcard/test";
|
| @@ -101,6 +101,9 @@ public class MediaResourceGetterTest extends InstrumentationTestCase {
|
| String mUri = null;
|
| Map<String,String> mHeaders = null;
|
| String mPath = null;
|
| + int mFd;
|
| + long mOffset;
|
| + long mLength;
|
|
|
| // Write these before tests to configure functionality
|
| SparseArray<String> mMetadata = null;
|
| @@ -111,6 +114,17 @@ public class MediaResourceGetterTest extends InstrumentationTestCase {
|
|
|
| // Can't use a real MediaMetadataRetriever as we have no media
|
| @Override
|
| + public void configure(int fd, long offset, long length) {
|
| + if (mThrowExceptionInConfigure) {
|
| + throw new RuntimeException("test exception");
|
| + }
|
| + mFd = fd;
|
| + mOffset = offset;
|
| + mLength = length;
|
| + }
|
| +
|
| + // Can't use a real MediaMetadataRetriever as we have no media
|
| + @Override
|
| public void configure(String uri, Map<String, String> headers) {
|
| if (mThrowExceptionInConfigure) {
|
| throw new RuntimeException("test exception");
|
| @@ -505,6 +519,22 @@ public class MediaResourceGetterTest extends InstrumentationTestCase {
|
| }
|
|
|
| @SmallTest
|
| + public void testExtractFromFileDescriptor_ValidMetadata() {
|
| + mFakeMRG.bind(MediaMetadataRetriever.METADATA_KEY_DURATION, "1");
|
| + mFakeMRG.bind(MediaMetadataRetriever.METADATA_KEY_HAS_VIDEO, "yes");
|
| + mFakeMRG.bind(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH, "2");
|
| + mFakeMRG.bind(MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT, "3");
|
| + final MediaMetadata expected = new MediaMetadata(1, 2, 3, true);
|
| + int fd = 1234;
|
| + long offset = 1000;
|
| + long length = 9000;
|
| + assertEquals(expected, mFakeMRG.extract(fd, offset, length));
|
| + assertEquals(fd, mFakeMRG.mFd);
|
| + assertEquals(offset, mFakeMRG.mOffset);
|
| + assertEquals(length, mFakeMRG.mLength);
|
| + }
|
| +
|
| + @SmallTest
|
| public void testAndroidDeviceOk_BadModel_BadVersion() {
|
| assertFalse(MediaResourceGetter.androidDeviceOk(
|
| "GT-I9100", android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1));
|
|
|