Loading toolkit/components/search/tests/xpcshell/test_base_browser.js 0 → 100644 +47 −0 Original line number Diff line number Diff line /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ /** * This tests the SearchService to check our override of the remote settings is * working as expected. */ "use strict"; const expectedURLs = { ddg: "https://duckduckgo.com/?q=test", startpage: "https://www.startpage.com/sp/search?q=test", }; const defaultEngine = "ddg"; add_setup(async function setup() { await Services.search.init(); }); add_task(async function test_listEngines() { const { engines } = await Services.search.wrappedJSObject._fetchEngineSelectorEngines(); const foundIdentifiers = engines.map(e => e.identifier); Assert.deepEqual(foundIdentifiers, Object.keys(expectedURLs)); }); add_task(async function test_default() { Assert.equal( (await Services.search.getDefault()).id, defaultEngine, `${defaultEngine} is our default search engine in normal mode.` ); Assert.equal( (await Services.search.getDefaultPrivate()).id, defaultEngine, `${defaultEngine} is our default search engine in PBM.` ); }); add_task(function test_checkSearchURLs() { for (const [id, url] of Object.entries(expectedURLs)) { const engine = Services.search.getEngineById(id); const foundUrl = engine.getSubmission("test").uri.spec; Assert.equal(foundUrl, url, `The URL of ${engine.name} is not altered.`); } }); toolkit/components/search/tests/xpcshell/xpcshell.toml +2 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,8 @@ tags = "remote-settings" ["test_async.js"] ["test_base_browser.js"] ["test_configExpansion.js"] support-files = [ "../../schema/search-config-v2-schema.json", Loading Loading
toolkit/components/search/tests/xpcshell/test_base_browser.js 0 → 100644 +47 −0 Original line number Diff line number Diff line /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ /** * This tests the SearchService to check our override of the remote settings is * working as expected. */ "use strict"; const expectedURLs = { ddg: "https://duckduckgo.com/?q=test", startpage: "https://www.startpage.com/sp/search?q=test", }; const defaultEngine = "ddg"; add_setup(async function setup() { await Services.search.init(); }); add_task(async function test_listEngines() { const { engines } = await Services.search.wrappedJSObject._fetchEngineSelectorEngines(); const foundIdentifiers = engines.map(e => e.identifier); Assert.deepEqual(foundIdentifiers, Object.keys(expectedURLs)); }); add_task(async function test_default() { Assert.equal( (await Services.search.getDefault()).id, defaultEngine, `${defaultEngine} is our default search engine in normal mode.` ); Assert.equal( (await Services.search.getDefaultPrivate()).id, defaultEngine, `${defaultEngine} is our default search engine in PBM.` ); }); add_task(function test_checkSearchURLs() { for (const [id, url] of Object.entries(expectedURLs)) { const engine = Services.search.getEngineById(id); const foundUrl = engine.getSubmission("test").uri.spec; Assert.equal(foundUrl, url, `The URL of ${engine.name} is not altered.`); } });
toolkit/components/search/tests/xpcshell/xpcshell.toml +2 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,8 @@ tags = "remote-settings" ["test_async.js"] ["test_base_browser.js"] ["test_configExpansion.js"] support-files = [ "../../schema/search-config-v2-schema.json", Loading