Bug 1456050 - Add marionette.debugging.clicktostart to MarionettePrefs. r=whimboo
authorAndreas Tolfsen <ato@sny.no>
Mon, 23 Apr 2018 07:17:44 +0100
changeset 471374 6a7a5b9844b8eb0e355aaa76278ac72e332f9fcf
parent 471373 77e5d42d7d55a5994ca54707b7abbf3d72167852
child 471375 c0541b429211c69cc572e71af9e08be8ac4f94ee
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswhimboo
bugs1456050
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 1456050 - Add marionette.debugging.clicktostart to MarionettePrefs. r=whimboo MozReview-Commit-ID: BAxcJFcv1uD
testing/marionette/driver.js
testing/marionette/prefs.js
testing/marionette/prefs/marionette.js
testing/marionette/test/unit/test_prefs.js
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -44,16 +44,17 @@ const {
   WebDriverError,
 } = ChromeUtils.import("chrome://marionette/content/error.js", {});
 ChromeUtils.import("chrome://marionette/content/evaluate.js");
 const {pprint} = ChromeUtils.import("chrome://marionette/content/format.js", {});
 ChromeUtils.import("chrome://marionette/content/interaction.js");
 ChromeUtils.import("chrome://marionette/content/l10n.js");
 ChromeUtils.import("chrome://marionette/content/legacyaction.js");
 ChromeUtils.import("chrome://marionette/content/modal.js");
+const {MarionettePrefs} = ChromeUtils.import("chrome://marionette/content/prefs.js", {});
 ChromeUtils.import("chrome://marionette/content/proxy.js");
 ChromeUtils.import("chrome://marionette/content/reftest.js");
 ChromeUtils.import("chrome://marionette/content/session.js");
 const {
   PollPromise,
   TimedPromise,
 } = ChromeUtils.import("chrome://marionette/content/sync.js", {});
 
@@ -61,17 +62,16 @@ Cu.importGlobalProperties(["URL"]);
 
 this.EXPORTED_SYMBOLS = ["GeckoDriver"];
 
 const APP_ID_FIREFOX = "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";
 
 const FRAME_SCRIPT = "chrome://marionette/content/listener.js";
 const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
 
-const CLICK_TO_START_PREF = "marionette.debugging.clicktostart";
 const CONTENT_LISTENER_PREF = "marionette.contentListener";
 
 const SUPPORTED_STRATEGIES = new Set([
   element.Strategy.ClassName,
   element.Strategy.Selector,
   element.Strategy.ID,
   element.Strategy.TagName,
   element.Strategy.XPath,
@@ -731,18 +731,17 @@ GeckoDriver.prototype.newSession = async
         if (ev.target != win.document) {
           return;
         }
         win.removeEventListener("load", listener);
         waitForWindow.call(this);
       };
       win.addEventListener("load", listener, true);
     } else {
-      let clickToStart = Preferences.get(CLICK_TO_START_PREF);
-      if (clickToStart) {
+      if (MarionettePrefs.clickToStart) {
         Services.prompt.alert(win, "", "Click to start execution of marionette tests");
       }
       this.startBrowser(win, true);
     }
   };
 
   if (!Preferences.get(CONTENT_LISTENER_PREF)) {
     waitForWindow.call(this);
--- a/testing/marionette/prefs.js
+++ b/testing/marionette/prefs.js
@@ -150,16 +150,27 @@ class MarionetteBranch extends Branch {
     return this.get("enabled", false);
   }
 
   set enabled(isEnabled) {
     this.set("enabled", isEnabled);
   }
 
   /**
+   * The `marionette.debugging.clicktostart` preference delays
+   * server startup until a modal dialogue has been clicked to allow
+   * time for user to set breakpoints in the Browser Toolbox.
+   *
+   * @return {boolean}
+   */
+  get clickToStart() {
+    return this.get("debugging.clicktostart", false);
+  }
+
+  /**
    * The `marionette.port` preference, detailing which port
    * the TCP server should listen on.
    *
    * @return {number}
    */
   get port() {
     return this.get("port", 2828);
   }
--- a/testing/marionette/prefs/marionette.js
+++ b/testing/marionette/prefs/marionette.js
@@ -6,17 +6,17 @@
 
 // Marionette is the remote protocol that lets OOP programs
 // communicate with, instrument, and control Gecko.
 
 // Starts and stops the Marionette server.
 pref("marionette.enabled", false);
 
 // Delay server startup until a modal dialogue has been clicked to
-// allow time for user to set breakpoints in Browser Toolbox.
+// allow time for user to set breakpoints in the Browser Toolbox.
 pref("marionette.debugging.clicktostart", false);
 
 // Marionette logging verbosity.  Allowed values are "fatal", "error",
 // "warn", "info", "config", "debug", and "trace".
 pref("marionette.log.level", "info");
 
 // Port to start Marionette server on.
 pref("marionette.port", 2828);
--- a/testing/marionette/test/unit/test_prefs.js
+++ b/testing/marionette/test/unit/test_prefs.js
@@ -98,16 +98,17 @@ add_test(function test_EnvironmentPrefs_
     env.set("FOO", null);
   }
 
   run_next_test();
 });
 
 add_test(function test_MarionettePrefs_getters() {
   equal(false, MarionettePrefs.enabled);
+  equal(false, MarionettePrefs.clickToStart);
   equal(2828, MarionettePrefs.port);
   equal(Log.Level.Info, MarionettePrefs.logLevel);
   equal(true, MarionettePrefs.recommendedPrefs);
 
   run_next_test();
 });
 
 add_test(function test_MarionettePrefs_setters() {