Commit 7e33411d authored by Mark Banner's avatar Mark Banner
Browse files

Bug 1601633 - In search tests, when running asyncReInit, don't reset the...

Bug 1601633 - In search tests, when running asyncReInit, don't reset the search service. r=mikedeboer

SearchService.reset() isn't designed to be called with reInit, but with init.

Differential Revision: https://phabricator.services.mozilla.com/D55462

--HG--
extra : moz-landing-system : lando
parent b0370355
...@@ -509,10 +509,7 @@ function installTestEngine() { ...@@ -509,10 +509,7 @@ function installTestEngine() {
return addTestEngines([{ name: kTestEngineName, xmlFileName: "engine.xml" }]); return addTestEngines([{ name: kTestEngineName, xmlFileName: "engine.xml" }]);
} }
async function asyncReInit({ async function asyncReInit({ waitForRegionFetch = false } = {}) {
waitForRegionFetch = false,
skipReset = false,
} = {}) {
let promises = [SearchTestUtils.promiseSearchNotification("reinit-complete")]; let promises = [SearchTestUtils.promiseSearchNotification("reinit-complete")];
if (waitForRegionFetch) { if (waitForRegionFetch) {
promises.push( promises.push(
...@@ -520,9 +517,6 @@ async function asyncReInit({ ...@@ -520,9 +517,6 @@ async function asyncReInit({
); );
} }
if (!skipReset) {
Services.search.reset();
}
Services.search.reInit(!waitForRegionFetch); Services.search.reInit(!waitForRegionFetch);
return Promise.all(promises); return Promise.all(promises);
......
...@@ -84,7 +84,7 @@ add_task(async function test_listJSONlocaleSwitch() { ...@@ -84,7 +84,7 @@ add_task(async function test_listJSONlocaleSwitch() {
add_task(async function test_listJSONRegionOverride() { add_task(async function test_listJSONRegionOverride() {
Services.prefs.setCharPref("browser.search.region", "RU"); Services.prefs.setCharPref("browser.search.region", "RU");
await asyncReInit({ skipReset: true }); await asyncReInit();
Assert.ok(Services.search.isInitialized, "search initialized"); Assert.ok(Services.search.isInitialized, "search initialized");
......
...@@ -41,7 +41,7 @@ add_task(async function test_defaultEngineNameUserPrefUS() { ...@@ -41,7 +41,7 @@ add_task(async function test_defaultEngineNameUserPrefUS() {
// Set the browser.search.defaultenginename pref. // Set the browser.search.defaultenginename pref.
Services.prefs.setCharPref(kDefaultenginenamePref, "Bing"); Services.prefs.setCharPref(kDefaultenginenamePref, "Bing");
await asyncReInit({ skipReset: true }); await asyncReInit();
Assert.equal( Assert.equal(
(await Services.search.getDefault()).name, (await Services.search.getDefault()).name,
defaultEngineName, defaultEngineName,
...@@ -66,7 +66,7 @@ add_task(async function test_defaultEngineNameDefaultPrefUS() { ...@@ -66,7 +66,7 @@ add_task(async function test_defaultEngineNameDefaultPrefUS() {
"data:text/plain,browser.search.defaultenginename=Bing" "data:text/plain,browser.search.defaultenginename=Bing"
); );
await asyncReInit({ skipReset: true }); await asyncReInit();
Assert.equal( Assert.equal(
(await Services.search.getDefault()).name, (await Services.search.getDefault()).name,
"Bing", "Bing",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment