Bug 1696027 - Remove use of nsISearchEngine.addEngineWithDetails from mochitests. r=daleharvey

Differential Revision: https://phabricator.services.mozilla.com/D107624
This commit is contained in:
Mark Banner 2021-03-10 14:21:12 +00:00
Родитель 47d38558c6
Коммит c37e909d81
58 изменённых файлов: 396 добавлений и 534 удалений

Просмотреть файл

@ -1,12 +1,16 @@
const ANY_URL = undefined;
const { SearchTestUtils } = ChromeUtils.import(
"resource://testing-common/SearchTestUtils.jsm"
);
SearchTestUtils.init(this);
registerCleanupFunction(async function cleanup() {
while (gBrowser.tabs.length > 1) {
BrowserTestUtils.removeTab(gBrowser.tabs[gBrowser.tabs.length - 1]);
}
await Services.search.setDefault(originalEngine);
let engine = Services.search.getEngineByName("MozSearch");
await Services.search.removeEngine(engine);
});
let originalEngine;
@ -15,9 +19,10 @@ add_task(async function test_setup() {
requestLongerTimeout(2);
// Stop search-engine loads from hitting the network
await Services.search.addEngineWithDetails("MozSearch", {
method: "GET",
template: "http://example.com/?q={searchTerms}",
await SearchTestUtils.installSearchExtension({
name: "MozSearch",
search_url: "https://example.com/",
search_url_get_params: "q={searchTerms}",
});
let engine = Services.search.getEngineByName("MozSearch");
originalEngine = await Services.search.getDefault();

Просмотреть файл

@ -1,7 +1,11 @@
const { SearchTestUtils } = ChromeUtils.import(
"resource://testing-common/SearchTestUtils.jsm"
);
SearchTestUtils.init(this);
registerCleanupFunction(async function cleanup() {
await Services.search.setDefault(originalEngine);
let engine = Services.search.getEngineByName("MozSearch");
await Services.search.removeEngine(engine);
});
let originalEngine;
@ -10,9 +14,10 @@ add_task(async function test_setup() {
requestLongerTimeout(10);
// Stop search-engine loads from hitting the network
await Services.search.addEngineWithDetails("MozSearch", {
method: "GET",
template: "http://example.com/?q={searchTerms}",
await SearchTestUtils.installSearchExtension({
name: "MozSearch",
search_url: "https://example.com/",
search_url_get_params: "q={searchTerms}",
});
let engine = Services.search.getEngineByName("MozSearch");
originalEngine = await Services.search.getDefault();

Просмотреть файл

@ -3,21 +3,26 @@ requestLongerTimeout(2);
const ANY_URL = undefined;
const { SearchTestUtils } = ChromeUtils.import(
"resource://testing-common/SearchTestUtils.jsm"
);
SearchTestUtils.init(this);
registerCleanupFunction(async function cleanup() {
while (gBrowser.tabs.length > 1) {
BrowserTestUtils.removeTab(gBrowser.tabs[gBrowser.tabs.length - 1]);
}
await Services.search.setDefault(originalEngine);
let engine = Services.search.getEngineByName("MozSearch");
await Services.search.removeEngine(engine);
});
let originalEngine;
add_task(async function test_setup() {
// Stop search-engine loads from hitting the network
await Services.search.addEngineWithDetails("MozSearch", {
method: "GET",
template: "http://example.com/?q={searchTerms}",
await SearchTestUtils.installSearchExtension({
name: "MozSearch",
search_url: "https://example.com/",
search_url_get_params: "q={searchTerms}",
});
let engine = Services.search.getEngineByName("MozSearch");
originalEngine = await Services.search.getDefault();

Просмотреть файл

@ -3,6 +3,12 @@
"use strict";
const { SearchTestUtils } = ChromeUtils.import(
"resource://testing-common/SearchTestUtils.jsm"
);
SearchTestUtils.init(this);
const kButton = document.getElementById("reload-button");
add_task(async function setup() {
@ -10,21 +16,19 @@ add_task(async function setup() {
set: [["browser.fixup.dns_first_for_single_words", true]],
});
await Services.search.init();
// Create an engine to use for the test.
await Services.search.addEngineWithDetails("MozSearch1", {
method: "GET",
template: "https://example.com/?q={searchTerms}",
await SearchTestUtils.installSearchExtension({
name: "MozSearch",
search_url: "https://example.com/",
search_url_get_params: "q={searchTerms}",
});
let originalEngine = await Services.search.getDefault();
let engineDefault = Services.search.getEngineByName("MozSearch1");
let engineDefault = Services.search.getEngineByName("MozSearch");
await Services.search.setDefault(engineDefault);
registerCleanupFunction(async function() {
await Services.search.setDefault(originalEngine);
await Services.search.removeEngine(engineDefault);
});
});

Просмотреть файл

@ -1,17 +1,18 @@
let engineName = "engine1";
const { SearchTestUtils } = ChromeUtils.import(
"resource://testing-common/SearchTestUtils.jsm"
);
SearchTestUtils.init(this);
function getCellText(tree, i, cellName) {
return tree.view.getCellText(i, tree.columns.getNamedColumn(cellName));
}
add_task(async function setup() {
const engine = await Services.search.addEngineWithDetails(engineName, {
alias: ["testing", "customkeyword"],
method: "get",
template: "http://example.com/engine1?search={searchTerms}",
});
registerCleanupFunction(async function() {
await Services.search.removeEngine(engine);
await SearchTestUtils.installSearchExtension({
keyword: ["testing", "customkeyword"],
search_url: "https://example.com/engine1",
search_url_get_params: "search={searchTerms}",
});
});

Просмотреть файл

@ -34,6 +34,7 @@ add_task(async function test_change_engine() {
let doc = gBrowser.selectedBrowser.contentDocument;
let extension1 = await SearchTestUtils.installSearchExtension({
id: "example@tests.mozilla.org",
name: "Example",
version: "1.0",
keyword: "foo",
@ -63,6 +64,7 @@ add_task(async function test_change_engine() {
SearchUtils.TOPIC_ENGINE_MODIFIED
);
let extension2 = await SearchTestUtils.installSearchExtension({
id: "example@tests.mozilla.org",
name: "Example 2",
version: "2.0",
keyword: "bar",
@ -87,7 +89,5 @@ add_task(async function test_change_engine() {
"Should show the correct keyword"
);
await extension1.unload();
await extension2.unload();
gBrowser.removeCurrentTab();
});

Просмотреть файл

@ -5,15 +5,18 @@ const { SearchTestUtils } = ChromeUtils.import(
"resource://testing-common/SearchTestUtils.jsm"
);
add_task(async function setup() {
const engine1 = await Services.search.addEngineWithDetails("engine1", {
method: "get",
template: "http://example.com/engine1?search={searchTerms}",
});
SearchTestUtils.init(this);
const engine2 = await Services.search.addEngineWithDetails("engine2", {
method: "get",
template: "http://example.com/engine2?search={searchTerms}",
add_task(async function setup() {
await SearchTestUtils.installSearchExtension({
name: "engine1",
search_url: "https://example.com/engine1",
search_url_get_params: "search={searchTerms}",
});
await SearchTestUtils.installSearchExtension({
name: "engine2",
search_url: "https://example.com/engine2",
search_url_get_params: "search={searchTerms}",
});
const originalDefault = await Services.search.getDefault();
@ -22,9 +25,6 @@ add_task(async function setup() {
registerCleanupFunction(async () => {
await Services.search.setDefault(originalDefault);
await Services.search.setDefaultPrivate(originalDefaultPrivate);
await Services.search.removeEngine(engine1);
await Services.search.removeEngine(engine2);
});
});

Просмотреть файл

@ -262,14 +262,12 @@ add_task(async function setup() {
let currentEngines = await Services.search.getVisibleEngines();
extension1 = await SearchTestUtils.installSearchExtension({
id: TEST_ENGINE1_NAME,
name: TEST_ENGINE1_NAME,
suggest_url:
"https://example.com/browser/browser/components/search/test/browser/searchSuggestionEngine.sjs",
suggest_url_get_params: "query={searchTerms}",
});
extension2 = await SearchTestUtils.installSearchExtension({
id: TEST_ENGINE2_NAME,
name: TEST_ENGINE2_NAME,
suggest_url:
"https://example.com/browser/browser/components/search/test/browser/searchSuggestionEngine.sjs",
@ -1022,8 +1020,6 @@ add_task(async function cleanup() {
await Services.search.setDefault(
Services.search.getEngineByName(currentEngineName)
);
await extension1.unload();
await extension2.unload();
});
function checkState(

Просмотреть файл

@ -108,9 +108,3 @@ add_task(async function test_content_search_icon_in_private_window() {
await BrowserTestUtils.closeWindow(win);
});
add_task(async function cleanup() {
// Extensions must be unloaded before registerCleanupFunction runs, so
// unload them here.
await extension.unload();
});

Просмотреть файл

@ -14,23 +14,23 @@ const ENGINE_NAME = "mozSearch";
const ENGINE_URL =
"https://example.com/browser/browser/components/search/test/browser/mozsearch.sjs";
let engine;
let extension;
let oldDefaultEngine;
add_task(async function setup() {
await Services.search.init();
extension = await SearchTestUtils.installSearchExtension({
await SearchTestUtils.installSearchExtension({
name: ENGINE_NAME,
search_url: ENGINE_URL,
search_url_get_params: "test={searchTerms}",
});
engine = await Services.search.getEngineByName(ENGINE_NAME);
let engine = await Services.search.getEngineByName(ENGINE_NAME);
ok(engine, "Got a search engine");
oldDefaultEngine = await Services.search.getDefault();
let oldDefaultEngine = await Services.search.getDefault();
await Services.search.setDefault(engine);
registerCleanupFunction(async () => {
await Services.search.setDefault(oldDefaultEngine);
});
});
async function openNewSearchTab(event_args, expect_new_window = false) {
@ -174,12 +174,3 @@ add_task(async function test_whereToOpenLink() {
// cleanup
BrowserTestUtils.removeTab(tab);
});
// We can't do the unload within registerCleanupFunction as that's too late for
// the test to be happy. Do it into a cleanup "test" here instead.
add_task(async function cleanup() {
await Services.search.setDefault(oldDefaultEngine);
await Services.search.removeEngine(engine);
await extension.unload();
});

Просмотреть файл

@ -6,17 +6,13 @@
add_task(async function setup() {
await gCUITestUtils.addSearchBar();
const engine = await Services.search.addEngineWithDetails("dummy", {
method: "GET",
template: "https://example.com/?q={searchTerms}",
});
await SearchTestUtils.installSearchExtension();
const defaultEngine = Services.search.defaultEngine;
Services.search.defaultEngine = engine;
Services.search.defaultEngine = Services.search.getEngineByName("Example");
registerCleanupFunction(async function() {
Services.search.defaultEngine = defaultEngine;
await Services.search.removeEngine(engine);
gCUITestUtils.removeSearchBar();
});
});

Просмотреть файл

@ -12,16 +12,13 @@ add_task(async function setup() {
// Create two new search engines. Mark one as the default engine, so
// the test don't crash. We need to engines for this test as the searchbar
// in content doesn't display the default search engine among the one-off engines.
await Services.search.addEngineWithDetails("MozSearch", {
alias: "mozalias",
method: "GET",
template: "http://example.com/?q={searchTerms}",
await SearchTestUtils.installSearchExtension({
name: "MozSearch",
keyword: "mozalias",
});
await Services.search.addEngineWithDetails("MozSearch2", {
alias: "mozalias2",
method: "GET",
template: "http://example.com/?q={searchTerms}",
await SearchTestUtils.installSearchExtension({
name: "MozSearch2",
keyword: "mozalias2",
});
// Make the first engine the default search engine.
@ -43,8 +40,6 @@ add_task(async function setup() {
// Make sure to restore the engine once we're done.
registerCleanupFunction(async function() {
await Services.search.setDefault(originalEngine);
await Services.search.removeEngine(engineDefault);
await Services.search.removeEngine(engineOneOff);
await PlacesUtils.history.clear();
Services.telemetry.setEventRecordingEnabled("navigation", false);
Services.telemetry.canRecordExtended = oldCanRecord;
@ -75,7 +70,7 @@ add_task(async function test_abouthome_activitystream_simpleQuery() {
info("Trigger a simple search, just test + enter.");
let p = BrowserTestUtils.browserStopped(
tab.linkedBrowser,
"http://example.com/?q=test+query"
"https://example.com/?q=test+query"
);
await typeInSearchField(
tab.linkedBrowser,

Просмотреть файл

@ -8,16 +8,13 @@ add_task(async function setup() {
// Create two new search engines. Mark one as the default engine, so
// the test don't crash. We need to engines for this test as the searchbar
// in content doesn't display the default search engine among the one-off engines.
await Services.search.addEngineWithDetails("MozSearch", {
alias: "mozalias",
method: "GET",
template: "http://example.com/?q={searchTerms}",
await SearchTestUtils.installSearchExtension({
name: "MozSearch",
keyword: "mozalias",
});
await Services.search.addEngineWithDetails("MozSearch2", {
alias: "mozalias2",
method: "GET",
template: "http://example.com/?q={searchTerms}",
await SearchTestUtils.installSearchExtension({
name: "MozSearch2",
keyword: "mozalias2",
});
// Make the first engine the default search engine.
@ -45,8 +42,6 @@ add_task(async function setup() {
// Make sure to restore the engine once we're done.
registerCleanupFunction(async function() {
await Services.search.setDefault(originalEngine);
await Services.search.removeEngine(engineDefault);
await Services.search.removeEngine(engineOneOff);
await PlacesUtils.history.clear();
Services.telemetry.setEventRecordingEnabled("navigation", false);
Services.telemetry.canRecordExtended = oldCanRecord;

Просмотреть файл

@ -79,16 +79,13 @@ add_task(async function setup() {
// Create two new search engines. Mark one as the default engine, so
// the test don't crash. We need to engines for this test as the searchbar
// doesn't display the default search engine among the one-off engines.
await Services.search.addEngineWithDetails("MozSearch", {
alias: "mozalias",
method: "GET",
template: "http://example.com/?q={searchTerms}",
await SearchTestUtils.installSearchExtension({
name: "MozSearch",
keyword: "mozalias",
});
await Services.search.addEngineWithDetails("MozSearch2", {
alias: "mozalias2",
method: "GET",
template: "http://example.com/?q={searchTerms}",
await SearchTestUtils.installSearchExtension({
name: "MozSearch2",
keyword: "mozalias2",
});
// Make the first engine the default search engine.
@ -111,8 +108,6 @@ add_task(async function setup() {
registerCleanupFunction(async function() {
Services.telemetry.canRecordExtended = oldCanRecord;
await Services.search.setDefault(originalEngine);
await Services.search.removeEngine(engineDefault);
await Services.search.removeEngine(engineOneOff);
Services.telemetry.setEventRecordingEnabled("navigation", false);
});
});

Просмотреть файл

@ -65,9 +65,6 @@ async function waitForIdle() {
}
}
let extension;
let currentEngineName;
SearchTestUtils.init(this);
UrlbarTestUtils.init(this);
@ -82,9 +79,9 @@ add_task(async function setup() {
Services.telemetry.canRecordExtended = true;
Services.prefs.setBoolPref("browser.search.log", true);
currentEngineName = (await Services.search.getDefault()).name;
let currentEngineName = (await Services.search.getDefault()).name;
extension = await SearchTestUtils.installSearchExtension({
await SearchTestUtils.installSearchExtension({
search_url: getPageUrl(true),
search_url_get_params: "s={searchTerms}&abc=ff",
suggest_url:
@ -103,6 +100,9 @@ add_task(async function setup() {
SearchSERPTelemetry.overrideSearchTelemetryForTests();
Services.telemetry.canRecordExtended = oldCanRecord;
Services.telemetry.clearScalars();
await Services.search.setDefault(
Services.search.getEngineByName(currentEngineName)
);
});
});
@ -326,11 +326,3 @@ add_task(async function test_source_webextension() {
}
);
});
add_task(async function cleanup() {
await Services.search.setDefault(
Services.search.getEngineByName(currentEngineName)
);
// Extension must be unloaded before registerCleanupFunction is called.
await extension.unload();
});

Просмотреть файл

@ -65,9 +65,6 @@ async function waitForIdle() {
}
}
let extension;
let currentEngineName;
SearchTestUtils.init(this);
UrlbarTestUtils.init(this);
@ -87,9 +84,9 @@ add_task(async function setup() {
Services.telemetry.canRecordExtended = true;
Services.prefs.setBoolPref("browser.search.log", true);
currentEngineName = (await Services.search.getDefault()).name;
let currentEngineName = (await Services.search.getDefault()).name;
extension = await SearchTestUtils.installSearchExtension({
await SearchTestUtils.installSearchExtension({
search_url: getPageUrl(true),
search_url_get_params: "s={searchTerms}&abc=ff",
suggest_url:
@ -108,6 +105,9 @@ add_task(async function setup() {
SearchSERPTelemetry.overrideSearchTelemetryForTests();
Services.telemetry.canRecordExtended = oldCanRecord;
Services.telemetry.clearScalars();
await Services.search.setDefault(
Services.search.getEngineByName(currentEngineName)
);
});
});
@ -228,11 +228,3 @@ add_task(async function test_go_back() {
}
);
});
add_task(async function cleanup() {
await Services.search.setDefault(
Services.search.getEngineByName(currentEngineName)
);
// Extension must be unloaded before registerCleanupFunction is called.
await extension.unload();
});

Просмотреть файл

@ -14,20 +14,7 @@ add_task(async function setup() {
win = await BrowserTestUtils.openNewBrowserWindow();
// Create an engine to use for the test.
await Services.search.addEngineWithDetails("MozSearch1", {
alias: "mozalias",
method: "GET",
template: "https://example.com/?q={searchTerms}",
});
let originalEngine = await Services.search.getDefault();
let engineDefault = Services.search.getEngineByName("MozSearch1");
await Services.search.setDefault(engineDefault);
registerCleanupFunction(async function() {
await Services.search.setDefault(originalEngine);
await Services.search.removeEngine(engineDefault);
await BrowserTestUtils.closeWindow(win);
gCUITestUtils.removeSearchBar();
});

Просмотреть файл

@ -42,16 +42,14 @@ add_task(async function setup() {
// Create two new search engines. Mark one as the default engine, so
// the test don't crash. We need to engines for this test as the searchbar
// doesn't display the default search engine among the one-off engines.
await Services.search.addEngineWithDetails("MozSearch1", {
alias: "mozalias",
method: "GET",
template: templateNormal + "{searchTerms}",
await SearchTestUtils.installSearchExtension({
name: "MozSearch1",
keyword: "mozalias",
});
await Services.search.addEngineWithDetails("MozSearch2", {
alias: "mozalias2",
method: "GET",
template: templatePrivate + "{searchTerms}",
await SearchTestUtils.installSearchExtension({
name: "MozSearch2",
keyword: "mozalias2",
search_url_get_params: "query={searchTerms}",
});
await SpecialPowers.pushPrefEnv({
@ -67,14 +65,10 @@ add_task(async function setup() {
let engineDefault = Services.search.getEngineByName("MozSearch1");
await Services.search.setDefault(engineDefault);
let engineOneOff = Services.search.getEngineByName("MozSearch2");
registerCleanupFunction(async function() {
gCUITestUtils.removeSearchBar();
await Services.search.setDefault(originalEngine);
await Services.search.setDefaultPrivate(originalPrivateEngine);
await Services.search.removeEngine(engineDefault);
await Services.search.removeEngine(engineOneOff);
});
});

Просмотреть файл

@ -8,17 +8,13 @@
add_task(async function setup() {
await gCUITestUtils.addSearchBar();
const engine = await Services.search.addEngineWithDetails("dummy", {
method: "GET",
template: "https://example.com/?q={searchTerms}",
});
await SearchTestUtils.installSearchExtension();
const defaultEngine = Services.search.defaultEngine;
Services.search.defaultEngine = engine;
Services.search.defaultEngine = Services.search.getEngineByName("Example");
registerCleanupFunction(async function() {
Services.search.defaultEngine = defaultEngine;
await Services.search.removeEngine(engine);
gCUITestUtils.removeSearchBar();
});
});

Просмотреть файл

@ -542,19 +542,18 @@ add_task(async function pasteAndGo_url() {
add_task(async function pasteAndGo_nonURL() {
// Add a mock engine so we don't hit the network loading the SERP.
let engine = await Services.search.addEngineWithDetails("Test", {
template: "http://example.com/?search={searchTerms}",
});
await SearchTestUtils.installSearchExtension();
let engine = Services.search.getEngineByName("Example");
let oldDefaultEngine = await Services.search.getDefault();
Services.search.setDefault(engine);
await doPasteAndGoTest(
"pasteAndGo_nonURL",
"http://example.com/?search=pasteAndGo_nonURL"
"https://example.com/?q=pasteAndGo_nonURL"
);
Services.search.setDefault(oldDefaultEngine);
await Services.search.removeEngine(engine);
});
async function doPasteAndGoTest(searchString, expectedURL) {

Просмотреть файл

@ -14,24 +14,19 @@ add_task(async function setup() {
],
});
const engine = await Services.search.addEngineWithDetails("MozSearch", {
method: "GET",
template: "http://example.com/?q={searchTerms}",
await SearchTestUtils.installSearchExtension({ name: "MozSearch" });
await SearchTestUtils.installSearchExtension({
name: "MozSearchPrivate",
search_url: "https://example.com/private",
});
const engine2 = await Services.search.addEngineWithDetails(
"MozSearchPrivate",
{
method: "GET",
template: "http://example.com/private?q={searchTerms}",
}
);
let originalEngine = await Services.search.getDefault();
await Services.search.setDefault(engine);
await Services.search.setDefault(
Services.search.getEngineByName("MozSearch")
);
registerCleanupFunction(async function() {
await Services.search.setDefault(originalEngine);
await Services.search.removeEngine(engine);
await Services.search.removeEngine(engine2);
await PlacesUtils.history.clear();
await UrlbarTestUtils.formHistory.clear();
});
@ -94,7 +89,7 @@ add_task(async function test_search_normal_window() {
}
});
await testSearch(window, "MozSearch", "http://example.com/");
await testSearch(window, "MozSearch", "https://example.com/");
});
add_task(async function test_search_private_window_no_separate_default() {
@ -104,7 +99,7 @@ add_task(async function test_search_private_window_no_separate_default() {
await BrowserTestUtils.closeWindow(win);
});
await testSearch(win, "MozSearch", "http://example.com/");
await testSearch(win, "MozSearch", "https://example.com/");
});
add_task(async function test_search_private_window() {
@ -123,5 +118,5 @@ add_task(async function test_search_private_window() {
const win = await BrowserTestUtils.openNewBrowserWindow({ private: true });
await testSearch(win, "MozSearchPrivate", "http://example.com/private");
await testSearch(win, "MozSearchPrivate", "https://example.com/private");
});

Просмотреть файл

@ -7,21 +7,8 @@
*/
add_task(async function() {
const ICON_URI =
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAA" +
"CQkWg2AAABGklEQVQoz2NgGB6AnZ1dUlJSXl4eSDIyMhLW4Ovr%2B%2Fr168uXL69Zs4YoG%2BL" +
"i4i5dusTExMTGxsbNzd3f37937976%2BnpmZmagbHR09J49e5YvX66kpATVEBYW9ubNm2nTphkb" +
"G7e2tp44cQLIuHfvXm5urpaWFlDKysqqu7v73LlzECMYIiIiHj58mJCQoKKicvXq1bS0NKBgW1v" +
"bjh074uPjgeqAXE1NzSdPnvDz84M0AEUvXLgAsW379u1z5swBen3jxo2zZ892cHB4%2BvQp0KlA" +
"fwI1cHJyghQFBwfv2rULokFXV%2FfixYu7d%2B8GGqGgoMDKyrpu3br9%2B%2FcDuXl5eVA%2FA" +
"EWBfoWHAdAYoNuAYQ0XAeoUERFhGDYAAPoUaT2dfWJuAAAAAElFTkSuQmCC";
await Services.search.addEngineWithDetails("MozSearch", {
iconURL: ICON_URI,
alias: "moz",
method: "GET",
template: "http://example.com/?q={searchTerms}",
});
let engine = Services.search.getEngineByName("MozSearch");
await SearchTestUtils.installSearchExtension({ keyword: "moz" });
let engine = Services.search.getEngineByName("Example");
let originalEngine = await Services.search.getDefault();
await Services.search.setDefault(engine);
@ -37,7 +24,6 @@ add_task(async function() {
registerCleanupFunction(async function() {
await Services.search.setDefault(originalEngine);
await Services.search.removeEngine(engine);
try {
BrowserTestUtils.removeTab(tab);
} catch (ex) {
@ -71,7 +57,7 @@ add_task(async function() {
Assert.equal(
gBrowser.selectedBrowser.currentURI.spec,
"http://example.com/?q=open+a+search",
"https://example.com/?q=open+a+search",
"Should have loaded the correct page"
);
});

Просмотреть файл

@ -44,14 +44,7 @@ add_task(async function origin() {
add_task(async function tokenAlias() {
// We have built-in engine aliases that may conflict with the one we choose
// here in terms of autofill, so be careful and choose a weird alias.
await Services.search.addEngineWithDetails("Test", {
alias: "@__example",
template: "http://example.com/?search={searchTerms}",
});
registerCleanupFunction(async function() {
let engine = Services.search.getEngineByName("Test");
await Services.search.removeEngine(engine);
});
await SearchTestUtils.installSearchExtension({ keyword: "@__example" });
// Do an initial search that triggers autofill so that the placeholder has an
// initial value.
@ -177,18 +170,14 @@ add_task(async function noMatch2() {
add_task(async function clear_placeholder_for_keyword_or_alias() {
info("Clear the autofill placeholder if a keyword is typed");
await PlacesTestUtils.addVisits("http://example.com/");
await PlacesTestUtils.addVisits("https://example.com/");
await PlacesUtils.keywords.insert({
keyword: "ex",
url: "http://somekeyword.com/",
});
let engine = await Services.search.addEngineWithDetails("AutofillTest", {
alias: "exam",
template: "http://example.com/?search={searchTerms}",
url: "https://somekeyword.com/",
});
await SearchTestUtils.installSearchExtension({ keyword: "exam" });
registerCleanupFunction(async function() {
await PlacesUtils.keywords.remove("ex");
await Services.search.removeEngine(engine);
});
// Do an initial search that triggers autofill so that the placeholder has an

Просмотреть файл

@ -176,14 +176,7 @@ add_task(async function urlPort() {
});
add_task(async function tokenAlias() {
await Services.search.addEngineWithDetails("Test", {
alias: "@example",
template: "http://example.com/?search={searchTerms}",
});
registerCleanupFunction(async function() {
let engine = Services.search.getEngineByName("Test");
await Services.search.removeEngine(engine);
});
await SearchTestUtils.installSearchExtension({ keyword: "@example" });
await UrlbarTestUtils.promiseAutocompleteResultPopup({
window,
value: "@ExA",

Просмотреть файл

@ -99,14 +99,7 @@ add_task(async function url() {
add_task(async function tokenAlias() {
// We have built-in engine aliases that may conflict with the one we choose
// here in terms of autofill, so be careful and choose a weird alias.
await Services.search.addEngineWithDetails("Test", {
alias: "@__example",
template: "http://example.com/?search={searchTerms}",
});
registerCleanupFunction(async function() {
let engine = Services.search.getEngineByName("Test");
await Services.search.removeEngine(engine);
});
await SearchTestUtils.installSearchExtension({ keyword: "@__example" });
// all lowercase
await typeAndCheck([
["@", "@"],

Просмотреть файл

@ -100,11 +100,9 @@ add_task(
let suggestOpenPages = Preferences.get("browser.urlbar.suggest.openpage");
Preferences.set("browser.urlbar.suggest.openpage", false);
await Services.search.addEngineWithDetails("MozSearch", {
method: "GET",
template: "http://example.com/?q={searchTerms}",
});
let engine = Services.search.getEngineByName("MozSearch");
await SearchTestUtils.installSearchExtension();
let engine = Services.search.getEngineByName("Example");
let originalEngine = await Services.search.getDefault();
await Services.search.setDefault(engine);
@ -114,10 +112,6 @@ add_task(
Preferences.set("browser.urlbar.suggest.openpage", suggestOpenPages);
await Services.search.setDefault(originalEngine);
let mozSearchEngine = Services.search.getEngineByName("MozSearch");
if (mozSearchEngine) {
await Services.search.removeEngine(mozSearchEngine);
}
}
registerCleanupFunction(cleanup);
@ -130,7 +124,7 @@ add_task(
await BrowserTestUtils.browserLoaded(
gBrowser.selectedTab.linkedBrowser,
false,
"http://example.com/?q=ex"
"https://example.com/?q=ex"
);
await cleanup();
})

Просмотреть файл

@ -11,12 +11,9 @@ const TEST_URL = "data:text/html,a test page";
add_task(async function test_setup() {
// Stop search-engine loads from hitting the network.
await Services.search.addEngineWithDetails("MozSearch", {
method: "GET",
template: "http://example.com/?q={searchTerms}",
});
await SearchTestUtils.installSearchExtension();
let originalEngine = await Services.search.getDefault();
let engine = Services.search.getEngineByName("MozSearch");
let engine = Services.search.getEngineByName("Example");
await Services.search.setDefault(engine);
registerCleanupFunction(async function cleanup() {
@ -24,7 +21,6 @@ add_task(async function test_setup() {
BrowserTestUtils.removeTab(gBrowser.tabs[gBrowser.tabs.length - 1]);
}
await Services.search.setDefault(originalEngine);
await Services.search.removeEngine(engine);
});
});
@ -93,14 +89,14 @@ add_task(async function checkDragText() {
await BrowserTestUtils.withNewTab(TEST_URL, async browser => {
info("Check dragging multi word text to the urlbar");
const TEXT = "Firefox is awesome";
const TEXT_URL = "http://example.com/?q=Firefox+is+awesome";
const TEXT_URL = "https://example.com/?q=Firefox+is+awesome";
let promiseLoad = BrowserTestUtils.browserLoaded(browser, false, TEXT_URL);
simulateURLBarDrop({ type: "text/plain", data: TEXT });
await promiseLoad;
info("Check dragging single word text to the urlbar");
const WORD = "Firefox";
const WORD_URL = "http://example.com/?q=Firefox";
const WORD_URL = "https://example.com/?q=Firefox";
promiseLoad = BrowserTestUtils.browserLoaded(browser, false, WORD_URL);
simulateURLBarDrop({ type: "text/plain", data: WORD });
await promiseLoad;

Просмотреть файл

@ -28,29 +28,20 @@ add_task(async function() {
});
sandbox = sinon.createSandbox();
let engine = await Services.search.addEngineWithDetails("MozSearch", {
alias: "moz",
method: "GET",
template: "http://example.com/?q={searchTerms}",
});
let engine2 = await Services.search.addEngineWithDetails("MozSearch2", {
alias: "@moz",
method: "GET",
template: "http://example.com/?q={searchTerms}",
});
await SearchTestUtils.installSearchExtension();
await SearchTestUtils.installSearchExtension({ name: "Example2" });
let bm = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
url: "http://example.com/?q=%s",
url: "https://example.com/?q=%s",
title: "test",
});
await PlacesUtils.keywords.insert({
keyword: "keyword",
url: "http://example.com/?q=%s",
url: "https://example.com/?q=%s",
});
registerCleanupFunction(async () => {
sandbox.restore();
await Services.search.removeEngine(engine);
await Services.search.removeEngine(engine2);
await PlacesUtils.bookmarks.remove(bm);
await UrlbarTestUtils.formHistory.clear();
});

Просмотреть файл

@ -41,16 +41,17 @@ add_task(async function() {
url: "http://example.com/",
parentGuid: PlacesUtils.bookmarks.menuGuid,
});
let engine = await Services.search.addEngineWithDetails("Test", {
alias: "@test",
template: `http://example.com/?search={searchTerms}`,
await SearchTestUtils.installSearchExtension({
name: "Test",
keyword: "@test",
});
let originalEngine = await Services.search.getDefault();
await Services.search.setDefault(engine);
await Services.search.setDefault(Services.search.getEngineByName("Test"));
registerCleanupFunction(async () => {
await Services.search.setDefault(originalEngine);
await Services.search.removeEngine(engine);
await PlacesUtils.bookmarks.remove(bm);
await PlacesUtils.history.clear();
});

Просмотреть файл

@ -229,12 +229,11 @@ async function assertState(
add_task(async function init() {
let oldDefaultEngine = await Services.search.getDefault();
let engine = await Services.search.addEngineWithDetails(
TEST_DEFAULT_ENGINE_NAME,
{
template: `http://example.com/?search={searchTerms}`,
}
);
await SearchTestUtils.installSearchExtension({
name: TEST_DEFAULT_ENGINE_NAME,
keyword: "@test",
});
let engine = Services.search.getEngineByName(TEST_DEFAULT_ENGINE_NAME);
await Services.search.setDefault(engine);
await Services.search.moveEngine(engine, 0);
@ -249,7 +248,6 @@ add_task(async function init() {
registerCleanupFunction(async function() {
await Services.search.setDefault(oldDefaultEngine);
await Services.search.removeEngine(engine);
await PlacesUtils.history.clear();
await PlacesUtils.keywords.remove(KEYWORD);
});

Просмотреть файл

@ -125,18 +125,15 @@ add_task(async function init() {
});
// Add a mock engine so we don't hit the network loading the SERP.
let engine = await Services.search.addEngineWithDetails("Test", {
template: "http://example.com/?search={searchTerms}",
});
await SearchTestUtils.installSearchExtension();
let oldDefaultEngine = await Services.search.getDefault();
Services.search.setDefault(engine);
await Services.search.setDefault(Services.search.getEngineByName("Example"));
await UrlbarQuickSuggest.init();
await UrlbarQuickSuggest._processSuggestionsJSON(TEST_DATA);
registerCleanupFunction(async function() {
Services.search.setDefault(oldDefaultEngine);
await Services.search.removeEngine(engine);
await PlacesUtils.history.clear();
await UrlbarTestUtils.formHistory.clear();
});

Просмотреть файл

@ -5,6 +5,19 @@ XPCOMUtils.defineLazyModuleGetters(this, {
FormHistory: "resource://gre/modules/FormHistory.jsm",
});
add_task(async function setup() {
await SearchTestUtils.installSearchExtension();
let engine = Services.search.getEngineByName("Example");
let originalEngine = await Services.search.getDefault();
await Services.search.setDefault(engine);
await Services.search.moveEngine(engine, 0);
registerCleanupFunction(async function() {
await Services.search.setDefault(originalEngine);
});
});
add_task(async function test_remove_history() {
const TEST_URL = "http://remove.me/from_urlbar/";
await PlacesTestUtils.addVisits(TEST_URL);
@ -64,14 +77,6 @@ add_task(async function test_remove_form_history() {
],
});
await Services.search.addEngineWithDetails("test", {
method: "GET",
template: "http://example.com/?q={searchTerms}",
});
let engine = Services.search.getEngineByName("test");
let originalEngine = await Services.search.getDefault();
await Services.search.setDefault(engine);
let formHistoryValue = "foobar";
await UrlbarTestUtils.formHistory.add([formHistoryValue]);
@ -139,8 +144,6 @@ add_task(async function test_remove_form_history() {
);
await SpecialPowers.popPrefEnv();
await Services.search.setDefault(originalEngine);
await Services.search.removeEngine(engine);
});
// We shouldn't be able to remove a bookmark item.
@ -186,17 +189,8 @@ add_task(async function test_searchMode_removeRestyledHistory() {
],
});
let engine = await Services.search.addEngineWithDetails("test", {
method: "GET",
template: "http://example.com/",
searchGetParams: "q={searchTerms}",
});
let originalEngine = await Services.search.getDefault();
await Services.search.setDefault(engine);
await Services.search.moveEngine(engine, 0);
let query = "ciao";
let url = `http://example.com/?q=${query}bar`;
let url = `https://example.com/?q=${query}bar`;
await PlacesTestUtils.addVisits(url);
await BrowserTestUtils.withNewTab("about:robots", async function(browser) {
@ -228,6 +222,4 @@ add_task(async function test_searchMode_removeRestyledHistory() {
});
await PlacesUtils.history.clear();
await SpecialPowers.popPrefEnv();
await Services.search.setDefault(originalEngine);
await Services.search.removeEngine(engine);
});

Просмотреть файл

@ -13,12 +13,12 @@ add_task(async function init() {
// fired.
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser);
aliasEngine = await Services.search.addEngineWithDetails("Test", {
alias: ALIAS,
template: "http://example.com/?search={searchTerms}",
await SearchTestUtils.installSearchExtension({
keyword: ALIAS,
});
aliasEngine = Services.search.getEngineByName("Example");
registerCleanupFunction(async function() {
await Services.search.removeEngine(aliasEngine);
BrowserTestUtils.removeTab(tab);
gURLBar.handleRevert();
});

Просмотреть файл

@ -16,16 +16,14 @@ const { SearchSuggestionController } = ChromeUtils.import(
let gEngine;
add_task(async function setup() {
gEngine = await Services.search.addEngineWithDetails("TestLimit", {
template: "http://example.com/?search={searchTerms}",
});
await SearchTestUtils.installSearchExtension();
gEngine = Services.search.getEngineByName("Example");
let oldDefaultEngine = await Services.search.getDefault();
await Services.search.setDefault(gEngine);
await UrlbarTestUtils.formHistory.clear();
registerCleanupFunction(async function() {
await Services.search.setDefault(oldDefaultEngine);
await Services.search.removeEngine(gEngine);
await UrlbarTestUtils.formHistory.clear();
});
});

Просмотреть файл

@ -25,13 +25,12 @@ add_task(async function setup() {
defaultEngine.alias = "@default";
let oldDefaultEngine = await Services.search.getDefault();
Services.search.setDefault(defaultEngine);
aliasEngine = await Services.search.addEngineWithDetails("Test", {
alias: ALIAS,
template: "http://example.com/?search={searchTerms}",
await SearchTestUtils.installSearchExtension({
keyword: ALIAS,
});
aliasEngine = Services.search.getEngineByName("Example");
registerCleanupFunction(async function() {
await Services.search.removeEngine(aliasEngine);
Services.search.setDefault(oldDefaultEngine);
});
});

Просмотреть файл

@ -8,27 +8,20 @@
"use strict";
const DEFAULT_ENGINE_NAME = "Test";
add_task(async function setup() {
for (let i = 0; i < 5; i++) {
await PlacesTestUtils.addVisits([{ uri: "http://example.com/" }]);
}
let oldDefaultEngine = await Services.search.getDefault();
let defaultEngine = await Services.search.addEngineWithDetails(
DEFAULT_ENGINE_NAME,
{
template: "http://example.com/?search={searchTerms}",
}
);
await SearchTestUtils.installSearchExtension();
let defaultEngine = Services.search.getEngineByName("Example");
await Services.search.setDefault(defaultEngine);
await Services.search.moveEngine(defaultEngine, 0);
registerCleanupFunction(async () => {
await PlacesUtils.history.clear();
await Services.search.setDefault(oldDefaultEngine);
await Services.search.removeEngine(defaultEngine);
});
});

Просмотреть файл

@ -10,9 +10,8 @@
// Tests that we exit search mode in the active tab when the search mode engine
// is removed.
add_task(async function activeTab() {
let engine = await Services.search.addEngineWithDetails("Test", {
template: "http://example.com/?search={searchTerms}",
});
let extension = await SearchTestUtils.installSearchExtension({}, true);
let engine = Services.search.getEngineByName("Example");
await Services.search.moveEngine(engine, 0);
await UrlbarTestUtils.promiseAutocompleteResultPopup({
@ -25,7 +24,7 @@ add_task(async function activeTab() {
engineName: engine.name,
entry: "oneoff",
});
await Services.search.removeEngine(engine);
await extension.unload();
// Check that we are no longer in search mode.
await UrlbarTestUtils.assertSearchMode(window, null);
});
@ -33,9 +32,8 @@ add_task(async function activeTab() {
// Tests that we exit search mode in a background tab when the search mode
// engine is removed.
add_task(async function backgroundTab() {
let engine = await Services.search.addEngineWithDetails("Test", {
template: "http://example.com/?search={searchTerms}",
});
let extension = await SearchTestUtils.installSearchExtension({}, true);
let engine = Services.search.getEngineByName("Example");
await Services.search.moveEngine(engine, 0);
await UrlbarTestUtils.promiseAutocompleteResultPopup({
@ -58,7 +56,7 @@ add_task(async function backgroundTab() {
await BrowserTestUtils.switchTab(gBrowser, tab2);
// tab2 shouldn't be in search mode.
await UrlbarTestUtils.assertSearchMode(window, null);
await Services.search.removeEngine(engine);
await extension.unload();
// tab1 should have exited search mode.
await BrowserTestUtils.switchTab(gBrowser, tab1);
@ -69,9 +67,8 @@ add_task(async function backgroundTab() {
// Tests that we exit search mode in a background window when the search mode
// engine is removed.
add_task(async function backgroundWindow() {
let engine = await Services.search.addEngineWithDetails("Test", {
template: "http://example.com/?search={searchTerms}",
});
let extension = await SearchTestUtils.installSearchExtension({}, true);
let engine = Services.search.getEngineByName("Example");
await Services.search.moveEngine(engine, 0);
let win1 = window;
@ -94,7 +91,7 @@ add_task(async function backgroundWindow() {
win2.focus();
// win2 shouldn't be in search mode.
await UrlbarTestUtils.assertSearchMode(win2, null);
await Services.search.removeEngine(engine);
await extension.unload();
// win1 should not be in search mode.
win1.focus();

Просмотреть файл

@ -30,9 +30,10 @@ add_task(async function setup() {
// Note that the result domain is subdomain.example.ca. We still expect to
// match with example.com results because we ignore subdomains and the public
// suffix in this check.
let engine = await Services.search.addEngineWithDetails("Test", {
template: `http://subdomain.example.ca/?search={searchTerms}`,
await SearchTestUtils.installSearchExtension({
search_url: "https://subdomain.example.ca/",
});
let engine = Services.search.getEngineByName("Example");
await Services.search.setDefault(engine);
await Services.search.moveEngine(engine, 0);
@ -46,7 +47,7 @@ add_task(async function setup() {
{
type: "tab",
title: "Test Remote",
url: "http://example.com",
url: "https://example.com",
icon: UrlbarUtils.ICON.DEFAULT,
client: "7cqCr77ptzX3",
lastUsed: 1452124677,
@ -54,7 +55,7 @@ add_task(async function setup() {
{
type: "tab",
title: "Test Remote 2",
url: "http://example-2.com",
url: "https://example-2.com",
icon: UrlbarUtils.ICON.DEFAULT,
client: "7cqCr77ptzX3",
lastUsed: 1452124677,
@ -95,7 +96,6 @@ add_task(async function setup() {
weaveXPCService.ready = oldWeaveServiceReady;
SyncedTabs._internal = originalSyncedTabsInternal;
await Services.search.setDefault(oldDefaultEngine);
await Services.search.removeEngine(engine);
await PlacesUtils.history.clear();
});
});

Просмотреть файл

@ -13,13 +13,10 @@ add_task(async function setup() {
// Add a new mock default engine so we don't hit the network.
let oldDefaultEngine = await Services.search.getDefault();
let engine = await Services.search.addEngineWithDetails("Test", {
template: "http://example.com/?search={searchTerms}",
});
await Services.search.setDefault(engine);
await SearchTestUtils.installSearchExtension({ name: "Test" });
await Services.search.setDefault(Services.search.getEngineByName("Test"));
registerCleanupFunction(async () => {
await Services.search.setDefault(oldDefaultEngine);
await Services.search.removeEngine(engine);
});
// Add one bookmark we'll use below.
@ -219,7 +216,7 @@ add_task(async function remote() {
await loadPromise;
Assert.equal(
gBrowser.currentURI.spec,
"http://example.com/?search=remote",
"https://example.com/?q=remote",
"Engine's SERP should have loaded"
);
});

Просмотреть файл

@ -9,7 +9,6 @@
*/
const TEST_QUERY = "test string";
const DEFAULT_ENGINE_NAME = "Test";
const SUGGESTIONS_ENGINE_NAME = "searchSuggestionEngine.xml";
// These need to have different domains because otherwise new tab and/or
@ -29,18 +28,13 @@ add_task(async function setup() {
);
let oldDefaultEngine = await Services.search.getDefault();
defaultEngine = await Services.search.addEngineWithDetails(
DEFAULT_ENGINE_NAME,
{
template: "http://example.com/?search={searchTerms}",
}
);
await SearchTestUtils.installSearchExtension();
defaultEngine = Services.search.getEngineByName("Example");
await Services.search.setDefault(defaultEngine);
await Services.search.moveEngine(suggestionsEngine, 0);
registerCleanupFunction(async () => {
await Services.search.setDefault(oldDefaultEngine);
await Services.search.removeEngine(defaultEngine);
});
// Set our top sites.

Просмотреть файл

@ -7,22 +7,12 @@
* Tests one-off search button behavior with search mode.
*/
const TEST_ENGINE = {
name: "test engine",
details: {
alias: "@test",
template: "http://example.com/?search={searchTerms}",
},
};
const TEST_ENGINE_NAME = "test engine";
add_task(async function setup() {
const engine = await Services.search.addEngineWithDetails(
TEST_ENGINE.name,
TEST_ENGINE.details
);
registerCleanupFunction(async () => {
await Services.search.removeEngine(engine);
await SearchTestUtils.installSearchExtension({
name: TEST_ENGINE_NAME,
keyword: "@test",
});
});
@ -46,10 +36,10 @@ add_task(async function test() {
info("Enter search mode");
await UrlbarTestUtils.enterSearchMode(window, {
engineName: TEST_ENGINE.name,
engineName: TEST_ENGINE_NAME,
});
await UrlbarTestUtils.assertSearchMode(window, {
engineName: TEST_ENGINE.name,
engineName: TEST_ENGINE_NAME,
entry: "oneoff",
});
ok(!oneOffs.selectedButton, "There is no selected one-off button");

Просмотреть файл

@ -8,19 +8,14 @@
"use strict";
const TEST_ENGINE_NAME = "Test";
const TEST_ENGINE_DOMAIN = "example.com";
add_task(async function setup() {
let testEngine = await Services.search.addEngineWithDetails(
TEST_ENGINE_NAME,
{
alias: "@test",
template: `http://${TEST_ENGINE_DOMAIN}/?search={searchTerms}`,
}
);
await SearchTestUtils.installSearchExtension({
name: TEST_ENGINE_NAME,
keyword: "@test",
});
registerCleanupFunction(async () => {
await Services.search.removeEngine(testEngine);
await PlacesUtils.history.clear();
});
});
@ -244,13 +239,13 @@ add_task(async function oneOff_alt_downArrow() {
// Add some visits to a URL so we have multiple Top Sites.
await PlacesUtils.history.clear();
for (let i = 0; i < 5; i++) {
await PlacesTestUtils.addVisits("http://example.com/");
await PlacesTestUtils.addVisits("https://example.com/");
}
await updateTopSites(
sites =>
sites &&
sites[0]?.searchTopSite &&
sites[1]?.url == "http://example.com/",
sites[1]?.url == "https://example.com/",
true
);
@ -419,9 +414,9 @@ add_task(async function fullSearchMode_oneOff_restore_on_down() {
info("Add a few visits to top sites");
for (let i = 0; i < 5; i++) {
await PlacesTestUtils.addVisits([
"http://1.example.com/",
"http://2.example.com/",
"http://3.example.com/",
"https://1.example.com/",
"https://2.example.com/",
"https://3.example.com/",
]);
}
await updateTopSites(sites => sites?.length > 2, false);

Просмотреть файл

@ -13,7 +13,6 @@ const MANY_SUGGESTIONS_ENGINE_NAME = "searchSuggestionEngineMany.xml";
const MAX_RESULT_COUNT = UrlbarPrefs.get("maxRichResults");
let suggestionsEngine;
let defaultEngine;
let expectedFormHistoryResults = [];
add_task(async function setup() {
@ -22,13 +21,13 @@ add_task(async function setup() {
);
let oldDefaultEngine = await Services.search.getDefault();
defaultEngine = await Services.search.addEngineWithDetails(
DEFAULT_ENGINE_NAME,
{
template: "http://example.com/?search={searchTerms}",
}
await SearchTestUtils.installSearchExtension({
name: DEFAULT_ENGINE_NAME,
keyword: "@test",
});
await Services.search.setDefault(
Services.search.getEngineByName(DEFAULT_ENGINE_NAME)
);
await Services.search.setDefault(defaultEngine);
await Services.search.moveEngine(suggestionsEngine, 0);
async function cleanup() {
@ -63,7 +62,6 @@ add_task(async function setup() {
registerCleanupFunction(async () => {
await Services.search.setDefault(oldDefaultEngine);
await Services.search.removeEngine(defaultEngine);
await UrlbarTestUtils.formHistory.clear();
});
@ -230,7 +228,7 @@ add_task(async function emptySearch_behavior() {
source: UrlbarUtils.RESULT_SOURCE.SEARCH,
searchParams: {
query: " ",
engine: defaultEngine.name,
engine: DEFAULT_ENGINE_NAME,
},
},
{

Просмотреть файл

@ -192,9 +192,13 @@ add_task(async function slow_load() {
set: [["browser.urlbar.suggest.searches", false]],
});
const engineName = "Test";
let engine = await Services.search.addEngineWithDetails(engineName, {
template: "http://example.com/?search={searchTerms}",
});
let extension = await SearchTestUtils.installSearchExtension(
{
name: engineName,
},
true
);
const originalTab = gBrowser.selectedTab;
const newTab = await BrowserTestUtils.openNewForegroundTab(gBrowser);
@ -218,17 +222,21 @@ add_task(async function slow_load() {
await UrlbarTestUtils.assertSearchMode(window, null);
BrowserTestUtils.removeTab(newTab);
await Services.search.removeEngine(engine);
await SpecialPowers.popPrefEnv();
await extension.unload();
});
// Tests the same behaviour as slow_load, but in a more reliable way using
// non-real-world behaviour.
add_task(async function slow_load_guaranteed() {
const engineName = "Test";
let engine = await Services.search.addEngineWithDetails(engineName, {
template: "http://example.com/?search={searchTerms}",
});
let extension = await SearchTestUtils.installSearchExtension(
{
name: engineName,
},
true
);
const backgroundTab = BrowserTestUtils.addTab(gBrowser);
// Simulate a tab that was in search mode, loaded a SERP, then was switched
@ -246,7 +254,7 @@ add_task(async function slow_load_guaranteed() {
await UrlbarTestUtils.assertSearchMode(window, null);
BrowserTestUtils.removeTab(backgroundTab);
await Services.search.removeEngine(engine);
await extension.unload();
});
// Enters search mode by typing a restriction char with no search string.

Просмотреть файл

@ -13,8 +13,6 @@ const serverInfo = {
port: 20709, // Must be identical to what is in searchSuggestionEngine2.xml
};
let aliasEngine;
add_task(async function setup() {
await SpecialPowers.pushPrefEnv({
set: [
@ -49,16 +47,14 @@ add_task(async function setup() {
await Services.search.moveEngine(engine2, 0);
// Add an engine with an alias.
aliasEngine = await Services.search.addEngineWithDetails("MozSearch", {
alias: "alias",
method: "GET",
template: "http://example.com/?q={searchTerms}",
await SearchTestUtils.installSearchExtension({
name: "MozSearch",
keyword: "alias",
});
registerCleanupFunction(async () => {
await Services.search.setDefault(oldDefaultEngine);
await Services.search.setDefaultPrivate(oldDefaultPrivateEngine);
await Services.search.removeEngine(aliasEngine);
await PlacesUtils.history.clear();
});
});

Просмотреть файл

@ -51,16 +51,15 @@ add_task(async function setup() {
await Services.search.moveEngine(engine2, 0);
// Add an engine with an alias.
gAliasEngine = await Services.search.addEngineWithDetails("MozSearch", {
alias: "alias",
method: "GET",
template: "http://example.com/?q={searchTerms}",
await SearchTestUtils.installSearchExtension({
name: "MozSearch",
keyword: "alias",
});
gAliasEngine = Services.search.getEngineByName("MozSearch");
registerCleanupFunction(async () => {
await Services.search.setDefault(oldDefaultEngine);
await Services.search.setDefaultPrivate(oldDefaultPrivateEngine);
await Services.search.removeEngine(gAliasEngine);
await PlacesUtils.history.clear();
});
});

Просмотреть файл

@ -178,18 +178,16 @@ add_task(async function tabSearchModePreview() {
add_task(async function tabTabToSearch() {
info("Tab past a tab-to-search result after focusing with the keyboard.");
let engineDomain = "example.com";
let testEngine = await Services.search.addEngineWithDetails("Test", {
template: `http://${engineDomain}/?search={searchTerms}`,
});
await SearchTestUtils.installSearchExtension();
for (let i = 0; i < 3; i++) {
await PlacesTestUtils.addVisits([`https://${engineDomain}/`]);
await PlacesTestUtils.addVisits(["https://example.com/"]);
}
// Search for a tab-to-search result.
await UrlbarTestUtils.promiseAutocompleteResultPopup({
window,
value: engineDomain.slice(0, 4),
value: "exam",
});
await UrlbarTestUtils.promisePopupClose(window);
await UrlbarTestUtils.promisePopupOpen(window, () => {
@ -212,7 +210,6 @@ add_task(async function tabTabToSearch() {
await UrlbarTestUtils.assertSearchMode(window, null);
});
await PlacesUtils.history.clear();
await Services.search.removeEngine(testEngine);
});
add_task(async function tabNoSearchStringSearchMode() {

Просмотреть файл

@ -27,20 +27,18 @@ add_task(async function setup() {
["browser.urlbar.tabToSearch.onboard.interactionsLeft", 0],
],
});
let testEngine = await Services.search.addEngineWithDetails(
TEST_ENGINE_NAME,
{
alias: "@test",
template: `http://${TEST_ENGINE_DOMAIN}/?search={searchTerms}`,
}
);
await SearchTestUtils.installSearchExtension({
name: TEST_ENGINE_NAME,
search_url: `https://${TEST_ENGINE_DOMAIN}/`,
});
for (let i = 0; i < 3; i++) {
await PlacesTestUtils.addVisits([`https://${TEST_ENGINE_DOMAIN}/`]);
}
registerCleanupFunction(async () => {
await PlacesUtils.history.clear();
await Services.search.removeEngine(testEngine);
});
});
@ -599,11 +597,12 @@ add_task(async function onboard_multipleEnginesForHostname() {
set: [["browser.urlbar.tabToSearch.onboard.interactionsLeft", 3]],
});
let testEngineMaps = await Services.search.addEngineWithDetails(
`${TEST_ENGINE_NAME}Maps`,
let extension = await SearchTestUtils.installSearchExtension(
{
template: `http://${TEST_ENGINE_DOMAIN}/maps/?search={searchTerms}`,
}
name: `${TEST_ENGINE_NAME}Maps`,
search_url: `https://${TEST_ENGINE_DOMAIN}/maps/`,
},
true
);
await UrlbarTestUtils.promiseAutocompleteResultPopup({
@ -639,7 +638,7 @@ add_task(async function onboard_multipleEnginesForHostname() {
"The tab-to-search result is the only onboarding result."
);
await UrlbarTestUtils.promisePopupClose(window, () => gURLBar.blur());
await Services.search.removeEngine(testEngineMaps);
await extension.unload();
UrlbarPrefs.set("tabToSearch.onboard.interactionsLeft", 3);
delete UrlbarProviderTabToSearch.onboardingInteractionAtTime;
await SpecialPowers.popPrefEnv();
@ -653,9 +652,14 @@ add_task(async function extended_unicode_in_engine() {
// general-web engine string because Baidu is included in WEB_ENGINE_NAMES.
let engineName = "百度";
let engineDomain = "example-2.com";
let testEngine = await Services.search.addEngineWithDetails(engineName, {
template: `http://${engineDomain}/?search={searchTerms}`,
});
let extension = await SearchTestUtils.installSearchExtension(
{
id: "testunicode",
name: engineName,
search_url: `https://${engineDomain}/`,
},
true
);
for (let i = 0; i < 3; i++) {
await PlacesTestUtils.addVisits([`https://${engineDomain}/`]);
}
@ -688,5 +692,5 @@ add_task(async function extended_unicode_in_engine() {
await UrlbarTestUtils.promisePopupClose(window, () => gURLBar.blur());
await PlacesUtils.history.clear();
await Services.search.removeEngine(testEngine);
await extension.unload();
});

Просмотреть файл

@ -11,11 +11,9 @@ add_task(async function() {
await SpecialPowers.pushPrefEnv({
set: [["browser.urlbar.suggest.searches", true]],
});
let engine = await Services.search.addEngineWithDetails("Test", {
template: "http://example.com/?search={searchTerms}",
});
await SearchTestUtils.installSearchExtension({ name: "Test" });
let oldDefaultEngine = await Services.search.getDefault();
await Services.search.setDefault(engine);
await Services.search.setDefault(Services.search.getEngineByName("Test"));
let lotsOfSpaces = "%20".repeat(300);
await PlacesTestUtils.addVisits({
@ -30,7 +28,6 @@ add_task(async function() {
await PlacesUtils.history.clear();
await UrlbarTestUtils.formHistory.clear();
await Services.search.setDefault(oldDefaultEngine);
await Services.search.removeEngine(engine);
});
await UrlbarTestUtils.promiseAutocompleteResultPopup({

Просмотреть файл

@ -5,6 +5,7 @@
"use strict";
const TEST_ALIAS_ENGINE_NAME = "Test";
const ALIAS = "@test";
const TEST_ENGINE_BASENAME = "searchSuggestionEngine.xml";
@ -14,8 +15,6 @@ const TEST_ENGINE_BASENAME = "searchSuggestionEngine.xml";
// speakers.
const TEST_SPACES = [" ", "\u3000", " \u3000", "\u3000 "];
let testEngine;
// Allow more time for Mac machines so they don't time out in verify mode. See
// bug 1673062.
if (AppConstants.platform == "macosx") {
@ -31,12 +30,12 @@ add_task(async function init() {
defaultEngine.alias = "@default";
let oldDefaultEngine = await Services.search.getDefault();
Services.search.setDefault(defaultEngine);
testEngine = await Services.search.addEngineWithDetails("Test", {
alias: ALIAS,
template: "http://example.com/?search={searchTerms}",
await SearchTestUtils.installSearchExtension({
name: TEST_ALIAS_ENGINE_NAME,
keyword: ALIAS,
});
registerCleanupFunction(async function() {
await Services.search.removeEngine(testEngine);
Services.search.setDefault(oldDefaultEngine);
});
@ -107,7 +106,7 @@ async function doSimpleTest(revertBetweenSteps) {
// Wait for the second new search that starts when search mode is entered.
await UrlbarTestUtils.promiseSearchComplete(window);
await UrlbarTestUtils.assertSearchMode(window, {
engineName: testEngine.name,
engineName: TEST_ALIAS_ENGINE_NAME,
entry: "typed",
});
Assert.equal(gURLBar.value, "", "value should be empty");
@ -130,7 +129,7 @@ async function doSimpleTest(revertBetweenSteps) {
// Wait for the second new search that starts when search mode is entered.
await UrlbarTestUtils.promiseSearchComplete(window);
await UrlbarTestUtils.assertSearchMode(window, {
engineName: testEngine.name,
engineName: TEST_ALIAS_ENGINE_NAME,
entry: "typed",
});
Assert.equal(gURLBar.value, "foo", "value should be query");
@ -153,7 +152,7 @@ async function doSimpleTest(revertBetweenSteps) {
// Wait for the second new search that starts when search mode is entered.
await UrlbarTestUtils.promiseSearchComplete(window);
await UrlbarTestUtils.assertSearchMode(window, {
engineName: testEngine.name,
engineName: TEST_ALIAS_ENGINE_NAME,
entry: "typed",
});
Assert.equal(gURLBar.value, "", "value should be empty");
@ -210,7 +209,7 @@ add_task(async function spacesBeforeAlias() {
// Wait for the second new search that starts when search mode is entered.
await UrlbarTestUtils.promiseSearchComplete(window);
await UrlbarTestUtils.assertSearchMode(window, {
engineName: testEngine.name,
engineName: TEST_ALIAS_ENGINE_NAME,
entry: "typed",
});
Assert.equal(gURLBar.value, "", "value should be empty");
@ -314,7 +313,7 @@ add_task(async function aliasCase() {
// Wait for the second new search that starts when search mode is entered.
await UrlbarTestUtils.promiseSearchComplete(window);
await UrlbarTestUtils.assertSearchMode(window, {
engineName: testEngine.name,
engineName: TEST_ALIAS_ENGINE_NAME,
entry: "typed",
});
Assert.equal(gURLBar.value, "", "value should be empty");
@ -333,7 +332,7 @@ add_task(async function aliasCase_query() {
// Wait for the second new search that starts when search mode is entered.
await UrlbarTestUtils.promiseSearchComplete(window);
await UrlbarTestUtils.assertSearchMode(window, {
engineName: testEngine.name,
engineName: TEST_ALIAS_ENGINE_NAME,
entry: "typed",
});
Assert.equal(gURLBar.value, "query", "value should be query");
@ -500,7 +499,7 @@ add_task(async function enterAutofillsAlias() {
await searchPromise;
await UrlbarTestUtils.assertSearchMode(window, {
engineName: testEngine.name,
engineName: TEST_ALIAS_ENGINE_NAME,
entry: "keywordoffer",
});
@ -526,7 +525,7 @@ add_task(async function rightEntersSearchMode() {
await searchPromise;
await UrlbarTestUtils.assertSearchMode(window, {
engineName: testEngine.name,
engineName: TEST_ALIAS_ENGINE_NAME,
entry: "typed",
});
Assert.equal(gURLBar.value, "", "value should be empty");
@ -562,7 +561,7 @@ add_task(async function rightEntersSearchMode() {
);
await UrlbarTestUtils.assertSearchMode(window, {
engineName: testEngine.name,
engineName: TEST_ALIAS_ENGINE_NAME,
entry: "keywordoffer",
isPreview: true,
});
@ -573,7 +572,7 @@ add_task(async function rightEntersSearchMode() {
await searchPromise;
await UrlbarTestUtils.assertSearchMode(window, {
engineName: testEngine.name,
engineName: TEST_ALIAS_ENGINE_NAME,
entry: "keywordoffer",
isPreview: false,
});
@ -650,10 +649,13 @@ add_task(async function hiddenEngine() {
add_task(async function nonPrefixedKeyword() {
let name = "Custom";
let alias = "customkeyword";
let engine = await Services.search.addEngineWithDetails(name, {
alias,
template: "http://example.com/?search={searchTerms}",
});
let extension = await SearchTestUtils.installSearchExtension(
{
name,
keyword: alias,
},
true
);
await UrlbarTestUtils.promiseAutocompleteResultPopup({
window,
@ -688,16 +690,19 @@ add_task(async function nonPrefixedKeyword() {
"The first result should be a keyword search result with the correct engine."
);
await Services.search.removeEngine(engine);
await extension.unload();
});
// Tests that we show all engines with a token alias that match the search
// string.
add_task(async function multipleMatchingEngines() {
let testEngineFoo = await Services.search.addEngineWithDetails("TestFoo", {
alias: `${ALIAS}foo`,
template: "http://example-2.com/?search={searchTerms}",
});
let extension = await SearchTestUtils.installSearchExtension(
{
name: "TestFoo",
keyword: `${ALIAS}foo`,
},
true
);
await UrlbarTestUtils.promiseAutocompleteResultPopup({
window,
@ -748,7 +753,7 @@ add_task(async function multipleMatchingEngines() {
"Urlbar should contain the search string."
);
await Services.search.removeEngine(testEngineFoo);
await extension.unload();
});
// Tests that UrlbarProviderTokenAliasEngines is disabled in search mode.

Просмотреть файл

@ -1383,13 +1383,11 @@ add_task(async function test() {
await Services.search.setDefault(engine);
await Services.search.moveEngine(engine, 0);
let aliasEngine = await Services.search.addEngineWithDetails(
TEST_ENGINE_NAME,
{
alias: TEST_ENGINE_ALIAS,
template: `http://${TEST_ENGINE_DOMAIN}/?search={searchTerms}`,
}
);
await SearchTestUtils.installSearchExtension({
name: TEST_ENGINE_NAME,
keyword: TEST_ENGINE_ALIAS,
search_url: `https://${TEST_ENGINE_DOMAIN}/`,
});
// Add a bookmark and a keyword.
let bm = await PlacesUtils.bookmarks.insert({
@ -1410,7 +1408,6 @@ add_task(async function test() {
registerCleanupFunction(async function() {
await Services.search.setDefault(oldDefaultEngine);
await Services.search.removeEngine(aliasEngine);
await PlacesUtils.keywords.remove("kw");
await PlacesUtils.bookmarks.remove(bm);
await PlacesUtils.history.clear();

Просмотреть файл

@ -65,11 +65,9 @@ add_task(async function init() {
});
// Add a mock engine so we don't hit the network.
let engine = await Services.search.addEngineWithDetails("Test", {
template: "http://example.com/?search={searchTerms}",
});
await SearchTestUtils.installSearchExtension();
let oldDefaultEngine = await Services.search.getDefault();
Services.search.setDefault(engine);
Services.search.setDefault(Services.search.getEngineByName("Example"));
// Set up Quick Suggest.
await UrlbarQuickSuggest.init();
@ -86,7 +84,6 @@ add_task(async function init() {
registerCleanupFunction(async () => {
sandbox.restore();
Services.search.setDefault(oldDefaultEngine);
await Services.search.removeEngine(engine);
Services.telemetry.canRecordExtended = oldCanRecord;
delete UrlbarProviderQuickSuggest._helpUrl;
});

Просмотреть файл

@ -108,8 +108,9 @@ add_task(async function setup() {
set: [["browser.urlbar.tabToSearch.onboard.interactionsLeft", 0]],
});
let engine = await Services.search.addEngineWithDetails(ENGINE_NAME, {
template: `http://${ENGINE_DOMAIN}/?q={searchTerms}`,
await SearchTestUtils.installSearchExtension({
name: ENGINE_NAME,
search_url: `https://${ENGINE_DOMAIN}/`,
});
UrlbarTestUtils.init(this);
@ -125,7 +126,6 @@ add_task(async function setup() {
registerCleanupFunction(async () => {
Services.telemetry.canRecordExtended = oldCanRecord;
UrlbarTestUtils.uninit();
await Services.search.removeEngine(engine);
});
});

Просмотреть файл

@ -1,6 +1,12 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
const { SearchTestUtils } = ChromeUtils.import(
"resource://testing-common/SearchTestUtils.jsm"
);
SearchTestUtils.init(this);
add_task(async function() {
// Our search would be handled by the urlbar normally and not by the docshell,
// thus we must force going through dns first, so that the urlbar thinks
@ -10,10 +16,10 @@ add_task(async function() {
set: [["browser.fixup.dns_first_for_single_words", true]],
});
const kSearchEngineID = "test_urifixup_search_engine";
const kSearchEngineURL = "http://localhost/?search={searchTerms}";
await Services.search.addEngineWithDetails(kSearchEngineID, {
method: "get",
template: kSearchEngineURL,
await SearchTestUtils.installSearchExtension({
name: kSearchEngineID,
search_url: "http://localhost/",
search_url_get_params: "search={searchTerms}",
});
let oldDefaultEngine = await Services.search.getDefault();
@ -29,13 +35,7 @@ add_task(async function() {
);
registerCleanupFunction(async function() {
if (oldDefaultEngine) {
await Services.search.setDefault(oldDefaultEngine);
}
let engine = Services.search.getEngineByName(kSearchEngineID);
if (engine) {
await Services.search.removeEngine(engine);
}
await Services.search.setDefault(oldDefaultEngine);
});
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser);

Просмотреть файл

@ -6,11 +6,16 @@
const { UrlbarTestUtils } = ChromeUtils.import(
"resource://testing-common/UrlbarTestUtils.jsm"
);
const { SearchTestUtils } = ChromeUtils.import(
"resource://testing-common/SearchTestUtils.jsm"
);
SearchTestUtils.init(this);
const kSearchEngineID = "browser_urifixup_search_engine";
const kSearchEngineURL = "http://example.com/?search={searchTerms}";
const kSearchEngineURL = "https://example.com/?search={searchTerms}";
const kPrivateSearchEngineID = "browser_urifixup_search_engine_private";
const kPrivateSearchEngineURL = "http://example.com/?private={searchTerms}";
const kPrivateSearchEngineURL = "https://example.com/?private={searchTerms}";
add_task(async function setup() {
await SpecialPowers.pushPrefEnv({
@ -24,34 +29,28 @@ add_task(async function setup() {
let oldPrivateEngine = await Services.search.getDefaultPrivate();
// Add new fake search engines.
let newCurrentEngine = await Services.search.addEngineWithDetails(
kSearchEngineID,
{
method: "get",
template: kSearchEngineURL,
}
await SearchTestUtils.installSearchExtension({
name: kSearchEngineID,
search_url: "https://example.com/",
search_url_get_params: "search={searchTerms}",
});
await Services.search.setDefault(
Services.search.getEngineByName(kSearchEngineID)
);
await Services.search.setDefault(newCurrentEngine);
let newPrivateEngine = await Services.search.addEngineWithDetails(
kPrivateSearchEngineID,
{
method: "get",
template: kPrivateSearchEngineURL,
}
await SearchTestUtils.installSearchExtension({
name: kPrivateSearchEngineID,
search_url: "https://example.com/",
search_url_get_params: "private={searchTerms}",
});
await Services.search.setDefaultPrivate(
Services.search.getEngineByName(kPrivateSearchEngineID)
);
await Services.search.setDefaultPrivate(newPrivateEngine);
// Remove the fake engines when done.
registerCleanupFunction(async () => {
if (oldCurrentEngine) {
await Services.search.setDefault(oldCurrentEngine);
}
if (oldPrivateEngine) {
await Services.search.setDefault(oldPrivateEngine);
}
await Services.search.removeEngine(newCurrentEngine);
await Services.search.removeEngine(newPrivateEngine);
await Services.search.setDefault(oldCurrentEngine);
await Services.search.setDefault(oldPrivateEngine);
});
});

Просмотреть файл

@ -26,11 +26,19 @@ var EXPORTED_SYMBOLS = ["SearchTestUtils"];
var gTestScope;
var SearchTestUtils = Object.freeze({
var SearchTestUtils = {
init(testScope) {
gTestScope = testScope;
// This handles xpcshell-tests.
if (!("ExtensionTestUtils" in gTestScope)) {
let env = Cc["@mozilla.org/process/environment;1"].getService(
Ci.nsIEnvironment
);
this._isMochitest = !env.exists("XPCSHELL_TEST_PROFILE_DIR");
if (this._isMochitest) {
this._isMochitest = true;
AddonTestUtils.initMochitest(testScope);
} else {
this._isMochitest = false;
// This handles xpcshell-tests.
gTestScope.ExtensionTestUtils = ExtensionTestUtils;
}
},
@ -177,21 +185,43 @@ var SearchTestUtils = Object.freeze({
* Note: If you are in xpcshell-tests, then you should call
* `initXPCShellAddonManager` before calling this.
*
* Note: for tests, the extension must generally be unloaded before
* `registerCleanupFunction`s are triggered. See bug 1694409.
*
* For mochitests this function automatically registers an unload, this
* may be skipped with the skipUnload argument.
* For xpcshell-tests, we will hopefully be able to add the unload once
* bug 1694409 is fixed.
*
* @param {object} [options]
* @see createEngineManifest
* @param {boolean} [skipUnload]
* If true, this will skip the automatic unloading of the extension.
* @returns {object}
* The loaded extension. This will need unloading before ending the test.
*/
async installSearchExtension(options = {}) {
options.id = (options.id ?? "example") + "@tests.mozilla.org";
async installSearchExtension(options = {}, skipUnload = false) {
let extensionInfo = {
useAddonManager: "permanent",
manifest: this.createEngineManifest(options),
};
let extension = gTestScope.ExtensionTestUtils.loadExtension(extensionInfo);
let extension;
// Cleanup must be registered before loading the extension to avoid
// failures for mochitests.
if (!skipUnload && this._isMochitest) {
gTestScope.registerCleanupFunction(async () => {
await extension.unload();
});
}
extension = gTestScope.ExtensionTestUtils.loadExtension(extensionInfo);
await extension.startup();
if (!options.skipWaitForSearchEngine) {
await AddonTestUtils.waitForSearchProviderStartup(extension);
}
return extension;
},
@ -256,8 +286,11 @@ var SearchTestUtils = Object.freeze({
* The generated manifest.
*/
createEngineManifest(options = {}) {
options.id = options.id ?? "example@tests.mozilla.org";
options.name = options.name ?? "Example";
options.id = options.id ?? options.name.toLowerCase().replaceAll(" ", "");
if (!options.id.includes("@")) {
options.id += "@tests.mozilla.org";
}
options.version = options.version ?? "1.0";
let manifest = {
version: options.version,
@ -363,4 +396,4 @@ var SearchTestUtils = Object.freeze({
this.idleService._fireObservers("idle");
await reloadObserved;
},
});
};

Просмотреть файл

@ -74,6 +74,7 @@ add_task(async function test_basic_upgrade() {
add_task(async function test_upgrade_changes_name() {
let extension = await SearchTestUtils.installSearchExtension({
name: "engine",
id: "engine@tests.mozilla.org",
search_url_get_params: `q={searchTerms}&version=1.0`,
version: "1.0",
});
@ -106,6 +107,7 @@ add_task(async function test_upgrade_changes_name() {
let manifest = SearchTestUtils.createEngineManifest({
name: "Bar",
id: "engine@tests.mozilla.org",
search_url_get_params: `q={searchTerms}&version=2.0`,
version: "2.0",
});

Просмотреть файл

@ -2169,7 +2169,7 @@ add_task(async function test_defaultSearchEngine_paramsChanged() {
checkEnvironmentData(data);
Assert.deepEqual(data.settings.defaultSearchEngineData, {
name: "TestEngine",
loadPath: "[other]addEngineWithDetails:example@tests.mozilla.org",
loadPath: "[other]addEngineWithDetails:testengine@tests.mozilla.org",
origin: "verified",
submissionURL: "https://www.google.com/fake1?q=",
});
@ -2197,7 +2197,7 @@ add_task(async function test_defaultSearchEngine_paramsChanged() {
checkEnvironmentData(data);
Assert.deepEqual(data.settings.defaultSearchEngineData, {
name: "TestEngine",
loadPath: "[other]addEngineWithDetails:example@tests.mozilla.org",
loadPath: "[other]addEngineWithDetails:testengine@tests.mozilla.org",
origin: "verified",
submissionURL: "https://www.google.com/fake2?q=",
});