blob: b02775bbd97deaacd992789d3b9905099ab58fc3 (
plain)
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
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/*
* Test initializing from the search settings.
*/
"use strict";
var { getAppInfo } = ChromeUtils.importESModule(
"resource://testing-common/AppInfo.sys.mjs"
);
var settingsTemplate;
/**
* Test reading from search.json.mozlz4
*/
add_task(async function setup() {
await AddonTestUtils.promiseStartupManager();
await setupRemoteSettings();
settingsTemplate = await readJSONFile(
do_get_file("data/search_ignorelist.json")
);
settingsTemplate.buildID = getAppInfo().platformBuildID;
await promiseSaveSettingsData(settingsTemplate);
});
/**
* Start the search service and confirm the settings were reset
*/
add_task(async function test_settings_rest() {
info("init search service");
let updatePromise = SearchTestUtils.promiseSearchNotification(
"settings-update-complete"
);
let result = await Services.search.init();
Assert.ok(
Components.isSuccessCode(result),
"Search service should be successfully initialized"
);
await updatePromise;
const engines = await Services.search.getEngines();
// Engine list will have been reset to the default,
// Not the one engine in the settings.
// It should have more than one engine.
Assert.greater(
engines.length,
1,
"Should have more than one engine in the list"
);
removeSettingsFile();
});
|