toolkit/mozapps/extensions/test/xpcshell/test_checkCompatibility_themeOverride.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:a8ab3708c3a2
1 /* Any copyright is dedicated to the Public Domain.
2 * http://creativecommons.org/publicdomain/zero/1.0/
3 */
4
5 // This verifies that the (temporary)
6 // extensions.checkCompatibility.temporaryThemeOverride_minAppVersion
7 // preference works.
8
9 var ADDONS = [{
10 id: "addon1@tests.mozilla.org",
11 type: 4,
12 internalName: "theme1/1.0",
13 version: "1.0",
14 name: "Test 1",
15 targetApplications: [{
16 id: "xpcshell@tests.mozilla.org",
17 minVersion: "1.0",
18 maxVersion: "1.0"
19 }]
20 }, {
21 id: "addon2@tests.mozilla.org",
22 type: 4,
23 internalName: "theme2/1.0",
24 version: "1.0",
25 name: "Test 2",
26 targetApplications: [{
27 id: "xpcshell@tests.mozilla.org",
28 minVersion: "2.0",
29 maxVersion: "2.0"
30 }]
31 }];
32
33 const profileDir = gProfD.clone();
34 profileDir.append("extensions");
35
36
37 function run_test() {
38 do_test_pending();
39 createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3.0", "1");
40
41 for (let a of ADDONS) {
42 writeInstallRDFForExtension(a, profileDir);
43 }
44
45 startupManager();
46
47 run_test_1();
48 }
49
50 function run_test_1() {
51 AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
52 "addon2@tests.mozilla.org"],
53 function([a1, a2]) {
54
55 do_check_neq(a1, null);
56 do_check_false(a1.isActive);
57 do_check_false(a1.isCompatible);
58 do_check_true(a1.appDisabled);
59
60 do_check_neq(a2, null);
61 do_check_false(a2.isActive);
62 do_check_false(a2.isCompatible);
63 do_check_true(a1.appDisabled);
64
65 do_execute_soon(run_test_2);
66 });
67 }
68
69 function run_test_2() {
70 Services.prefs.setCharPref("extensions.checkCompatibility.temporaryThemeOverride_minAppVersion", "2.0");
71 if (isNightlyChannel())
72 Services.prefs.setBoolPref("extensions.checkCompatibility.nightly", false);
73 else
74 Services.prefs.setBoolPref("extensions.checkCompatibility.3.0", false);
75 restartManager();
76
77 AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
78 "addon2@tests.mozilla.org"],
79 function([a1, a2]) {
80
81 do_check_neq(a1, null);
82 do_check_false(a1.isActive);
83 do_check_false(a1.isCompatible);
84 do_check_true(a1.appDisabled);
85
86 do_check_neq(a2, null);
87 do_check_false(a2.isActive);
88 do_check_false(a2.isCompatible);
89 do_check_false(a2.appDisabled);
90
91 do_execute_soon(do_test_finished);
92 });
93 }

mercurial