Commit 5c2dd9ca by andrewlewis Committed by Oliver Woodman

Move all tests to JUnit 4

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=209412403
parent 05dcf502
......@@ -27,6 +27,7 @@ android {
minSdkVersion project.ext.minSdkVersion
targetSdkVersion project.ext.targetSdkVersion
consumerProguardFiles 'proguard-rules.txt'
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
sourceSets.main {
......@@ -38,6 +39,7 @@ android {
dependencies {
implementation 'com.android.support:support-annotations:' + supportLibraryVersion
implementation project(modulePrefix + 'library-core')
androidTestImplementation 'androidx.test:runner:' + testRunnerVersion
androidTestImplementation project(modulePrefix + 'testutils')
testImplementation project(modulePrefix + 'testutils-robolectric')
}
......
......@@ -26,6 +26,6 @@
<instrumentation
android:targetPackage="com.google.android.exoplayer2.ext.flac.test"
android:name="android.test.InstrumentationTestRunner"/>
android:name="androidx.test.runner.AndroidJUnitRunner"/>
</manifest>
......@@ -15,10 +15,13 @@
*/
package com.google.android.exoplayer2.ext.flac;
import static androidx.test.InstrumentationRegistry.getContext;
import static org.junit.Assert.fail;
import android.content.Context;
import android.net.Uri;
import android.os.Looper;
import android.test.InstrumentationTestCase;
import androidx.test.runner.AndroidJUnit4;
import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.ExoPlayerFactory;
......@@ -29,29 +32,31 @@ import com.google.android.exoplayer2.source.ExtractorMediaSource;
import com.google.android.exoplayer2.source.MediaSource;
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* Playback tests using {@link LibflacAudioRenderer}.
*/
public class FlacPlaybackTest extends InstrumentationTestCase {
/** Playback tests using {@link LibflacAudioRenderer}. */
@RunWith(AndroidJUnit4.class)
public class FlacPlaybackTest {
private static final String BEAR_FLAC_URI = "asset:///bear-flac.mka";
@Override
protected void setUp() throws Exception {
super.setUp();
@Before
public void setUp() {
if (!FlacLibrary.isAvailable()) {
fail("Flac library not available.");
}
}
@Test
public void testBasicPlayback() throws ExoPlaybackException {
playUri(BEAR_FLAC_URI);
}
private void playUri(String uri) throws ExoPlaybackException {
TestPlaybackRunnable testPlaybackRunnable = new TestPlaybackRunnable(Uri.parse(uri),
getInstrumentation().getContext());
TestPlaybackRunnable testPlaybackRunnable =
new TestPlaybackRunnable(Uri.parse(uri), getContext());
Thread thread = new Thread(testPlaybackRunnable);
thread.start();
try {
......
......@@ -27,6 +27,7 @@ android {
minSdkVersion project.ext.minSdkVersion
targetSdkVersion project.ext.targetSdkVersion
consumerProguardFiles 'proguard-rules.txt'
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
sourceSets.main {
......@@ -37,6 +38,7 @@ android {
dependencies {
implementation project(modulePrefix + 'library-core')
androidTestImplementation 'androidx.test:runner:' + testRunnerVersion
}
ext {
......
......@@ -26,6 +26,6 @@
<instrumentation
android:targetPackage="com.google.android.exoplayer2.ext.opus.test"
android:name="android.test.InstrumentationTestRunner"/>
android:name="androidx.test.runner.AndroidJUnitRunner"/>
</manifest>
......@@ -15,10 +15,13 @@
*/
package com.google.android.exoplayer2.ext.opus;
import static androidx.test.InstrumentationRegistry.getContext;
import static org.junit.Assert.fail;
import android.content.Context;
import android.net.Uri;
import android.os.Looper;
import android.test.InstrumentationTestCase;
import androidx.test.runner.AndroidJUnit4;
import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.ExoPlayerFactory;
......@@ -29,29 +32,31 @@ import com.google.android.exoplayer2.source.ExtractorMediaSource;
import com.google.android.exoplayer2.source.MediaSource;
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* Playback tests using {@link LibopusAudioRenderer}.
*/
public class OpusPlaybackTest extends InstrumentationTestCase {
/** Playback tests using {@link LibopusAudioRenderer}. */
@RunWith(AndroidJUnit4.class)
public class OpusPlaybackTest {
private static final String BEAR_OPUS_URI = "asset:///bear-opus.webm";
@Override
protected void setUp() throws Exception {
super.setUp();
@Before
public void setUp() {
if (!OpusLibrary.isAvailable()) {
fail("Opus library not available.");
}
}
@Test
public void testBasicPlayback() throws ExoPlaybackException {
playUri(BEAR_OPUS_URI);
}
private void playUri(String uri) throws ExoPlaybackException {
TestPlaybackRunnable testPlaybackRunnable = new TestPlaybackRunnable(Uri.parse(uri),
getInstrumentation().getContext());
TestPlaybackRunnable testPlaybackRunnable =
new TestPlaybackRunnable(Uri.parse(uri), getContext());
Thread thread = new Thread(testPlaybackRunnable);
thread.start();
try {
......
......@@ -27,6 +27,7 @@ android {
minSdkVersion project.ext.minSdkVersion
targetSdkVersion project.ext.targetSdkVersion
consumerProguardFiles 'proguard-rules.txt'
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
sourceSets.main {
......@@ -38,6 +39,7 @@ android {
dependencies {
implementation project(modulePrefix + 'library-core')
implementation 'com.android.support:support-annotations:' + supportLibraryVersion
androidTestImplementation 'androidx.test:runner:' + testRunnerVersion
androidTestImplementation 'com.google.truth:truth:' + truthVersion
}
......
......@@ -26,6 +26,6 @@
<instrumentation
android:targetPackage="com.google.android.exoplayer2.ext.vp9.test"
android:name="android.test.InstrumentationTestRunner"/>
android:name="androidx.test.runner.AndroidJUnitRunner"/>
</manifest>
......@@ -15,13 +15,15 @@
*/
package com.google.android.exoplayer2.ext.vp9;
import static androidx.test.InstrumentationRegistry.getContext;
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.fail;
import android.content.Context;
import android.net.Uri;
import android.os.Looper;
import android.test.InstrumentationTestCase;
import android.util.Log;
import androidx.test.runner.AndroidJUnit4;
import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.ExoPlayerFactory;
......@@ -32,11 +34,13 @@ import com.google.android.exoplayer2.source.ExtractorMediaSource;
import com.google.android.exoplayer2.source.MediaSource;
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* Playback tests using {@link LibvpxVideoRenderer}.
*/
public class VpxPlaybackTest extends InstrumentationTestCase {
/** Playback tests using {@link LibvpxVideoRenderer}. */
@RunWith(AndroidJUnit4.class)
public class VpxPlaybackTest {
private static final String BEAR_URI = "asset:///bear-vp9.webm";
private static final String BEAR_ODD_DIMENSIONS_URI = "asset:///bear-vp9-odd-dimensions.webm";
......@@ -45,22 +49,24 @@ public class VpxPlaybackTest extends InstrumentationTestCase {
private static final String TAG = "VpxPlaybackTest";
@Override
protected void setUp() throws Exception {
super.setUp();
@Before
public void setUp() {
if (!VpxLibrary.isAvailable()) {
fail("Vpx library not available.");
}
}
@Test
public void testBasicPlayback() throws ExoPlaybackException {
playUri(BEAR_URI);
}
@Test
public void testOddDimensionsPlayback() throws ExoPlaybackException {
playUri(BEAR_ODD_DIMENSIONS_URI);
}
@Test
public void test10BitProfile2Playback() throws ExoPlaybackException {
if (VpxLibrary.isHighBitDepthSupported()) {
Log.d(TAG, "High Bit Depth supported.");
......@@ -70,6 +76,7 @@ public class VpxPlaybackTest extends InstrumentationTestCase {
Log.d(TAG, "High Bit Depth not supported.");
}
@Test
public void testInvalidBitstream() {
try {
playUri(INVALID_BITSTREAM_URI);
......@@ -81,8 +88,8 @@ public class VpxPlaybackTest extends InstrumentationTestCase {
}
private void playUri(String uri) throws ExoPlaybackException {
TestPlaybackRunnable testPlaybackRunnable = new TestPlaybackRunnable(Uri.parse(uri),
getInstrumentation().getContext());
TestPlaybackRunnable testPlaybackRunnable =
new TestPlaybackRunnable(Uri.parse(uri), getContext());
Thread thread = new Thread(testPlaybackRunnable);
thread.start();
try {
......
......@@ -28,7 +28,7 @@ android {
targetSdkVersion project.ext.targetSdkVersion
consumerProguardFiles 'proguard-rules.txt'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
// The following argument makes the Android Test Orchestrator run its
// "pm clear" command after each test invocation. This command ensures
......@@ -39,11 +39,11 @@ android {
// Workaround to prevent circular dependency on project :testutils.
sourceSets {
androidTest {
java.srcDirs += "../../testutils/src/main/java/"
java.srcDirs += '../../testutils/src/main/java/'
}
test {
java.srcDirs += "../../testutils/src/main/java/"
java.srcDirs += "../../testutils_robolectric/src/main/java/"
java.srcDirs += '../../testutils/src/main/java/'
java.srcDirs += '../../testutils_robolectric/src/main/java/'
}
}
......@@ -60,12 +60,12 @@ dependencies {
implementation 'com.android.support:support-annotations:' + supportLibraryVersion
compileOnly 'org.checkerframework:checker-qual:' + checkerframeworkVersion
compileOnly 'org.checkerframework:checker-compat-qual:' + checkerframeworkVersion
androidTestImplementation 'androidx.test:runner:' + testRunnerVersion
androidTestImplementation 'com.google.auto.value:auto-value-annotations:' + autoValueVersion
androidTestImplementation 'com.google.dexmaker:dexmaker:' + dexmakerVersion
androidTestImplementation 'com.google.dexmaker:dexmaker-mockito:' + dexmakerVersion
androidTestImplementation 'com.google.truth:truth:' + truthVersion
androidTestImplementation 'org.mockito:mockito-core:' + mockitoVersion
androidTestImplementation 'androidx.test:runner:' + testRunnerVersion
androidTestImplementation 'com.google.auto.value:auto-value-annotations:' + autoValueVersion
androidTestAnnotationProcessor 'com.google.auto.value:auto-value:' + autoValueVersion
testImplementation 'com.google.truth:truth:' + truthVersion
testImplementation 'junit:junit:' + junitVersion
......
......@@ -29,6 +29,6 @@
<instrumentation
android:targetPackage="com.google.android.exoplayer2.core.test"
android:name="android.test.InstrumentationTestRunner"/>
android:name="androidx.test.runner.AndroidJUnitRunner"/>
</manifest>
......@@ -26,10 +26,13 @@ android {
defaultConfig {
minSdkVersion project.ext.minSdkVersion
targetSdkVersion project.ext.targetSdkVersion
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
}
dependencies {
androidTestImplementation 'androidx.test:rules:' + testRunnerVersion
androidTestImplementation 'androidx.test:runner:' + testRunnerVersion
androidTestImplementation project(modulePrefix + 'library-core')
androidTestImplementation project(modulePrefix + 'library-dash')
androidTestImplementation project(modulePrefix + 'library-hls')
......
......@@ -34,6 +34,6 @@
<instrumentation
android:targetPackage="com.google.android.exoplayer2.playbacktests"
android:name="android.test.InstrumentationTestRunner"/>
android:name="androidx.test.runner.AndroidJUnitRunner"/>
</manifest>
......@@ -15,17 +15,24 @@
*/
package com.google.android.exoplayer2.playbacktests.gts;
import android.test.ActivityInstrumentationTestCase2;
import static androidx.test.InstrumentationRegistry.getInstrumentation;
import androidx.test.rule.ActivityTestRule;
import androidx.test.runner.AndroidJUnit4;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.testutil.ActionSchedule;
import com.google.android.exoplayer2.testutil.HostActivity;
import com.google.android.exoplayer2.util.MimeTypes;
import com.google.android.exoplayer2.util.Util;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* Test playback of encrypted DASH streams using different CENC scheme types.
*/
public final class CommonEncryptionDrmTest extends ActivityInstrumentationTestCase2<HostActivity> {
/** Test playback of encrypted DASH streams using different CENC scheme types. */
@RunWith(AndroidJUnit4.class)
public final class CommonEncryptionDrmTest {
private static final String TAG = "CencDrmTest";
......@@ -44,29 +51,26 @@ public final class CommonEncryptionDrmTest extends ActivityInstrumentationTestCa
.seekAndWait(270000).delay(10000).seekAndWait(200000).delay(10000).seekAndWait(732000)
.build();
private DashTestRunner testRunner;
@Rule public ActivityTestRule<HostActivity> testRule = new ActivityTestRule<>(HostActivity.class);
public CommonEncryptionDrmTest() {
super(HostActivity.class);
}
@Override
protected void setUp() throws Exception {
super.setUp();
private DashTestRunner testRunner;
testRunner = new DashTestRunner(TAG, getActivity(), getInstrumentation())
.setWidevineInfo(MimeTypes.VIDEO_H264, false)
.setActionSchedule(ACTION_SCHEDULE_WITH_SEEKS)
.setAudioVideoFormats(ID_AUDIO, IDS_VIDEO)
.setCanIncludeAdditionalVideoFormats(true);
@Before
public void setUp() {
testRunner =
new DashTestRunner(TAG, testRule.getActivity(), getInstrumentation())
.setWidevineInfo(MimeTypes.VIDEO_H264, false)
.setActionSchedule(ACTION_SCHEDULE_WITH_SEEKS)
.setAudioVideoFormats(ID_AUDIO, IDS_VIDEO)
.setCanIncludeAdditionalVideoFormats(true);
}
@Override
protected void tearDown() throws Exception {
@After
public void tearDown() {
testRunner = null;
super.tearDown();
}
@Test
public void testCencSchemeTypeV18() {
if (Util.SDK_INT < 18) {
// Pass.
......@@ -75,6 +79,7 @@ public final class CommonEncryptionDrmTest extends ActivityInstrumentationTestCa
testRunner.setStreamName("test_widevine_h264_scheme_cenc").setManifestUrl(URL_cenc).run();
}
@Test
public void testCbc1SchemeTypeV25() {
if (Util.SDK_INT < 25) {
// cbc1 support was added in API 24, but it is stable from API 25 onwards.
......@@ -85,6 +90,7 @@ public final class CommonEncryptionDrmTest extends ActivityInstrumentationTestCa
testRunner.setStreamName("test_widevine_h264_scheme_cbc1").setManifestUrl(URL_cbc1).run();
}
@Test
public void testCbcsSchemeTypeV25() {
if (Util.SDK_INT < 25) {
// cbcs support was added in API 24, but it is stable from API 25 onwards.
......@@ -95,8 +101,8 @@ public final class CommonEncryptionDrmTest extends ActivityInstrumentationTestCa
testRunner.setStreamName("test_widevine_h264_scheme_cbcs").setManifestUrl(URL_cbcs).run();
}
@Test
public void testCensSchemeTypeV25() {
// TODO: Implement once content is available. Track [internal: b/31219813].
}
}
......@@ -15,10 +15,12 @@
*/
package com.google.android.exoplayer2.playbacktests.gts;
import static androidx.test.InstrumentationRegistry.getInstrumentation;
import static com.google.common.truth.Truth.assertWithMessage;
import android.net.Uri;
import android.test.ActivityInstrumentationTestCase2;
import androidx.test.rule.ActivityTestRule;
import androidx.test.runner.AndroidJUnit4;
import com.google.android.exoplayer2.offline.DownloaderConstructorHelper;
import com.google.android.exoplayer2.offline.StreamKey;
import com.google.android.exoplayer2.source.dash.DashUtil;
......@@ -37,36 +39,38 @@ import com.google.android.exoplayer2.util.Util;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* Tests downloaded DASH playbacks.
*/
public final class DashDownloadTest extends ActivityInstrumentationTestCase2<HostActivity> {
/** Tests downloaded DASH playbacks. */
@RunWith(AndroidJUnit4.class)
public final class DashDownloadTest {
private static final String TAG = "DashDownloadTest";
private static final Uri MANIFEST_URI = Uri.parse(DashTestData.H264_MANIFEST);
@Rule public ActivityTestRule<HostActivity> testRule = new ActivityTestRule<>(HostActivity.class);
private DashTestRunner testRunner;
private File tempFolder;
private SimpleCache cache;
private DefaultHttpDataSourceFactory httpDataSourceFactory;
private CacheDataSourceFactory offlineDataSourceFactory;
public DashDownloadTest() {
super(HostActivity.class);
}
@Override
protected void setUp() throws Exception {
super.setUp();
testRunner = new DashTestRunner(TAG, getActivity(), getInstrumentation())
.setManifestUrl(DashTestData.H264_MANIFEST)
.setFullPlaybackNoSeeking(true)
.setCanIncludeAdditionalVideoFormats(false)
.setAudioVideoFormats(DashTestData.AAC_AUDIO_REPRESENTATION_ID,
DashTestData.H264_CDD_FIXED);
tempFolder = Util.createTempDirectory(getActivity(), "ExoPlayerTest");
@Before
public void setUp() throws Exception {
testRunner =
new DashTestRunner(TAG, testRule.getActivity(), getInstrumentation())
.setManifestUrl(DashTestData.H264_MANIFEST)
.setFullPlaybackNoSeeking(true)
.setCanIncludeAdditionalVideoFormats(false)
.setAudioVideoFormats(
DashTestData.AAC_AUDIO_REPRESENTATION_ID, DashTestData.H264_CDD_FIXED);
tempFolder = Util.createTempDirectory(testRule.getActivity(), "ExoPlayerTest");
cache = new SimpleCache(tempFolder, new NoOpCacheEvictor());
httpDataSourceFactory = new DefaultHttpDataSourceFactory("ExoPlayer", null);
offlineDataSourceFactory =
......@@ -74,16 +78,16 @@ public final class DashDownloadTest extends ActivityInstrumentationTestCase2<Hos
cache, DummyDataSource.FACTORY, CacheDataSource.FLAG_BLOCK_ON_CACHE);
}
@Override
protected void tearDown() throws Exception {
@After
public void tearDown() {
testRunner = null;
Util.recursiveDelete(tempFolder);
cache = null;
super.tearDown();
}
// Download tests
@Test
public void testDownload() throws Exception {
if (Util.SDK_INT < 16) {
return; // Pass.
......
......@@ -15,13 +15,16 @@
*/
package com.google.android.exoplayer2.playbacktests.gts;
import static androidx.test.InstrumentationRegistry.getInstrumentation;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;
import static org.junit.Assert.fail;
import android.media.MediaDrm.MediaDrmStateException;
import android.net.Uri;
import android.test.ActivityInstrumentationTestCase2;
import android.util.Pair;
import androidx.test.rule.ActivityTestRule;
import androidx.test.runner.AndroidJUnit4;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.drm.DrmInitData;
import com.google.android.exoplayer2.drm.DrmSession.DrmSessionException;
......@@ -36,11 +39,15 @@ import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory;
import com.google.android.exoplayer2.util.MimeTypes;
import com.google.android.exoplayer2.util.Util;
import java.io.IOException;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* Tests Widevine encrypted DASH playbacks using offline keys.
*/
public final class DashWidevineOfflineTest extends ActivityInstrumentationTestCase2<HostActivity> {
/** Tests Widevine encrypted DASH playbacks using offline keys. */
@RunWith(AndroidJUnit4.class)
public final class DashWidevineOfflineTest {
private static final String TAG = "DashWidevineOfflineTest";
private static final String USER_AGENT = "ExoPlayerPlaybackTests";
......@@ -50,21 +57,20 @@ public final class DashWidevineOfflineTest extends ActivityInstrumentationTestCa
private OfflineLicenseHelper<FrameworkMediaCrypto> offlineLicenseHelper;
private byte[] offlineLicenseKeySetId;
public DashWidevineOfflineTest() {
super(HostActivity.class);
}
@Override
protected void setUp() throws Exception {
super.setUp();
testRunner = new DashTestRunner(TAG, getActivity(), getInstrumentation())
.setStreamName("test_widevine_h264_fixed_offline")
.setManifestUrl(DashTestData.WIDEVINE_H264_MANIFEST)
.setWidevineInfo(MimeTypes.VIDEO_H264, true)
.setFullPlaybackNoSeeking(true)
.setCanIncludeAdditionalVideoFormats(false)
.setAudioVideoFormats(DashTestData.WIDEVINE_AAC_AUDIO_REPRESENTATION_ID,
DashTestData.WIDEVINE_H264_CDD_FIXED);
@Rule public ActivityTestRule<HostActivity> testRule = new ActivityTestRule<>(HostActivity.class);
@Before
public void setUp() throws Exception {
testRunner =
new DashTestRunner(TAG, testRule.getActivity(), getInstrumentation())
.setStreamName("test_widevine_h264_fixed_offline")
.setManifestUrl(DashTestData.WIDEVINE_H264_MANIFEST)
.setWidevineInfo(MimeTypes.VIDEO_H264, true)
.setFullPlaybackNoSeeking(true)
.setCanIncludeAdditionalVideoFormats(false)
.setAudioVideoFormats(
DashTestData.WIDEVINE_AAC_AUDIO_REPRESENTATION_ID,
DashTestData.WIDEVINE_H264_CDD_FIXED);
boolean useL1Widevine = DashTestRunner.isL1WidevineAvailable(MimeTypes.VIDEO_H264);
String widevineLicenseUrl = DashTestData.getWidevineLicenseUrl(true, useL1Widevine);
......@@ -75,8 +81,8 @@ public final class DashWidevineOfflineTest extends ActivityInstrumentationTestCa
}
}
@Override
protected void tearDown() throws Exception {
@After
public void tearDown() throws Exception {
testRunner = null;
if (offlineLicenseKeySetId != null) {
releaseLicense();
......@@ -86,11 +92,11 @@ public final class DashWidevineOfflineTest extends ActivityInstrumentationTestCa
}
offlineLicenseHelper = null;
httpDataSourceFactory = null;
super.tearDown();
}
// Offline license tests
@Test
public void testWidevineOfflineLicenseV22() throws Exception {
if (Util.SDK_INT < 22) {
return; // Pass.
......@@ -103,6 +109,7 @@ public final class DashWidevineOfflineTest extends ActivityInstrumentationTestCa
assertThat(offlineLicenseKeySetId).isNotNull();
}
@Test
public void testWidevineOfflineReleasedLicenseV22() throws Throwable {
if (Util.SDK_INT < 22) {
return; // Pass.
......@@ -129,6 +136,7 @@ public final class DashWidevineOfflineTest extends ActivityInstrumentationTestCa
}
}
@Test
public void testWidevineOfflineExpiredLicenseV22() throws Exception {
if (Util.SDK_INT < 22) {
return; // Pass.
......@@ -158,6 +166,7 @@ public final class DashWidevineOfflineTest extends ActivityInstrumentationTestCa
testRunner.run();
}
@Test
public void testWidevineOfflineLicenseExpiresOnPauseV22() throws Exception {
if (Util.SDK_INT < 22) {
return; // Pass.
......
......@@ -15,11 +15,13 @@
*/
package com.google.android.exoplayer2.playbacktests.gts;
import static androidx.test.InstrumentationRegistry.getInstrumentation;
import android.media.MediaCodecInfo.AudioCapabilities;
import android.media.MediaCodecInfo.CodecCapabilities;
import android.media.MediaCodecInfo.CodecProfileLevel;
import android.media.MediaCodecInfo.VideoCapabilities;
import android.test.InstrumentationTestCase;
import androidx.test.runner.AndroidJUnit4;
import com.google.android.exoplayer2.mediacodec.MediaCodecInfo;
import com.google.android.exoplayer2.mediacodec.MediaCodecUtil;
import com.google.android.exoplayer2.mediacodec.MediaCodecUtil.DecoderQueryException;
......@@ -29,9 +31,13 @@ import com.google.android.exoplayer2.util.MimeTypes;
import com.google.android.exoplayer2.util.Util;
import java.util.Arrays;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
/** Tests enumeration of decoders using {@link MediaCodecUtil}. */
public class EnumerateDecodersTest extends InstrumentationTestCase {
@RunWith(AndroidJUnit4.class)
public class EnumerateDecodersTest {
private static final String TAG = "EnumerateDecodersTest";
......@@ -40,14 +46,14 @@ public class EnumerateDecodersTest extends InstrumentationTestCase {
private MetricsLogger metricsLogger;
@Override
protected void setUp() throws Exception {
super.setUp();
@Before
public void setUp() {
metricsLogger =
MetricsLogger.Factory.createDefault(
getInstrumentation(), TAG, REPORT_NAME, REPORT_OBJECT_NAME);
}
@Test
public void testEnumerateDecoders() throws Exception {
enumerateDecoders(MimeTypes.VIDEO_H263);
enumerateDecoders(MimeTypes.VIDEO_H264);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment