1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const TEST_CONFIG = [
{
webExtension: {
id: "plainengine@search.mozilla.org",
name: "Plain",
search_url: "https://duckduckgo.com/",
params: [
{
name: "q",
value: "{searchTerms}",
},
],
suggest_url: "https://ac.duckduckgo.com/ac/q={searchTerms}&type=list",
},
appliesTo: [{ included: { everywhere: true } }],
},
{
webExtension: {
id: "special-engine@search.mozilla.org",
name: "Special",
search_url: "https://www.google.com/search",
params: [
{
name: "q",
value: "{searchTerms}",
},
{
name: "client",
condition: "purpose",
purpose: "keyword",
value: "firefox-b-1-ab",
},
{
name: "client",
condition: "purpose",
purpose: "searchbar",
value: "firefox-b-1",
},
],
suggest_url:
"https://www.google.com/complete/search?client=firefox&q={searchTerms}",
},
appliesTo: [{ default: "yes", included: { regions: ["FR"] } }],
},
];
add_setup(async function () {
await SearchTestUtils.useTestEngines("test-extensions", null, TEST_CONFIG);
await AddonTestUtils.promiseStartupManager();
registerCleanupFunction(AddonTestUtils.promiseShutdownManager);
});
add_task(async function basic_multilocale_test() {
let resolver;
let initPromise = new Promise(resolve => (resolver = resolve));
useCustomGeoServer("FR", initPromise);
await Services.search.init();
await Services.search.getAppProvidedEngines();
resolver();
await SearchTestUtils.promiseSearchNotification("engines-reloaded");
let engines = await Services.search.getAppProvidedEngines();
Assert.deepEqual(
engines.map(e => e._name),
["Special", "Plain"],
"Special engine is default so should be first"
);
engines.forEach(engine => {
Assert.ok(!engine._metaData.order, "Order is not defined");
});
Assert.equal(
Services.search.wrappedJSObject._settings.getMetaDataAttribute(
"useSavedOrder"
),
false,
"We should not set the engine order during maybeReloadEngines"
);
});
|