Commit edabbd52 by tonihei Committed by Andrew Lewis

Update Robolectric and Truth.

PiperOrigin-RevId: 233612344
parent f299a65a
Showing with 176 additions and 33 deletions
......@@ -23,8 +23,8 @@ project.ext {
dexmakerVersion = '1.2'
mockitoVersion = '1.9.5'
junitVersion = '4.12'
truthVersion = '0.39'
robolectricVersion = '3.7.1'
truthVersion = '0.42'
robolectricVersion = '4.1'
autoValueVersion = '1.6'
checkerframeworkVersion = '2.5.0'
testRunnerVersion = '1.1.0-alpha3'
......
......@@ -26,6 +26,8 @@ android {
minSdkVersion project.ext.minSdkVersion
targetSdkVersion project.ext.targetSdkVersion
}
testOptions.unitTests.includeAndroidResources = true
}
dependencies {
......
......@@ -26,6 +26,8 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
testOptions.unitTests.includeAndroidResources = true
}
dependencies {
......
......@@ -32,6 +32,8 @@ android {
jniLibs.srcDir 'src/main/libs'
jni.srcDirs = [] // Disable the automatic ndk-build call by Android Studio.
}
testOptions.unitTests.includeAndroidResources = true
}
dependencies {
......
......@@ -33,6 +33,8 @@ android {
jniLibs.srcDir 'src/main/libs'
jni.srcDirs = [] // Disable the automatic ndk-build call by Android Studio.
}
testOptions.unitTests.includeAndroidResources = true
}
dependencies {
......
......@@ -26,6 +26,8 @@ android {
minSdkVersion 19
targetSdkVersion project.ext.targetSdkVersion
}
testOptions.unitTests.includeAndroidResources = true
}
dependencies {
......
......@@ -27,6 +27,8 @@ android {
targetSdkVersion project.ext.targetSdkVersion
consumerProguardFiles 'proguard-rules.txt'
}
testOptions.unitTests.includeAndroidResources = true
}
dependencies {
......
......@@ -28,6 +28,8 @@ android {
minSdkVersion project.ext.minSdkVersion
targetSdkVersion project.ext.targetSdkVersion
}
testOptions.unitTests.includeAndroidResources = true
}
dependencies {
......
......@@ -26,6 +26,8 @@ android {
minSdkVersion 17
targetSdkVersion project.ext.targetSdkVersion
}
testOptions.unitTests.includeAndroidResources = true
}
dependencies {
......
......@@ -26,6 +26,8 @@ android {
minSdkVersion project.ext.minSdkVersion
targetSdkVersion project.ext.targetSdkVersion
}
testOptions.unitTests.includeAndroidResources = true
}
dependencies {
......
......@@ -27,6 +27,8 @@ android {
targetSdkVersion project.ext.targetSdkVersion
consumerProguardFiles 'proguard-rules.txt'
}
testOptions.unitTests.includeAndroidResources = true
}
dependencies {
......
......@@ -33,6 +33,8 @@ android {
jniLibs.srcDir 'src/main/libs'
jni.srcDirs = [] // Disable the automatic ndk-build call by Android Studio.
}
testOptions.unitTests.includeAndroidResources = true
}
dependencies {
......
......@@ -26,6 +26,8 @@ android {
minSdkVersion project.ext.minSdkVersion
targetSdkVersion project.ext.targetSdkVersion
}
testOptions.unitTests.includeAndroidResources = true
}
dependencies {
......
......@@ -33,6 +33,8 @@ android {
jniLibs.srcDir 'src/main/libs'
jni.srcDirs = [] // Disable the automatic ndk-build call by Android Studio.
}
testOptions.unitTests.includeAndroidResources = true
}
dependencies {
......
## Project-wide Gradle settings.
android.useDeprecatedNdk=true
android.enableUnitTestBinaryResources=true
buildDir=buildout
......@@ -53,6 +53,8 @@ android {
// testCoverageEnabled = true
// }
}
testOptions.unitTests.includeAndroidResources = true
}
dependencies {
......
......@@ -21,6 +21,7 @@ import android.media.AudioManager;
import android.support.annotation.IntDef;
import android.support.annotation.Nullable;
import android.support.annotation.RequiresApi;
import android.support.annotation.VisibleForTesting;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.Player;
......@@ -195,6 +196,11 @@ public final class AudioFocusManager {
// Internal methods.
@VisibleForTesting
/* package */ AudioManager.OnAudioFocusChangeListener getFocusListener() {
return focusListener;
}
@PlayerCommand
private int handleIdle(boolean playWhenReady) {
return playWhenReady ? PLAYER_COMMAND_PLAY_WHEN_READY : PLAYER_COMMAND_DO_NOT_PLAY;
......
......@@ -19,6 +19,7 @@ import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.fail;
import android.content.Context;
import android.graphics.SurfaceTexture;
import android.support.annotation.Nullable;
import android.view.Surface;
import com.google.android.exoplayer2.Player.DiscontinuityReason;
......@@ -2593,8 +2594,8 @@ public final class ExoPlayerTest {
// Internal methods.
private static ActionSchedule.Builder addSurfaceSwitch(ActionSchedule.Builder builder) {
final Surface surface1 = new Surface(null);
final Surface surface2 = new Surface(null);
final Surface surface1 = new Surface(new SurfaceTexture(/* texName= */ 0));
final Surface surface2 = new Surface(new SurfaceTexture(/* texName= */ 1));
return builder
.executeRunnable(
new PlayerRunnable() {
......
......@@ -35,6 +35,8 @@ android {
// testCoverageEnabled = true
// }
}
testOptions.unitTests.includeAndroidResources = true
}
dependencies {
......
......@@ -35,6 +35,8 @@ android {
// testCoverageEnabled = true
// }
}
testOptions.unitTests.includeAndroidResources = true
}
dependencies {
......
......@@ -35,6 +35,8 @@ android {
// testCoverageEnabled = true
// }
}
testOptions.unitTests.includeAndroidResources = true
}
dependencies {
......
......@@ -34,6 +34,8 @@ android {
// testCoverageEnabled = true
// }
}
testOptions.unitTests.includeAndroidResources = true
}
dependencies {
......
......@@ -27,6 +27,8 @@ android {
targetSdkVersion project.ext.targetSdkVersion
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
testOptions.unitTests.includeAndroidResources = true
}
dependencies {
......
......@@ -33,6 +33,8 @@ android {
// See: https://github.com/junit-team/junit4/pull/1187.
disable 'InvalidPackage'
}
testOptions.unitTests.includeAndroidResources = true
}
dependencies {
......
......@@ -32,6 +32,8 @@ android {
// which is not part of Android.
disable 'InvalidPackage'
}
testOptions.unitTests.includeAndroidResources = true
}
dependencies {
......
......@@ -165,7 +165,7 @@ public final class RobolectricUtil {
public boolean enqueueMessage(Message msg, long when) {
Looper looper = ShadowLooper.getLooperForThread(looperThread);
if (shadowOf(looper) instanceof CustomLooper
&& shadowOf(looper) != ShadowLooper.getShadowMainLooper()) {
&& shadowOf(looper) != shadowOf(Looper.getMainLooper())) {
((CustomLooper) shadowOf(looper)).addPendingMessage(msg, when);
} else {
super.enqueueMessage(msg, when);
......@@ -177,7 +177,7 @@ public final class RobolectricUtil {
public void removeMessages(Handler handler, int what, Object object) {
Looper looper = ShadowLooper.getLooperForThread(looperThread);
if (shadowOf(looper) instanceof CustomLooper
&& shadowOf(looper) != ShadowLooper.getShadowMainLooper()) {
&& shadowOf(looper) != shadowOf(Looper.getMainLooper())) {
((CustomLooper) shadowOf(looper)).removeMessages(handler, what, object);
}
}
......@@ -186,7 +186,7 @@ public final class RobolectricUtil {
public void removeCallbacksAndMessages(Handler handler, Object object) {
Looper looper = ShadowLooper.getLooperForThread(looperThread);
if (shadowOf(looper) instanceof CustomLooper
&& shadowOf(looper) != ShadowLooper.getShadowMainLooper()) {
&& shadowOf(looper) != shadowOf(Looper.getMainLooper())) {
((CustomLooper) shadowOf(looper)).removeMessages(handler, ANY_MESSAGE, object);
}
}
......
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