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
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
const ORIGINS_FEATUREGATE = "places.frecency.origins.alternative.featureGate";
const ORIGINS_DAYSCUTOFF = "places.frecency.origins.alternative.daysCutOff";
add_task(async function () {
let reset = await UrlbarTestUtils.initNimbusFeature(
{
// Empty for sanity check.
},
"frecency",
"config"
);
Assert.equal(Services.prefs.getBoolPref(ORIGINS_FEATUREGATE), false);
Assert.throws(
() => Services.prefs.getIntPref(ORIGINS_DAYSCUTOFF),
/NS_ERROR_UNEXPECTED/
);
await reset();
reset = await UrlbarTestUtils.initNimbusFeature(
{
originsAlternativeEnable: true,
},
"frecency",
"config"
);
Assert.equal(Services.prefs.getBoolPref(ORIGINS_FEATUREGATE), true);
Assert.ok(Services.prefs.prefHasUserValue(ORIGINS_FEATUREGATE));
Assert.throws(
() => Services.prefs.getIntPref(ORIGINS_DAYSCUTOFF),
/NS_ERROR_UNEXPECTED/
);
await reset();
reset = await UrlbarTestUtils.initNimbusFeature(
{
originsAlternativeEnable: true,
originsDaysCutOff: 60,
},
"frecency",
"config"
);
Assert.equal(Services.prefs.getBoolPref(ORIGINS_FEATUREGATE), true);
Assert.ok(Services.prefs.prefHasUserValue(ORIGINS_FEATUREGATE));
Assert.equal(Services.prefs.getIntPref(ORIGINS_DAYSCUTOFF, 90), 60);
Assert.ok(Services.prefs.prefHasUserValue(ORIGINS_DAYSCUTOFF));
await reset();
});
|