Skip to content

Commit

Permalink
Bug 1799314 - Convert consumers of testing modules to import ES modul…
Browse files Browse the repository at this point in the history
…es direct (services/). r=markh

Differential Revision: https://phabricator.services.mozilla.com/D161911
  • Loading branch information
Standard8 committed Nov 17, 2022
1 parent 25dcc09 commit 194d9e0
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 18 deletions.
4 changes: 2 additions & 2 deletions services/common/tests/unit/head_global.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ var { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);

const { updateAppInfo } = ChromeUtils.import(
"resource://testing-common/AppInfo.jsm"
const { updateAppInfo } = ChromeUtils.importESModule(
"resource://testing-common/AppInfo.sys.mjs"
);
updateAppInfo({
name: "XPCShell",
Expand Down
4 changes: 2 additions & 2 deletions services/common/tests/unit/head_helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ var {
var { getTestLogger, initTestLogging } = ChromeUtils.import(
"resource://testing-common/services/common/logging.js"
);
var { MockRegistrar } = ChromeUtils.import(
"resource://testing-common/MockRegistrar.jsm"
var { MockRegistrar } = ChromeUtils.importESModule(
"resource://testing-common/MockRegistrar.sys.mjs"
);
var { NetUtil } = ChromeUtils.import("resource://gre/modules/NetUtil.jsm");

Expand Down
4 changes: 2 additions & 2 deletions services/crypto/tests/unit/head_helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ try {
OS = "Linux";
}

const { updateAppInfo } = ChromeUtils.import(
"resource://testing-common/AppInfo.jsm"
const { updateAppInfo } = ChromeUtils.importESModule(
"resource://testing-common/AppInfo.sys.mjs"
);
updateAppInfo({
name: "XPCShell",
Expand Down
4 changes: 2 additions & 2 deletions services/settings/test/unit/test_remote_settings_utils.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* import-globals-from ../../../common/tests/unit/head_helpers.js */

const { TestUtils } = ChromeUtils.import(
"resource://testing-common/TestUtils.jsm"
const { TestUtils } = ChromeUtils.importESModule(
"resource://testing-common/TestUtils.sys.mjs"
);
const { Utils } = ChromeUtils.import("resource://services-settings/Utils.jsm");

Expand Down
4 changes: 2 additions & 2 deletions services/settings/test/unit/test_remote_settings_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
const { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs"
);
const { TestUtils } = ChromeUtils.import(
"resource://testing-common/TestUtils.jsm"
const { TestUtils } = ChromeUtils.importESModule(
"resource://testing-common/TestUtils.sys.mjs"
);

const { RemoteSettingsWorker } = ChromeUtils.import(
Expand Down
4 changes: 2 additions & 2 deletions services/settings/test/unit/test_shutdown_handling.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

const { TestUtils } = ChromeUtils.import(
"resource://testing-common/TestUtils.jsm"
const { TestUtils } = ChromeUtils.importESModule(
"resource://testing-common/TestUtils.sys.mjs"
);

const { Database } = ChromeUtils.import(
Expand Down
4 changes: 3 additions & 1 deletion services/sync/modules-testing/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ const { CommonUtils } = ChromeUtils.import(
const { CryptoUtils } = ChromeUtils.import(
"resource://services-crypto/utils.js"
);
const { Assert } = ChromeUtils.import("resource://testing-common/Assert.jsm");
const { Assert } = ChromeUtils.importESModule(
"resource://testing-common/Assert.sys.mjs"
);
const { initTestLogging } = ChromeUtils.import(
"resource://testing-common/services/common/logging.js"
);
Expand Down
4 changes: 2 additions & 2 deletions services/sync/tests/unit/head_appinfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ function getOS() {
}
}

const { updateAppInfo } = ChromeUtils.import(
"resource://testing-common/AppInfo.jsm"
const { updateAppInfo } = ChromeUtils.importESModule(
"resource://testing-common/AppInfo.sys.mjs"
);
updateAppInfo({
name: "XPCShell",
Expand Down
4 changes: 2 additions & 2 deletions services/sync/tests/unit/head_http_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ var Cm = Components.manager;
// Shared logging for all HTTP server functions.
var { Log } = ChromeUtils.importESModule("resource://gre/modules/Log.sys.mjs");
var { CommonUtils } = ChromeUtils.import("resource://services-common/utils.js");
var { TestUtils } = ChromeUtils.import(
"resource://testing-common/TestUtils.jsm"
var { TestUtils } = ChromeUtils.importESModule(
"resource://testing-common/TestUtils.sys.mjs"
);
var {
AccountState,
Expand Down
2 changes: 1 addition & 1 deletion services/sync/tps/extensions/tps/resource/modules/tabs.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const { Weave } = ChromeUtils.import("resource://services-sync/main.js");
const { Logger } = ChromeUtils.import("resource://tps/logger.jsm");

// Unfortunately, due to where TPS is run, we can't directly reuse the logic from
// BrowserTestUtils.jsm. Moreover, we can't resolve the URI it loads the content
// BrowserTestUtils.sys.mjs. Moreover, we can't resolve the URI it loads the content
// frame script from ("chrome://mochikit/content/tests/BrowserTestUtils/content-utils.js"),
// hence the hackiness here and in BrowserTabs.Add.
Services.mm.loadFrameScript(
Expand Down

0 comments on commit 194d9e0

Please sign in to comment.