Backed out changeset d3978309484a (bug 1480920) For Android build bustages CLOSED TREE
authorarthur.iakab <aiakab@mozilla.com>
Thu, 09 Aug 2018 23:59:05 +0300
changeset 486000 479342879a30961cd7d0cec6b31fb0b5d4e4d8eb
parent 485999 3c4564c2f2d5b0b5fe4a0c1f80896484a0b0f5d7
child 486001 83ab70ff5231b11e46b72f7f34579f4962c48661
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1480920
milestone63.0a1
backs outd3978309484acd5512a017190a20bc1e2b4a3618
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset d3978309484a (bug 1480920) For Android build bustages CLOSED TREE
build.gradle
mobile/android/geckoview/build.gradle
mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/GeckoResultTest.java
mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java
mobile/android/geckoview_example/build.gradle
--- a/build.gradle
+++ b/build.gradle
@@ -106,19 +106,16 @@ afterEvaluate {
                 // Add compiler args for all code except third-party code.
                 options.compilerArgs += [
                     // Turn on all warnings, except...
                     "-Xlint:all",
                     // Deprecation, because we do use deprecated API for compatibility.
                     "-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"]
             }
             if (project.name == 'app') {
                 tasks.withType(JavaCompile) {
                     // Turn off classfile warnings because upon updating to play services 15.0.0
                     // a warning is being thrown from play-services-base which fails the build
--- a/mobile/android/geckoview/build.gradle
+++ b/mobile/android/geckoview/build.gradle
@@ -195,19 +195,19 @@ dependencies {
     implementation "com.android.support:palette-v7:$support_library_version"
 
     testImplementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
     testImplementation 'junit:junit:4.12'
     testImplementation 'org.robolectric:robolectric:3.8'
     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"
 }
 
 apply from: "${topsrcdir}/mobile/android/gradle/with_gecko_binaries.gradle"
 
 android.libraryVariants.all { variant ->
     // See the notes in mobile/android/app/build.gradle for details on including
     // Gecko binaries and the Omnijar.
--- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/GeckoResultTest.java
+++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/GeckoResultTest.java
@@ -24,16 +24,19 @@ import static org.junit.Assert.assertTha
 @RunWith(AndroidJUnit4.class)
 @MediumTest
 public class GeckoResultTest {
     private static final long DEFAULT_TIMEOUT = 5000;
 
     private static class MockException extends RuntimeException {
     }
 
+    @Rule
+    public UiThreadTestRule mUiThreadTestRule = new UiThreadTestRule();
+
     private boolean mDone;
 
     private void waitUntilDone() {
         assertThat("We should not be done", mDone, equalTo(false));
 
         while (!mDone) {
             UiThreadUtils.loopUntilIdle(DEFAULT_TIMEOUT);
         }
--- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java
+++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java
@@ -1,18 +1,18 @@
 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 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;
 import org.mozilla.geckoview.GeckoRuntime;
 import org.mozilla.geckoview.GeckoRuntimeSettings;
 import org.mozilla.geckoview.GeckoSession;
 import org.mozilla.geckoview.GeckoSessionSettings;
 import org.mozilla.geckoview.SessionTextInput;
@@ -37,22 +37,27 @@ import org.junit.runners.model.Statement
 
 import android.app.Instrumentation;
 import android.graphics.Point;
 import android.graphics.SurfaceTexture;
 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;
 
 import java.io.File;
 import java.lang.annotation.Annotation;
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
@@ -67,29 +72,28 @@ import java.lang.reflect.Proxy;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashMap;
 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;
 import kotlin.reflect.KClass;
 
 /**
  * TestRule that, for each test, sets up a GeckoSession, runs the test on the UI thread,
  * and tears down the GeckoSession at the end of the test. The rule also provides methods
  * 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;
     private static final long DEFAULT_ARM_DEVICE_TIMEOUT_MILLIS = 30000;
     private static final long DEFAULT_ARM_EMULATOR_TIMEOUT_MILLIS = 120000;
     private static final long DEFAULT_X86_DEVICE_TIMEOUT_MILLIS = 30000;
     private static final long DEFAULT_X86_EMULATOR_TIMEOUT_MILLIS = 5000;
     private static final long DEFAULT_IDE_DEBUG_TIMEOUT_MILLIS = 86400000;
@@ -1469,45 +1473,33 @@ public class GeckoSessionTestRule implem
         mLastWaitEnd = 0;
         mTimeoutMillis = 0;
         mRDPTabs = null;
         mRDPChromeProcess = null;
     }
 
     @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;
     }
 
     /**
      * Wait until a page load has finished on any session. A session must have started a
      * page load since the last wait, or this method will wait indefinitely.
      */
     public void waitForPageStop() {
         waitForPageStop(/* session */ null);
--- a/mobile/android/geckoview_example/build.gradle
+++ b/mobile/android/geckoview_example/build.gradle
@@ -30,16 +30,16 @@ 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: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"
 
     implementation project(path: ':geckoview')
 }