Move bitmap loader tests in test
These tests were under androidTest because we needed a functional BitmapFactory. Robolectric now supports decoding bitmaps so moving them under tests. PiperOrigin-RevId: 565181239
This commit is contained in:
parent
bf25b3e89d
commit
c0e11e0edd
@ -24,7 +24,7 @@ android {
|
||||
testCoverageEnabled = true
|
||||
}
|
||||
}
|
||||
sourceSets.androidTest.assets.srcDir '../test_data/src/test/assets/'
|
||||
sourceSets.test.assets.srcDir '../test_data/src/test/assets/'
|
||||
lint {
|
||||
baseline = file("lint-baseline.xml")
|
||||
}
|
||||
@ -44,10 +44,8 @@ dependencies {
|
||||
implementation 'androidx.collection:collection:' + androidxCollectionVersion
|
||||
implementation 'androidx.media:media:' + androidxMediaVersion
|
||||
implementation 'androidx.core:core:' + androidxCoreVersion
|
||||
androidTestImplementation 'com.squareup.okhttp3:mockwebserver:' + okhttpVersion
|
||||
androidTestImplementation project(modulePrefix + 'test-utils')
|
||||
androidTestImplementation project(modulePrefix + 'test-data')
|
||||
androidTestImplementation 'androidx.test:runner:' + androidxTestRunnerVersion
|
||||
testImplementation 'com.squareup.okhttp3:mockwebserver:' + okhttpVersion
|
||||
testImplementation project(modulePrefix + 'test-data')
|
||||
testImplementation project(modulePrefix + 'test-utils')
|
||||
testImplementation project(modulePrefix + 'test-utils-robolectric')
|
||||
testImplementation project(modulePrefix + 'lib-exoplayer')
|
||||
|
@ -1,35 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright 2022 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="androidx.media3.session.test">
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-sdk/>
|
||||
|
||||
<application
|
||||
android:name="androidx.multidex.MultiDexApplication"
|
||||
android:allowBackup="false"
|
||||
tools:ignore="MissingApplicationIcon,HardcodedDebugMode"
|
||||
android:usesCleartextTraffic="true"/>
|
||||
|
||||
<instrumentation
|
||||
android:targetPackage="androidx.media3.session.test"
|
||||
android:name="androidx.test.runner.AndroidJUnitRunner"/>
|
||||
|
||||
</manifest>
|
@ -18,6 +18,7 @@ package androidx.media3.session;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.robolectric.annotation.GraphicsMode.Mode.NATIVE;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
@ -35,6 +36,7 @@ import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.annotation.GraphicsMode;
|
||||
|
||||
/**
|
||||
* Tests for {@link CacheBitmapLoader}.
|
||||
@ -43,6 +45,7 @@ import org.junit.runner.RunWith;
|
||||
* fully functional.
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@GraphicsMode(value = NATIVE)
|
||||
public class CacheBitmapLoaderTest {
|
||||
|
||||
private static final String TEST_IMAGE_PATH = "media/jpeg/non-motion-photo-shortened.jpg";
|
@ -17,6 +17,7 @@ package androidx.media3.session;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.robolectric.annotation.GraphicsMode.Mode.NATIVE;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
@ -41,14 +42,11 @@ import org.junit.Test;
|
||||
import org.junit.function.ThrowingRunnable;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.annotation.GraphicsMode;
|
||||
|
||||
/**
|
||||
* Tests for {@link SimpleBitmapLoader}.
|
||||
*
|
||||
* <p>This test needs to run as an androidTest because robolectric's BitmapFactory is not fully
|
||||
* functional.
|
||||
*/
|
||||
/** Tests for {@link SimpleBitmapLoader}. */
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@GraphicsMode(value = NATIVE)
|
||||
public class SimpleBitmapLoaderTest {
|
||||
|
||||
private static final String TEST_IMAGE_PATH = "media/jpeg/non-motion-photo-shortened.jpg";
|
Loading…
x
Reference in New Issue
Block a user