Backed out changeset d3978309484a (bug 1480920) For Android build bustages CLOSED TREE

This commit is contained in:
arthur.iakab 2018-08-09 23:59:05 +03:00
parent 6d4eb0a92e
commit dfb7a82313
5 changed files with 28 additions and 36 deletions

View File

@ -111,9 +111,6 @@ afterEvaluate {
"-Xlint:-deprecation",
// Serial, because we don't use Java serialization.
"-Xlint:-serial",
// Classfile, because javac has a bug with MethodParameters attributes
// with Java 7. https://bugs.openjdk.java.net/browse/JDK-8190452
"-Xlint:-classfile",
// Turn all remaining warnings into errors,
// unless marked by @SuppressWarnings.
"-Werror"]

View File

@ -200,9 +200,9 @@ dependencies {
testImplementation 'org.mockito:mockito-core:1.10.19'
androidTestImplementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation 'com.android.support.test:runner:0.5'
androidTestImplementation 'com.android.support.test:rules:0.5'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestImplementation "com.android.support:support-annotations:$support_library_version"
}

View File

@ -29,6 +29,9 @@ public class GeckoResultTest {
private static class MockException extends RuntimeException {
}
@Rule
public UiThreadTestRule mUiThreadTestRule = new UiThreadTestRule();
private boolean mDone;
private void waitUntilDone() {

View File

@ -5,9 +5,9 @@
package org.mozilla.geckoview.test.rule;
import org.junit.rules.TestRule;
import org.mozilla.gecko.gfx.GeckoDisplay;
import org.mozilla.geckoview.BuildConfig;
import org.mozilla.geckoview.GeckoResponse;
import org.mozilla.geckoview.GeckoResult;
import org.mozilla.geckoview.GeckoResult.OnExceptionListener;
import org.mozilla.geckoview.GeckoResult.OnValueListener;
@ -42,12 +42,17 @@ import android.net.LocalSocketAddress;
import android.os.Build;
import android.os.Bundle;
import android.os.Debug;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.MessageQueue;
import android.os.Process;
import android.os.SystemClock;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.test.InstrumentationRegistry;
import android.support.test.rule.UiThreadTestRule;
import android.util.Log;
import android.util.Pair;
import android.view.MotionEvent;
import android.view.Surface;
@ -72,7 +77,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Pattern;
import kotlin.jvm.JvmClassMappingKt;
@ -84,7 +88,7 @@ import kotlin.reflect.KClass;
* for waiting on particular callbacks to be called, and methods for asserting that
* callbacks are called in the proper order.
*/
public class GeckoSessionTestRule implements TestRule {
public class GeckoSessionTestRule extends UiThreadTestRule {
private static final String LOGTAG = "GeckoSessionTestRule";
private static final long DEFAULT_TIMEOUT_MILLIS = 10000;
@ -1474,35 +1478,23 @@ public class GeckoSessionTestRule implements TestRule {
@Override
public Statement apply(final Statement base, final Description description) {
return new Statement() {
return super.apply(new Statement() {
@Override
public void evaluate() throws Throwable {
final AtomicReference<Throwable> exceptionRef = new AtomicReference<>();
mInstrumentation.runOnMainSync(new Runnable() {
@Override
public void run() {
try {
prepareStatement(description);
base.evaluate();
performTestEndCheck();
} catch (Throwable t) {
exceptionRef.set(t);
} finally {
try {
cleanupStatement();
} catch (Throwable t) {
exceptionRef.set(t);
}
}
}
});
Throwable throwable = exceptionRef.get();
if (throwable != null) {
throw throwable;
try {
prepareStatement(description);
base.evaluate();
performTestEndCheck();
} finally {
cleanupStatement();
}
}
};
}, description);
}
@Override
protected boolean shouldRunOnUiThread(final Description description) {
return true;
}
/**

View File

@ -35,8 +35,8 @@ dependencies {
implementation "com.android.support:support-annotations:$support_library_version"
implementation "com.android.support:appcompat-v7:$support_library_version"
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestImplementation 'com.android.support.test:runner:0.5'
// Not defining this library again results in test-app assuming 23.1.1, and the following errors:
// "Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (23.4.0) and test app (23.1.1) differ."
androidTestImplementation "com.android.support:support-annotations:$support_library_version"