Bug 1361080 - update webextension tests to directly use devtools loader;r=rpl
authorJulian Descottes <jdescottes@mozilla.com>
Fri, 29 Sep 2017 15:28:19 +0200
changeset 385943 e53ec162daed8a43a54827a01945863355b42e2e
parent 385942 8cddec5ae4ee8def947670fa9103f9022edbfc34
child 385944 63a2497c280c599c20d618374d7dcd7af0e2f638
push id32672
push userarchaeopteryx@coole-files.de
push dateFri, 13 Oct 2017 09:00:05 +0000
treeherdermozilla-central@3efcb26e5f37 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrpl
bugs1361080
milestone58.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 1361080 - update webextension tests to directly use devtools loader;r=rpl In the end the webextensions tests that test devtools should be able to load devtools apis in the same way as devtools tests. This allows to remove the gDevTools getter on the devtools shim, which makes the paths that can potentially initialize devtools easier to predict. MozReview-Commit-ID: AHokH12ygKI
browser/components/extensions/test/browser/browser_ext_devtools_inspectedWindow.js
browser/components/extensions/test/browser/browser_ext_devtools_inspectedWindow_eval_bindings.js
browser/components/extensions/test/browser/browser_ext_devtools_inspectedWindow_reload.js
browser/components/extensions/test/browser/browser_ext_devtools_network.js
browser/components/extensions/test/browser/browser_ext_devtools_page.js
browser/components/extensions/test/browser/browser_ext_devtools_panel.js
--- a/browser/components/extensions/test/browser/browser_ext_devtools_inspectedWindow.js
+++ b/browser/components/extensions/test/browser/browser_ext_devtools_inspectedWindow.js
@@ -1,14 +1,14 @@
 /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set sts=2 sw=2 et tw=80: */
 "use strict";
 
-const {DevToolsShim} = Cu.import("chrome://devtools-shim/content/DevToolsShim.jsm", {});
-const {gDevTools} = DevToolsShim;
+const {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
+const {gDevTools} = require("devtools/client/framework/devtools");
 
 /**
  * Helper that returns the id of the last additional/extension tool for a provided
  * toolbox.
  *
  * @param {Object} toolbox
  *        The DevTools toolbox object.
  * @param {string} label
--- a/browser/components/extensions/test/browser/browser_ext_devtools_inspectedWindow_eval_bindings.js
+++ b/browser/components/extensions/test/browser/browser_ext_devtools_inspectedWindow_eval_bindings.js
@@ -1,14 +1,14 @@
 /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set sts=2 sw=2 et tw=80: */
 "use strict";
 
-XPCOMUtils.defineLazyModuleGetter(this, "DevToolsShim",
-                                  "chrome://devtools-shim/content/DevToolsShim.jsm");
+const {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
+const {gDevTools} = require("devtools/client/framework/devtools");
 
 /**
  * this test file ensures that:
  *
  * - devtools.inspectedWindow.eval provides the expected $0 and inspect bindings
  */
 add_task(async function test_devtools_inspectedWindow_eval_bindings() {
   const TEST_TARGET_URL = "http://mochi.test:8888/";
@@ -49,18 +49,16 @@ add_task(async function test_devtools_in
        </body>
       </html>`,
       "devtools_page.js": devtools_page,
     },
   });
 
   await extension.startup();
 
-  const {gDevTools} = DevToolsShim;
-
   const target = gDevTools.getTargetForTab(tab);
   // Open the toolbox on the styleeditor, so that the inspector and the
   // console panel have not been explicitly activated yet.
   const toolbox = await gDevTools.showToolbox(target, "styleeditor");
   info("Developer toolbox opened");
 
   // Test $0 binding with no selected node
   info("Test inspectedWindow.eval $0 binding with no selected node");
--- a/browser/components/extensions/test/browser/browser_ext_devtools_inspectedWindow_reload.js
+++ b/browser/components/extensions/test/browser/browser_ext_devtools_inspectedWindow_reload.js
@@ -1,18 +1,18 @@
 /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set sts=2 sw=2 et tw=80: */
 "use strict";
 
 // Like most of the mochitest-browser devtools test,
 // on debug test slave, it takes about 50s to run the test.
 requestLongerTimeout(4);
 
-const {DevToolsShim} = Cu.import("chrome://devtools-shim/content/DevToolsShim.jsm", {});
-const {gDevTools} = DevToolsShim;
+const {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
+const {gDevTools} = require("devtools/client/framework/devtools");
 
 // Small helper which provides the common steps to the following reload test cases.
 async function runReloadTestCase({urlParams, background, devtoolsPage, testCase}) {
   const BASE = "http://mochi.test:8888/browser/browser/components/extensions/test/browser/";
   const TEST_TARGET_URL = `${BASE}file_inspectedwindow_reload_target.sjs?${urlParams}`;
   let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_TARGET_URL);
 
   let extension = ExtensionTestUtils.loadExtension({
--- a/browser/components/extensions/test/browser/browser_ext_devtools_network.js
+++ b/browser/components/extensions/test/browser/browser_ext_devtools_network.js
@@ -1,14 +1,14 @@
 /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set sts=2 sw=2 et tw=80: */
 "use strict";
 
-const {DevToolsShim} = Cu.import("chrome://devtools-shim/content/DevToolsShim.jsm", {});
-const {gDevTools} = DevToolsShim;
+const {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
+const {gDevTools} = require("devtools/client/framework/devtools");
 
 add_task(async function test_devtools_network_on_navigated() {
   let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "http://mochi.test:8888/");
 
   function background() {
     browser.test.onMessage.addListener(msg => {
       let code;
       if (msg === "navigate") {
--- a/browser/components/extensions/test/browser/browser_ext_devtools_page.js
+++ b/browser/components/extensions/test/browser/browser_ext_devtools_page.js
@@ -1,14 +1,14 @@
 /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set sts=2 sw=2 et tw=80: */
 "use strict";
 
-const {DevToolsShim} = Cu.import("chrome://devtools-shim/content/DevToolsShim.jsm", {});
-const {gDevTools} = DevToolsShim;
+const {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
+const {gDevTools} = require("devtools/client/framework/devtools");
 
 /**
  * This test file ensures that:
  *
  * - the devtools_page property creates a new WebExtensions context
  * - the devtools_page can exchange messages with the background page
  */
 add_task(async function test_devtools_page_runtime_api_messaging() {
--- a/browser/components/extensions/test/browser/browser_ext_devtools_panel.js
+++ b/browser/components/extensions/test/browser/browser_ext_devtools_panel.js
@@ -1,17 +1,17 @@
 /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set sts=2 sw=2 et tw=80: */
 "use strict";
 
 XPCOMUtils.defineLazyModuleGetter(this, "Preferences",
                                   "resource://gre/modules/Preferences.jsm");
 
-const {DevToolsShim} = Cu.import("chrome://devtools-shim/content/DevToolsShim.jsm", {});
-const {gDevTools} = DevToolsShim;
+const {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
+const {gDevTools} = require("devtools/client/framework/devtools");
 
 const DEVTOOLS_THEME_PREF = "devtools.theme";
 
 /**
  * This test file ensures that:
  *
  * - devtools.panels.themeName returns the correct value,
  *   both from a page and a panel.