blob: a94f1fe05543e675ec3c98ac0e57348679bba2d3 (
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
63
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const { ExperimentFakes } = ChromeUtils.importESModule(
"resource://testing-common/NimbusTestUtils.sys.mjs"
);
registerCleanupFunction(async () => {
// When the test completes, make sure we cleanup with a populated cache,
// since this is the default starting state for these tests.
await withFullyLoadedAboutHome(async browser => {
await simulateRestart(browser);
});
});
/**
* Tests that the ExperimentsAPI mechanism can be used to remotely
* enable and disable the about:home startup cache.
*/
add_task(async function test_experiments_api_control() {
// First, the disabled case.
await withFullyLoadedAboutHome(async browser => {
let doEnrollmentCleanup = await ExperimentFakes.enrollWithFeatureConfig({
featureId: "abouthomecache",
value: { enabled: false },
});
Assert.ok(
!NimbusFeatures.abouthomecache.getVariable("enabled"),
"NimbusFeatures should tell us that the about:home startup cache " +
"is disabled"
);
await simulateRestart(browser);
await ensureDynamicAboutHome(
browser,
AboutHomeStartupCache.CACHE_RESULT_SCALARS.DISABLED
);
await doEnrollmentCleanup();
});
// Now the enabled case.
await withFullyLoadedAboutHome(async browser => {
let doEnrollmentCleanup = await ExperimentFakes.enrollWithFeatureConfig({
featureId: "abouthomecache",
value: { enabled: true },
});
Assert.ok(
NimbusFeatures.abouthomecache.getVariable("enabled"),
"NimbusFeatures should tell us that the about:home startup cache " +
"is enabled"
);
await simulateRestart(browser);
await ensureCachedAboutHome(browser);
await doEnrollmentCleanup();
});
});
|