Commit c9ed9366 by tonihei Committed by Oliver Woodman

Fix Cronet extension build and test.

Recently added Java 8 features in the cronet extension and the linked native libs
require to enable Java 8 desugaring in gradle. Moreover, junit.assertThrows is not
available in our version and its usage has been replaced by the manual check.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=172077967
parent 7038c8fb
...@@ -27,6 +27,11 @@ android { ...@@ -27,6 +27,11 @@ android {
sourceSets.main { sourceSets.main {
jniLibs.srcDirs = ['jniLibs'] jniLibs.srcDirs = ['jniLibs']
} }
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
} }
dependencies { dependencies {
......
...@@ -18,7 +18,6 @@ package com.google.android.exoplayer2.ext.cronet; ...@@ -18,7 +18,6 @@ package com.google.android.exoplayer2.ext.cronet;
import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import static org.mockito.Matchers.any; import static org.mockito.Matchers.any;
...@@ -163,7 +162,12 @@ public final class CronetDataSourceTest { ...@@ -163,7 +162,12 @@ public final class CronetDataSourceTest {
public void testOpeningTwiceThrows() throws HttpDataSourceException { public void testOpeningTwiceThrows() throws HttpDataSourceException {
mockResponseStartSuccess(); mockResponseStartSuccess();
dataSourceUnderTest.open(testDataSpec); dataSourceUnderTest.open(testDataSpec);
assertThrows(IllegalStateException.class, () -> dataSourceUnderTest.open(testDataSpec)); try {
dataSourceUnderTest.open(testDataSpec);
fail("Expected IllegalStateException.");
} catch (IllegalStateException e) {
// Expected.
}
} }
@Test @Test
......
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