Bug 1854456 - Ensure the Urlbar component's browser mochitests and XPCShell tests use add_setup correctly. r=adw

Differential Revision: https://phabricator.services.mozilla.com/D188889
This commit is contained in:
Stephanie Cunnane 2023-09-22 21:23:40 +00:00
parent a99a113414
commit c09bf2ddc0
19 changed files with 19 additions and 19 deletions

View file

@ -418,7 +418,7 @@ const TEST_CASES = [
}, },
]; ];
add_task(async function setup() { add_setup(async function () {
UrlbarPrefs.set("quicksuggest.enabled", true); UrlbarPrefs.set("quicksuggest.enabled", true);
UrlbarPrefs.set("suggest.quicksuggest.sponsored", true); UrlbarPrefs.set("suggest.quicksuggest.sponsored", true);
UrlbarPrefs.set("suggest.quicksuggest.nonsponsored", true); UrlbarPrefs.set("suggest.quicksuggest.nonsponsored", true);

View file

@ -19,7 +19,7 @@ const match = new UrlbarResult(
); );
let controller; let controller;
add_task(async function setup() { add_setup(async function () {
controller = UrlbarTestUtils.newMockController(); controller = UrlbarTestUtils.newMockController();
}); });

View file

@ -63,7 +63,7 @@ function getHistogramReportsCount(results) {
return sum; return sum;
} }
add_task(function setup() { add_setup(function () {
controller = UrlbarTestUtils.newMockController(); controller = UrlbarTestUtils.newMockController();
firstHistogram = Services.telemetry.getHistogramById(TELEMETRY_1ST_RESULT); firstHistogram = Services.telemetry.getHistogramById(TELEMETRY_1ST_RESULT);

View file

@ -35,7 +35,7 @@ function assertContextMatches(context, expectedValues) {
} }
} }
add_task(function setup() { add_setup(function () {
sandbox = sinon.createSandbox(); sandbox = sinon.createSandbox();
fPM = { fPM = {

View file

@ -17,7 +17,7 @@ const { PlacesUIUtils } = ChromeUtils.importESModule(
let sandbox; let sandbox;
add_task(function setup() { add_setup(function () {
sandbox = sinon.createSandbox(); sandbox = sinon.createSandbox();
}); });

View file

@ -4,7 +4,7 @@
// Functional tests for inline autocomplete // Functional tests for inline autocomplete
add_task(async function setup() { add_setup(async function () {
registerCleanupFunction(async () => { registerCleanupFunction(async () => {
Services.prefs.clearUserPref("browser.urlbar.suggest.searches"); Services.prefs.clearUserPref("browser.urlbar.suggest.searches");
Services.prefs.clearUserPref("browser.urlbar.suggest.quickactions"); Services.prefs.clearUserPref("browser.urlbar.suggest.quickactions");

View file

@ -52,7 +52,7 @@ class FastHeuristicProvider extends TestProvider {
} }
} }
add_task(async function setup() { add_setup(async function () {
registerCleanupFunction(async () => { registerCleanupFunction(async () => {
Services.prefs.clearUserPref("browser.urlbar.suggest.searches"); Services.prefs.clearUserPref("browser.urlbar.suggest.searches");
}); });

View file

@ -11,7 +11,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
let sandbox; let sandbox;
add_task(async function setup() { add_setup(async function () {
sandbox = lazy.sinon.createSandbox(); sandbox = lazy.sinon.createSandbox();
registerCleanupFunction(() => { registerCleanupFunction(() => {
sandbox.restore(); sandbox.restore();

View file

@ -18,7 +18,7 @@ const TEST_SPACES = [" ", "\u3000", " \u3000", "\u3000 "];
testEngine_setup(); testEngine_setup();
add_task(async function setup() { add_setup(async function () {
registerCleanupFunction(async () => { registerCleanupFunction(async () => {
Services.prefs.clearUserPref(QUICKACTIONS_PREF); Services.prefs.clearUserPref(QUICKACTIONS_PREF);
Services.prefs.clearUserPref(SUGGEST_ENABLED_PREF); Services.prefs.clearUserPref(SUGGEST_ENABLED_PREF);

View file

@ -5,7 +5,7 @@
// Test for the behavior of UrlbarProviderHistoryUrlHeuristic. // Test for the behavior of UrlbarProviderHistoryUrlHeuristic.
add_task(async function setup() { add_setup(async function () {
Services.prefs.setBoolPref("browser.urlbar.autoFill", false); Services.prefs.setBoolPref("browser.urlbar.autoFill", false);
registerCleanupFunction(() => { registerCleanupFunction(() => {
Services.prefs.clearUserPref("browser.urlbar.autoFill"); Services.prefs.clearUserPref("browser.urlbar.autoFill");

View file

@ -20,7 +20,7 @@ async function cleanup() {
await PlacesUtils.history.clear(); await PlacesUtils.history.clear();
} }
add_task(function setup() { add_setup(function () {
Services.prefs.setBoolPref(SUGGEST_PREF, false); Services.prefs.setBoolPref(SUGGEST_PREF, false);
Services.prefs.setBoolPref(SUGGEST_ENABLED_PREF, false); Services.prefs.setBoolPref(SUGGEST_ENABLED_PREF, false);

View file

@ -13,7 +13,7 @@ ChromeUtils.defineESModuleGetters(this, {
UrlbarProviderAutofill: "resource:///modules/UrlbarProviderAutofill.sys.mjs", UrlbarProviderAutofill: "resource:///modules/UrlbarProviderAutofill.sys.mjs",
}); });
add_task(async function setup() { add_setup(async function () {
Services.prefs.setBoolPref("browser.urlbar.suggest.searches", false); Services.prefs.setBoolPref("browser.urlbar.suggest.searches", false);
Services.prefs.setBoolPref("browser.urlbar.suggest.quickactions", false); Services.prefs.setBoolPref("browser.urlbar.suggest.quickactions", false);
// Disable tab-to-search onboarding results. // Disable tab-to-search onboarding results.

View file

@ -48,7 +48,7 @@ function configureEngine(clients) {
testEngine_setup(); testEngine_setup();
add_task(async function setup() { add_setup(async function () {
// Tell Sync about the mocks. // Tell Sync about the mocks.
Weave.Service.engineManager.register(MockTabsEngine); Weave.Service.engineManager.register(MockTabsEngine);

View file

@ -33,7 +33,7 @@ const MAX_RESULTS = 10;
let sandbox; let sandbox;
add_task(async function setup() { add_setup(async function () {
// Set a specific maxRichResults for sanity's sake. // Set a specific maxRichResults for sanity's sake.
Services.prefs.setIntPref(MAX_RICH_RESULTS_PREF, MAX_RESULTS); Services.prefs.setIntPref(MAX_RICH_RESULTS_PREF, MAX_RESULTS);

View file

@ -5,7 +5,7 @@
testEngine_setup(); testEngine_setup();
const engineDomain = "s.example.com"; const engineDomain = "s.example.com";
add_task(async function setup() { add_setup(async function () {
Services.prefs.setBoolPref("browser.urlbar.restyleSearches", true); Services.prefs.setBoolPref("browser.urlbar.restyleSearches", true);
await SearchTestUtils.installSearchExtension({ await SearchTestUtils.installSearchExtension({
name: "MozSearch", name: "MozSearch",

View file

@ -128,7 +128,7 @@ function setResultGroups(groups) {
}); });
} }
add_task(async function setup() { add_setup(async function () {
sandbox = lazy.sinon.createSandbox(); sandbox = lazy.sinon.createSandbox();
let engine = await addTestSuggestionsEngine(searchStr => { let engine = await addTestSuggestionsEngine(searchStr => {

View file

@ -20,7 +20,7 @@ const TEST_SPACES = [" ", "\u3000", " \u3000", "\u3000 "];
let engine; let engine;
let port; let port;
add_task(async function setup() { add_setup(async function () {
engine = await addTestSuggestionsEngine(); engine = await addTestSuggestionsEngine();
port = engine.getSubmission("").uri.port; port = engine.getSubmission("").uri.port;

View file

@ -41,7 +41,7 @@ async function cleanUpSuggestions() {
} }
} }
add_task(async function setup() { add_setup(async function () {
let engine = await addTestTailSuggestionsEngine(searchStr => { let engine = await addTestTailSuggestionsEngine(searchStr => {
return suggestionsFn(searchStr); return suggestionsFn(searchStr);
}); });

View file

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file, * 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/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
add_task(async function setup() { add_setup(async function () {
registerCleanupFunction(async () => { registerCleanupFunction(async () => {
Services.prefs.clearUserPref("browser.urlbar.suggest.searches"); Services.prefs.clearUserPref("browser.urlbar.suggest.searches");
}); });