diff --git a/libraries/extractor/build.gradle b/libraries/extractor/build.gradle
index 080f8f9719..e4dad3c42a 100644
--- a/libraries/extractor/build.gradle
+++ b/libraries/extractor/build.gradle
@@ -22,7 +22,10 @@ android {
}
}
- sourceSets.test.assets.srcDir '../test_data/src/test/assets/'
+ sourceSets {
+ androidTest.assets.srcDir '../test_data/src/test/assets'
+ test.assets.srcDir '../test_data/src/test/assets/'
+ }
publishing {
singleVariant('release') {
@@ -44,6 +47,9 @@ dependencies {
testImplementation project(modulePrefix + 'test-utils')
testImplementation project(modulePrefix + 'test-data')
testImplementation 'org.robolectric:robolectric:' + robolectricVersion
+ androidTestImplementation 'androidx.test:runner:' + androidxTestRunnerVersion
+ androidTestImplementation project(modulePrefix + 'test-utils')
+ androidTestImplementation 'com.linkedin.dexmaker:dexmaker:' + dexmakerVersion
}
ext {
diff --git a/libraries/extractor/src/androidTest/AndroidManifest.xml b/libraries/extractor/src/androidTest/AndroidManifest.xml
new file mode 100644
index 0000000000..6339266515
--- /dev/null
+++ b/libraries/extractor/src/androidTest/AndroidManifest.xml
@@ -0,0 +1,33 @@
+
+
+
+
This needs to be an instrumentation test because Robolectric's handling of serializing a + * {@link Bundle} containing a {@link Bitmap} is not realistic, leading to real failures not being + * caught by the test (e.g. https://github.com/androidx/media/issues/836). */ @RunWith(AndroidJUnit4.class) public class CueSerializationTest { + @Test public void serializingCueWithoutSpans() { CueEncoder encoder = new CueEncoder(); @@ -86,10 +96,16 @@ public class CueSerializationTest { } @Test - public void serializingBitmapCue() { + @Ignore("Currently broken: https://github.com/androidx/media/issues/836") + public void serializingBitmapCue() throws Exception { CueEncoder encoder = new CueEncoder(); CueDecoder decoder = new CueDecoder(); - Bitmap bitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); + + byte[] imageData = + TestUtil.getByteArray( + ApplicationProvider.getApplicationContext(), + "media/png/non-motion-photo-shortened.png"); + Bitmap bitmap = BitmapFactory.decodeByteArray(imageData, 0, imageData.length); Cue bitmapCue = new Cue.Builder().setBitmap(bitmap).build(); // encoding and decoding