From 95a750cefd73565f77bd19338735ad994e8ca150 Mon Sep 17 00:00:00 2001 From: ibaker Date: Mon, 13 Dec 2021 12:56:55 +0000 Subject: [PATCH] Change DefaultHttpDataSourceTest to an instrumentation test The Robolectric implementation of HttpURLConnection forwards to the JRE implementation [1], which behaves differently to the Android one available on devices and emulators. For these tests to be a realistic test of the HTTP stack used in real playbacks we can't use Robolectric. Similar to https://github.com/google/ExoPlayer/commit/df0e89c1678ff0dda00bb187be05b8198bd31567 [1] https://github.com/robolectric/robolectric/issues/6769#issuecomment-943556156 PiperOrigin-RevId: 416013662 --- library/datasource/build.gradle | 1 + .../android/exoplayer2/upstream/DefaultHttpDataSourceTest.java | 0 2 files changed, 1 insertion(+) rename library/datasource/src/{test => androidTest}/java/com/google/android/exoplayer2/upstream/DefaultHttpDataSourceTest.java (100%) diff --git a/library/datasource/build.gradle b/library/datasource/build.gradle index 4bd29fb1c2..27f35ed811 100644 --- a/library/datasource/build.gradle +++ b/library/datasource/build.gradle @@ -42,6 +42,7 @@ dependencies { androidTestImplementation 'androidx.test:runner:' + androidxTestRunnerVersion androidTestImplementation 'com.linkedin.dexmaker:dexmaker:' + dexmakerVersion androidTestImplementation 'com.linkedin.dexmaker:dexmaker-mockito:' + dexmakerVersion + androidTestImplementation 'com.squareup.okhttp3:mockwebserver:' + okhttpVersion androidTestImplementation(project(modulePrefix + 'testutils')) { exclude module: modulePrefix.substring(1) + 'library-core' } diff --git a/library/datasource/src/test/java/com/google/android/exoplayer2/upstream/DefaultHttpDataSourceTest.java b/library/datasource/src/androidTest/java/com/google/android/exoplayer2/upstream/DefaultHttpDataSourceTest.java similarity index 100% rename from library/datasource/src/test/java/com/google/android/exoplayer2/upstream/DefaultHttpDataSourceTest.java rename to library/datasource/src/androidTest/java/com/google/android/exoplayer2/upstream/DefaultHttpDataSourceTest.java