Check if native libraries are available in tests.

If the library is not available, no tracks can be selected and the
tests silently run through by immediately switching to ended state
without error.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=178904347
This commit is contained in:
tonihei 2017-12-13 08:09:21 -08:00 committed by Oliver Woodman
parent ae514b68ff
commit 8a6c375c53
4 changed files with 32 additions and 2 deletions

View file

@ -25,6 +25,14 @@ import com.google.android.exoplayer2.testutil.ExtractorAsserts.ExtractorFactory;
*/
public class FlacExtractorTest extends InstrumentationTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
if (!FlacLibrary.isAvailable()) {
fail("Flac library not available.");
}
}
public void testSample() throws Exception {
ExtractorAsserts.assertBehavior(new ExtractorFactory() {
@Override

View file

@ -37,6 +37,14 @@ public class FlacPlaybackTest extends InstrumentationTestCase {
private static final String BEAR_FLAC_URI = "asset:///bear-flac.mka";
@Override
protected void setUp() throws Exception {
super.setUp();
if (!FlacLibrary.isAvailable()) {
fail("Flac library not available.");
}
}
public void testBasicPlayback() throws ExoPlaybackException {
playUri(BEAR_FLAC_URI);
}
@ -100,7 +108,6 @@ public class FlacPlaybackTest extends InstrumentationTestCase {
Looper.myLooper().quit();
}
}
}
}

View file

@ -37,6 +37,14 @@ public class OpusPlaybackTest extends InstrumentationTestCase {
private static final String BEAR_OPUS_URI = "asset:///bear-opus.webm";
@Override
protected void setUp() throws Exception {
super.setUp();
if (!OpusLibrary.isAvailable()) {
fail("Opus library not available.");
}
}
public void testBasicPlayback() throws ExoPlaybackException {
playUri(BEAR_OPUS_URI);
}

View file

@ -43,6 +43,14 @@ public class VpxPlaybackTest extends InstrumentationTestCase {
private static final String TAG = "VpxPlaybackTest";
@Override
protected void setUp() throws Exception {
super.setUp();
if (!VpxLibrary.isAvailable()) {
fail("Vpx library not available.");
}
}
public void testBasicPlayback() throws ExoPlaybackException {
playUri(BEAR_URI);
}
@ -132,7 +140,6 @@ public class VpxPlaybackTest extends InstrumentationTestCase {
Looper.myLooper().quit();
}
}
}
}