diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:33 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:33 +0000 |
commit | 086c044dc34dfc0f74fbe41f4ecb402b2cd34884 (patch) | |
tree | a4f824bd33cb075dd5aa3eb5a0a94af221bbe83a /browser/components/extensions/test/xpcshell/test_ext_settings_overrides_search_mozParam.js | |
parent | Adding debian version 124.0.1-1. (diff) | |
download | firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.tar.xz firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/extensions/test/xpcshell/test_ext_settings_overrides_search_mozParam.js')
-rw-r--r-- | browser/components/extensions/test/xpcshell/test_ext_settings_overrides_search_mozParam.js | 132 |
1 files changed, 117 insertions, 15 deletions
diff --git a/browser/components/extensions/test/xpcshell/test_ext_settings_overrides_search_mozParam.js b/browser/components/extensions/test/xpcshell/test_ext_settings_overrides_search_mozParam.js index 3248c5cefa..5437d63d16 100644 --- a/browser/components/extensions/test/xpcshell/test_ext_settings_overrides_search_mozParam.js +++ b/browser/components/extensions/test/xpcshell/test_ext_settings_overrides_search_mozParam.js @@ -15,6 +15,9 @@ const { NimbusFeatures } = ChromeUtils.importESModule( const { sinon } = ChromeUtils.importESModule( "resource://testing-common/Sinon.sys.mjs" ); +const { SearchUtils } = ChromeUtils.importESModule( + "resource://gre/modules/SearchUtils.sys.mjs" +); AddonTestUtils.init(this); AddonTestUtils.overrideCertDB(); @@ -51,23 +54,118 @@ const params = [ { name: "prefval", condition: "pref", pref: "code" }, ]; +const CONFIG = [ + { + webExtension: { + id: "test@search.mozilla.org", + }, + appliesTo: [ + { + included: { everywhere: true }, + default: "yes", + }, + ], + }, +]; +const CONFIG_V2 = [ + { + recordType: "engine", + identifier: "test", + base: { + name: "MozParamsTest", + urls: { + search: { + base: "https://example.com/", + params: [ + { + name: "test-0", + searchAccessPoint: { + contextmenu: "0", + }, + }, + { + name: "test-1", + searchAccessPoint: { + searchbar: "1", + }, + }, + { + name: "test-2", + searchAccessPoint: { + homepage: "2", + }, + }, + { + name: "test-3", + searchAccessPoint: { + addressbar: "3", + }, + }, + { + name: "test-4", + searchAccessPoint: { + newtab: "4", + }, + }, + { + name: "simple", + value: "5", + }, + { + name: "term", + value: "{searchTerms}", + }, + { + name: "lang", + value: "{language}", + }, + { + name: "locale", + value: "{moz:locale}", + }, + { + name: "prefval", + experimentConfig: "code", + }, + { + name: "experimenter-1", + experimentConfig: "nimbus-key-1", + }, + { + name: "experimenter-2", + experimentConfig: "nimbus-key-2", + }, + ], + searchTermParamName: "q", + }, + }, + }, + variants: [ + { + environment: { allRegionsAndLocales: true }, + }, + ], + }, + { + recordType: "defaultEngines", + globalDefault: "test", + specificDefaults: [], + }, + { + recordType: "engineOrders", + orders: [], + }, +]; + add_task(async function setup() { let readyStub = sinon.stub(NimbusFeatures.search, "ready").resolves(); let updateStub = sinon.stub(NimbusFeatures.search, "onUpdate"); await promiseStartupManager(); - await SearchTestUtils.useTestEngines("data", null, [ - { - webExtension: { - id: "test@search.mozilla.org", - }, - appliesTo: [ - { - included: { everywhere: true }, - default: "yes", - }, - ], - }, - ]); + await SearchTestUtils.useTestEngines( + "data", + null, + SearchUtils.newSearchConfigEnabled ? CONFIG_V2 : CONFIG + ); await Services.search.init(); registerCleanupFunction(async () => { await promiseShutdownManager(); @@ -107,7 +205,9 @@ add_task(async function test_extension_setting_moz_params() { ).uri.spec; equal( expectedURL, - `https://example.com/?q=test&${p.name}=${p.value}&${paramStr}`, + SearchUtils.newSearchConfigEnabled + ? `https://example.com/?${p.name}=${p.value}&${paramStr}&q=test` + : `https://example.com/?q=test&${p.name}=${p.value}&${paramStr}`, "search url is expected" ); } @@ -180,7 +280,9 @@ add_task(async function test_nimbus_params() { ).uri.spec; equal( expectedURL, - `https://example.com/?q=test&${p.name}=${p.value}&${paramStr}`, + SearchUtils.newSearchConfigEnabled + ? `https://example.com/?${p.name}=${p.value}&${paramStr}&q=test` + : `https://example.com/?q=test&${p.name}=${p.value}&${paramStr}`, "search url is expected" ); } |