Bug 1454101 - 2. Add "use_multiprocess" arg for GeckoSessionTestRule; r=snorp
authorJim Chen <nchen@mozilla.com>
Wed, 18 Apr 2018 13:26:02 -0400
changeset 414367 93cc25c9864d2403b1e20d8de5a415cbd1883d9d
parent 414366 63e9f66de6ece193245abf185d1f8136016e8b3e
child 414368 3fcf64d3df170ab8ba8b069f9d9f316b7782b4e8
push id102317
push userbtara@mozilla.com
push dateWed, 18 Apr 2018 22:47:42 +0000
treeherdermozilla-inbound@c8b6fba2ae94 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1454101
milestone61.0a1
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
Bug 1454101 - 2. Add "use_multiprocess" arg for GeckoSessionTestRule; r=snorp Turn on multiprocess tests by passing the use_multiprocess flag to the instrumentation. MozReview-Commit-ID: 76TacGdfdnq
mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/BaseSessionTest.kt
mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java
--- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/BaseSessionTest.kt
+++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/BaseSessionTest.kt
@@ -3,16 +3,17 @@
  * 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
 
 import android.os.Parcel
 import android.support.test.InstrumentationRegistry
 import org.mozilla.geckoview.GeckoSession
+import org.mozilla.geckoview.GeckoSessionSettings
 import org.mozilla.geckoview.test.rule.GeckoSessionTestRule
 
 import org.hamcrest.Matcher
 import org.hamcrest.Matchers
 import org.junit.Rule
 import org.junit.rules.ErrorCollector
 
 import kotlin.reflect.KClass
@@ -45,16 +46,19 @@ open class BaseSessionTest(noErrorCollec
     }
 
     fun <T> forEachCall(vararg values: T): T = sessionRule.forEachCall(*values)
 
     fun getTestBytes(path: String) =
             InstrumentationRegistry.getTargetContext().resources.assets
                     .open(path.removePrefix("/assets/")).readBytes()
 
+    val GeckoSession.isRemote
+        get() = this.settings.getBoolean(GeckoSessionSettings.USE_MULTIPROCESS)
+
     fun GeckoSession.loadTestPath(path: String) =
             this.loadUri(GeckoSessionTestRule.APK_URI_PREFIX + path.removePrefix("/"))
 
     inline fun GeckoSession.toParcel(lambda: (Parcel) -> Unit) {
         val parcel = Parcel.obtain()
         try {
             this.writeToParcel(parcel, 0)
 
--- 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
@@ -398,19 +398,20 @@ public class GeckoSessionTestRule extend
             }
             return "";
         }
 
         public boolean isAutomation() {
             return !getEnvVar("MOZ_IN_AUTOMATION").isEmpty();
         }
 
-        public boolean isE10s() {
-            return mMainSession.getSettings().getBoolean(
-                    GeckoSessionSettings.USE_MULTIPROCESS);
+        public boolean isMultiprocess() {
+            return Boolean.valueOf(InstrumentationRegistry.getArguments()
+                                                          .getString("use_multiprocess",
+                                                                     "true"));
         }
 
         public boolean isDebugging() {
             return Debug.isDebuggerConnected();
         }
     }
 
     protected class CallbackDelegates {
@@ -531,16 +532,17 @@ public class GeckoSessionTestRule extend
     protected Point mDisplaySize;
     protected SurfaceTexture mDisplayTexture;
     protected Surface mDisplaySurface;
     protected GeckoDisplay mDisplay;
     protected boolean mClosedSession;
 
     public GeckoSessionTestRule() {
         mDefaultSettings = new GeckoSessionSettings();
+        mDefaultSettings.setBoolean(GeckoSessionSettings.USE_MULTIPROCESS, env.isMultiprocess());
     }
 
     /**
      * Set an ErrorCollector for assertion errors, or null to not use one.
      *
      * @param ec ErrorCollector or null.
      */
     public void setErrorCollector(final @Nullable ErrorCollector ec) {