Skip to content

Commit

Permalink
Bug 1480920 - Bump versions for Android test runner packages r=jchen
Browse files Browse the repository at this point in the history
This also removes the trivial tests for geckoview_example that were
causing problems.

Differential Revision: https://phabricator.services.mozilla.com/D3991

--HG--
extra : moz-landing-system : lando
  • Loading branch information
snorp committed Aug 23, 2018
1 parent e6844b6 commit e641866
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 95 deletions.
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ 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"]
Expand Down
6 changes: 3 additions & 3 deletions mobile/android/geckoview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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: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.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:support-annotations:$support_library_version"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ public class GeckoResultTest {
private static class MockException extends RuntimeException {
}

@Rule
public UiThreadTestRule mUiThreadTestRule = new UiThreadTestRule();

private boolean mDone;

private void waitUntilDone() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

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;
Expand All @@ -32,6 +31,7 @@
import org.json.JSONObject;

import org.junit.rules.ErrorCollector;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;

Expand All @@ -42,17 +42,12 @@
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;
Expand All @@ -77,6 +72,7 @@
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;
Expand All @@ -88,7 +84,7 @@
* for waiting on particular callbacks to be called, and methods for asserting that
* callbacks are called in the proper order.
*/
public class GeckoSessionTestRule extends UiThreadTestRule {
public class GeckoSessionTestRule implements TestRule {
private static final String LOGTAG = "GeckoSessionTestRule";

private static final long DEFAULT_TIMEOUT_MILLIS = 10000;
Expand Down Expand Up @@ -1478,23 +1474,35 @@ protected void cleanupStatement() throws Throwable {

@Override
public Statement apply(final Statement base, final Description description) {
return super.apply(new Statement() {
return new Statement() {
@Override
public void evaluate() throws Throwable {
try {
prepareStatement(description);
base.evaluate();
performTestEndCheck();
} finally {
cleanupStatement();
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;
}
}
}, description);
}

@Override
protected boolean shouldRunOnUiThread(final Description description) {
return true;
};
}

/**
Expand Down
9 changes: 0 additions & 9 deletions mobile/android/geckoview_example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ android {
applicationId "org.mozilla.geckoview_example"
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

buildTypes {
Expand All @@ -30,16 +29,8 @@ android {
}

dependencies {
testImplementation 'junit:junit:4.12'

implementation "com.android.support:support-annotations:$support_library_version"
implementation "com.android.support:appcompat-v7:$support_library_version"

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"

implementation project(path: ':geckoview')
}

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit e641866

Please sign in to comment.