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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests search engine aliases. See
* browser/components/urlbar/tests/browser/browser_tokenAlias.js for tests of
* the token alias list (i.e. showing all aliased engines on a "@" query).
*/
testEngine_setup();
// Basic test that uses two engines, a GET engine and a POST engine, neither
// providing search suggestions.
add_task(async function basicGetAndPost() {
await SearchTestUtils.installSearchExtension({
name: "AliasedGETMozSearch",
keyword: "get",
search_url: "https://s.example.com/search",
});
await SearchTestUtils.installSearchExtension({
name: "AliasedPOSTMozSearch",
keyword: "post",
search_url: "https://s.example.com/search",
search_url_post_params: "q={searchTerms}",
});
for (let alias of ["get", "post"]) {
let context = createContext(alias, { isPrivate: false });
await check_results({
context,
matches: [
makeSearchResult(context, {
engineName: SUGGESTIONS_ENGINE_NAME,
heuristic: true,
providerName: "HeuristicFallback",
}),
],
});
context = createContext(`${alias} `, { isPrivate: false });
await check_results({
context,
matches: [
makeSearchResult(context, {
engineName: `Aliased${alias.toUpperCase()}MozSearch`,
query: "",
alias,
heuristic: true,
providerName: "AliasEngines",
}),
],
});
context = createContext(`${alias} fire`, { isPrivate: false });
await check_results({
context,
matches: [
makeSearchResult(context, {
engineName: `Aliased${alias.toUpperCase()}MozSearch`,
query: "fire",
alias,
heuristic: true,
providerName: "AliasEngines",
}),
],
});
context = createContext(`${alias} mozilla`, { isPrivate: false });
await check_results({
context,
matches: [
makeSearchResult(context, {
engineName: `Aliased${alias.toUpperCase()}MozSearch`,
query: "mozilla",
alias,
heuristic: true,
providerName: "AliasEngines",
}),
],
});
context = createContext(`${alias} MoZiLlA`, { isPrivate: false });
await check_results({
context,
matches: [
makeSearchResult(context, {
engineName: `Aliased${alias.toUpperCase()}MozSearch`,
query: "MoZiLlA",
alias,
heuristic: true,
providerName: "AliasEngines",
}),
],
});
context = createContext(`${alias} mozzarella mozilla`, {
isPrivate: false,
});
await check_results({
context,
matches: [
makeSearchResult(context, {
engineName: `Aliased${alias.toUpperCase()}MozSearch`,
query: "mozzarella mozilla",
alias,
heuristic: true,
providerName: "AliasEngines",
}),
],
});
}
await cleanupPlaces();
});
|