зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 90e7019e0fa8 (bug 1541416) for searchconfigs/test_amazon.js, test_duckduckgo.js, test_ebay.js CLOSED TREE
This commit is contained in:
Родитель
25a90f109b
Коммит
ed23dd1ad2
|
@ -200,26 +200,6 @@ class SearchConfigTest {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to determine if an engine matches within a list.
|
||||
* Due to Amazon's current complex setup with three different identifiers,
|
||||
* if the identifier is 'amazon', then we do a startsWith match. Otherwise
|
||||
* we expect the names to equal.
|
||||
*
|
||||
* @param {Array} engines
|
||||
* The list of engines to check.
|
||||
* @param {string} identifier
|
||||
* The identifier to look for in the list.
|
||||
* @returns {boolean}
|
||||
* Returns true if the engine is found within the list.
|
||||
*/
|
||||
_enginesMatch(engines, identifier) {
|
||||
if (identifier == "amazon") {
|
||||
return !!engines.find(engine => engine.startsWith(identifier));
|
||||
}
|
||||
return engines.includes(identifier);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts whether the engines rules defined in the configuration are met.
|
||||
*
|
||||
|
@ -237,11 +217,10 @@ class SearchConfigTest {
|
|||
const config = this._config[section];
|
||||
const hasIncluded = "included" in config;
|
||||
const hasExcluded = "excluded" in config;
|
||||
const identifierIncluded = this._enginesMatch(engines, this._config.identifier);
|
||||
|
||||
// If there's not included/excluded, then this shouldn't be the default anywhere.
|
||||
if (section == "default" && !hasIncluded && !hasExcluded) {
|
||||
Assert.ok(!identifierIncluded,
|
||||
Assert.ok(!engines.includes(this._config.identifier),
|
||||
`Should not be ${section} for any locale/region,
|
||||
currently set for ${infoString}`);
|
||||
return;
|
||||
|
@ -256,10 +235,12 @@ class SearchConfigTest {
|
|||
!this._localeRegionInSection(config.excluded, region, locale));
|
||||
|
||||
if (included || notExcluded) {
|
||||
Assert.ok(identifierIncluded, `Should be ${section} for ${infoString}`);
|
||||
Assert.ok(engines.includes(this._config.identifier),
|
||||
`Should be ${section} for ${infoString}`);
|
||||
return;
|
||||
}
|
||||
Assert.ok(!identifierIncluded, `Should not be ${section} for ${infoString}`);
|
||||
Assert.ok(!engines.includes(this._config.identifier),
|
||||
`Should not be ${section} for ${infoString}`);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
const test = new SearchConfigTest({
|
||||
identifier: "amazon",
|
||||
default: {
|
||||
// Not included anywhere.
|
||||
},
|
||||
available: {
|
||||
included: [{
|
||||
// We don't currently enforce by region, but do locale instead.
|
||||
// regions: [
|
||||
// "at", "au", "be", "ca", "ch", "de", "fr", "gb", "ie", "it", "jp", "nl",
|
||||
// "us",
|
||||
// ],
|
||||
locales: {
|
||||
matches: [
|
||||
"ach", "af", "ar", "as", "az", "bg", "bn", "bn-IN", "br", "cak", "cy",
|
||||
"da", "de", "dsb", "el", "eo", "es-AR", "eu", "fa", "ff", "fr",
|
||||
"ga-IE", "gd", "gl", "gn", "gu-IN", "hr", "hsb", "hy-AM", "ia", "is",
|
||||
"it", "ja-JP-mac", "ja", "ka", "km", "kn", "lij", "lt", "mai", "mk",
|
||||
"ml", "mr", "ms", "my", "nb-NO", "nn-NO", "or", "pa-IN", "pt-PT", "ro",
|
||||
"si", "son", "sq", "sr", "ta", "te", "th", "tl", "trs", "ur", "uz",
|
||||
"wo", "zh-CN",
|
||||
],
|
||||
startsWith: ["en"],
|
||||
},
|
||||
}],
|
||||
},
|
||||
});
|
||||
|
||||
add_task(async function setup() {
|
||||
// We only need to do setup on one of the tests.
|
||||
await test.setup();
|
||||
});
|
||||
|
||||
add_task(async function test_searchConfig_amazon() {
|
||||
await test.run();
|
||||
});
|
|
@ -1,24 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
const test = new SearchConfigTest({
|
||||
identifier: "ddg",
|
||||
default: {
|
||||
// Not included anywhere.
|
||||
},
|
||||
available: {
|
||||
excluded: [
|
||||
// Should be available everywhere.
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
add_task(async function setup() {
|
||||
await test.setup();
|
||||
});
|
||||
|
||||
add_task(async function test_searchConfig_duckduckgo() {
|
||||
await test.run();
|
||||
});
|
|
@ -1,70 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
const test = new SearchConfigTest({
|
||||
identifier: "ebay",
|
||||
default: {
|
||||
// Not included anywhere.
|
||||
},
|
||||
available: {
|
||||
included: [{
|
||||
// We don't currently enforce by region, but do locale instead.
|
||||
// regions: [
|
||||
// "us", "gb", "ca", "ie", "fr", "it", "de", "at", "es", "nl", "ch", "au"
|
||||
// ],
|
||||
locales: {
|
||||
matches: ["an", "en-US", "ast", "br", "ca", "cy", "de", "dsb", "en-CA", "en-GB", "es-ES", "eu", "fr", "fy-NL", "ga-IE", "gd", "gl", "hsb", "it", "lij", "nl", "rm", "wo"],
|
||||
},
|
||||
}],
|
||||
},
|
||||
// domains: {
|
||||
// // Note: These should be based on region, but we don't currently enforce that.
|
||||
// "ebay.com": {
|
||||
// locales: { matches: ["en-US"] },
|
||||
// },
|
||||
// "ebay.co.uk": {
|
||||
// locales: { matches: ["en-GB"] },
|
||||
// },
|
||||
// "ebay.ca": {
|
||||
// locales: { matches: ["en-CA"] },
|
||||
// },
|
||||
// "ebay.ie": {
|
||||
// locales: { matches: ["ie"] },
|
||||
// },
|
||||
// "ebay.fr": {
|
||||
// locales: { matches: ["fr"] },
|
||||
// },
|
||||
// "ebay.it": {
|
||||
// locales: { matches: ["it"] },
|
||||
// },
|
||||
// "ebay.de": {
|
||||
// locales: { matches: ["de"] },
|
||||
// },
|
||||
// "ebay.at": {
|
||||
// locales: { matches: ["ast"] },
|
||||
// },
|
||||
// "ebay.es": {
|
||||
// locales: { matches: ["an", "es-ES"] },
|
||||
// },
|
||||
// "ebay.nl": {
|
||||
// locales: { matches: ["nl"] },
|
||||
// },
|
||||
// "ebay.ch": {
|
||||
// locales: { matches: ["rm"] },
|
||||
// },
|
||||
// "ebay.au": {
|
||||
// regions: ["au"],
|
||||
// },
|
||||
// },
|
||||
// noSuggestionsURL: true,
|
||||
});
|
||||
|
||||
add_task(async function setup() {
|
||||
await test.setup();
|
||||
});
|
||||
|
||||
add_task(async function test_searchConfig_ebay() {
|
||||
await test.run();
|
||||
});
|
|
@ -6,8 +6,6 @@ support-files =
|
|||
../../../../../../browser/locales/all-locales
|
||||
tags=searchconfig
|
||||
|
||||
[test_amazon.js]
|
||||
requesttimeoutfactor = 2
|
||||
[test_baidu.js]
|
||||
# This is an extensive test and currently takes a long time. Therefore skip on
|
||||
# debug/asan and extend the timeout length otherwise.
|
||||
|
@ -18,10 +16,6 @@ requesttimeoutfactor = 2
|
|||
# debug/asan and extend the timeout length otherwise.
|
||||
skip-if = debug || asan
|
||||
requesttimeoutfactor = 2
|
||||
[test_duckduckgo.js]
|
||||
requesttimeoutfactor = 2
|
||||
[test_ebay.js]
|
||||
requesttimeoutfactor = 2
|
||||
[test_google.js]
|
||||
# This is an extensive test and currently takes a long time. Therefore skip on
|
||||
# debug/asan and extend the timeout length otherwise.
|
||||
|
|
Загрузка…
Ссылка в новой задаче