Commit 106e69b3 by tonihei Committed by Oliver Woodman

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
parent a092262d
...@@ -25,6 +25,14 @@ import com.google.android.exoplayer2.testutil.ExtractorAsserts.ExtractorFactory; ...@@ -25,6 +25,14 @@ import com.google.android.exoplayer2.testutil.ExtractorAsserts.ExtractorFactory;
*/ */
public class FlacExtractorTest extends InstrumentationTestCase { 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 { public void testSample() throws Exception {
ExtractorAsserts.assertBehavior(new ExtractorFactory() { ExtractorAsserts.assertBehavior(new ExtractorFactory() {
@Override @Override
......
...@@ -37,6 +37,14 @@ public class FlacPlaybackTest extends InstrumentationTestCase { ...@@ -37,6 +37,14 @@ public class FlacPlaybackTest extends InstrumentationTestCase {
private static final String BEAR_FLAC_URI = "asset:///bear-flac.mka"; 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 { public void testBasicPlayback() throws ExoPlaybackException {
playUri(BEAR_FLAC_URI); playUri(BEAR_FLAC_URI);
} }
...@@ -100,7 +108,6 @@ public class FlacPlaybackTest extends InstrumentationTestCase { ...@@ -100,7 +108,6 @@ public class FlacPlaybackTest extends InstrumentationTestCase {
Looper.myLooper().quit(); Looper.myLooper().quit();
} }
} }
} }
} }
...@@ -37,6 +37,14 @@ public class OpusPlaybackTest extends InstrumentationTestCase { ...@@ -37,6 +37,14 @@ public class OpusPlaybackTest extends InstrumentationTestCase {
private static final String BEAR_OPUS_URI = "asset:///bear-opus.webm"; 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 { public void testBasicPlayback() throws ExoPlaybackException {
playUri(BEAR_OPUS_URI); playUri(BEAR_OPUS_URI);
} }
......
...@@ -43,6 +43,14 @@ public class VpxPlaybackTest extends InstrumentationTestCase { ...@@ -43,6 +43,14 @@ public class VpxPlaybackTest extends InstrumentationTestCase {
private static final String TAG = "VpxPlaybackTest"; 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 { public void testBasicPlayback() throws ExoPlaybackException {
playUri(BEAR_URI); playUri(BEAR_URI);
} }
...@@ -132,7 +140,6 @@ public class VpxPlaybackTest extends InstrumentationTestCase { ...@@ -132,7 +140,6 @@ public class VpxPlaybackTest extends InstrumentationTestCase {
Looper.myLooper().quit(); Looper.myLooper().quit();
} }
} }
} }
} }
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