-
Notifications
You must be signed in to change notification settings - Fork 54
/
test_big_icon.js
43 lines (37 loc) · 1.09 KB
/
test_big_icon.js
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
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
add_task(async function test_big_icon() {
let srv = useHttpServer();
srv.registerContentType("ico", "image/x-icon");
await AddonTestUtils.promiseStartupManager();
await Services.search.init();
let promiseChanged = TestUtils.topicObserved(
"browser-search-engine-modified",
(engine, verb) => {
engine.QueryInterface(Ci.nsISearchEngine);
return (
verb == "engine-changed" && engine.name == "BigIcon" && engine.iconURI
);
}
);
let iconUrl = gDataUrl + "big_icon.ico";
await addTestEngines([
{
name: "BigIcon",
details: {
iconURL: iconUrl,
description: "Big icon",
method: "GET",
template: "http://test_big_icon/search?q={searchTerms}",
},
},
]);
await promiseAfterCache();
let [engine] = await promiseChanged;
engine.QueryInterface(Ci.nsISearchEngine);
Assert.ok(
engine.iconURI.spec.startsWith("data:image/png"),
"The icon is saved as a PNG data url"
);
});