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_defaults.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_defaults.js')
-rw-r--r-- | browser/components/extensions/test/xpcshell/test_ext_settings_overrides_defaults.js | 182 |
1 files changed, 156 insertions, 26 deletions
diff --git a/browser/components/extensions/test/xpcshell/test_ext_settings_overrides_defaults.js b/browser/components/extensions/test/xpcshell/test_ext_settings_overrides_defaults.js index dd24be3aff..05ba807fae 100644 --- a/browser/components/extensions/test/xpcshell/test_ext_settings_overrides_defaults.js +++ b/browser/components/extensions/test/xpcshell/test_ext_settings_overrides_defaults.js @@ -23,6 +23,124 @@ const { sinon } = ChromeUtils.importESModule( "resource://testing-common/Sinon.sys.mjs" ); +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: "engine", + identifier: "test2", + base: { + name: "MozParamsTest2", + urls: { + search: { + base: "https://example.com/2/", + params: [ + { + name: "simple2", + value: "5", + }, + ], + searchTermParamName: "q", + }, + }, + }, + variants: [ + { + environment: { + allRegionsAndLocales: true, + }, + }, + ], + }, + { + recordType: "defaultEngines", + globalDefault: "test", + specificDefaults: [], + }, + { + recordType: "engineOrders", + orders: [], + }, +]; + const URLTYPE_SUGGEST_JSON = "application/x-suggestions+json"; AddonTestUtils.init(this); @@ -43,29 +161,35 @@ add_task(async function setup() { AddonTestUtils.usePrivilegedSignatures = false; AddonTestUtils.overrideCertDB(); await AddonTestUtils.promiseStartupManager(); - await SearchTestUtils.useTestEngines("data", null, [ - { - webExtension: { - id: "test@search.mozilla.org", - }, - appliesTo: [ - { - included: { everywhere: true }, - default: "yes", - }, - ], - }, - { - webExtension: { - id: "test2@search.mozilla.org", - }, - appliesTo: [ - { - included: { everywhere: true }, - }, - ], - }, - ]); + await SearchTestUtils.useTestEngines( + "data", + null, + SearchUtils.newSearchConfigEnabled + ? CONFIG_V2 + : [ + { + webExtension: { + id: "test@search.mozilla.org", + }, + appliesTo: [ + { + included: { everywhere: true }, + default: "yes", + }, + ], + }, + { + webExtension: { + id: "test2@search.mozilla.org", + }, + appliesTo: [ + { + included: { everywhere: true }, + }, + ], + }, + ] + ); await Services.search.init(); registerCleanupFunction(async () => { await AddonTestUtils.promiseShutdownManager(); @@ -124,7 +248,9 @@ add_task(async function test_extension_changing_to_app_provided_default() { assertEngineParameters({ name: "MozParamsTest2", - searchURL: "https://example.com/2/?q={searchTerms}&simple2=5", + searchURL: SearchUtils.newSearchConfigEnabled + ? "https://example.com/2/?simple2=5&q={searchTerms}" + : "https://example.com/2/?q={searchTerms}&simple2=5", messageSnippet: "left unchanged", }); @@ -213,7 +339,9 @@ add_task(async function test_extension_overriding_app_provided_default() { ); assertEngineParameters({ name: "MozParamsTest2", - searchURL: "https://example.com/2/?q={searchTerms}&simple2=5", + searchURL: SearchUtils.newSearchConfigEnabled + ? "https://example.com/2/?simple2=5&q={searchTerms}" + : "https://example.com/2/?q={searchTerms}&simple2=5", messageSnippet: "reverted", }); @@ -256,7 +384,9 @@ add_task(async function test_extension_overriding_app_provided_default() { assertEngineParameters({ name: "MozParamsTest2", - searchURL: "https://example.com/2/?q={searchTerms}&simple2=5", + searchURL: SearchUtils.newSearchConfigEnabled + ? "https://example.com/2/?simple2=5&q={searchTerms}" + : "https://example.com/2/?q={searchTerms}&simple2=5", messageSnippet: "reverted", }); sinon.restore(); |