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

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:4ba5ea38d5e6
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
4 */
5
6 function run_test() {
7 do_test_pending();
8 createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2.2.3", "2");
9 Services.prefs.setBoolPref(PREF_EM_STRICT_COMPATIBILITY, true);
10
11 // inject the add-ons into the profile
12 var dest = gProfD.clone();
13 dest.append("extensions");
14 dest.append("bug470377_1@tests.mozilla.org");
15 dest.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755);
16 var source = do_get_file("data/test_bug470377/install_1.rdf");
17 source.copyTo(dest, "install.rdf");
18 dest = gProfD.clone();
19 dest.append("extensions");
20 dest.append("bug470377_2@tests.mozilla.org");
21 dest.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755);
22 source = do_get_file("data/test_bug470377/install_2.rdf");
23 source.copyTo(dest, "install.rdf");
24 dest = gProfD.clone();
25 dest.append("extensions");
26 dest.append("bug470377_3@tests.mozilla.org");
27 dest.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755);
28 source = do_get_file("data/test_bug470377/install_3.rdf");
29 source.copyTo(dest, "install.rdf");
30 dest = gProfD.clone();
31 dest.append("extensions");
32 dest.append("bug470377_4@tests.mozilla.org");
33 dest.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755);
34 source = do_get_file("data/test_bug470377/install_4.rdf");
35 source.copyTo(dest, "install.rdf");
36 dest = gProfD.clone();
37 dest.append("extensions");
38 dest.append("bug470377_5@tests.mozilla.org");
39 dest.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755);
40 source = do_get_file("data/test_bug470377/install_5.rdf");
41 source.copyTo(dest, "install.rdf");
42
43 startupManager();
44
45 run_test_1();
46 }
47
48 function run_test_1() {
49 AddonManager.getAddonsByIDs(["bug470377_1@tests.mozilla.org",
50 "bug470377_2@tests.mozilla.org",
51 "bug470377_3@tests.mozilla.org",
52 "bug470377_4@tests.mozilla.org",
53 "bug470377_5@tests.mozilla.org"],
54 function([a1, a2, a3, a4, a5]) {
55 do_check_neq(a1, null);
56 do_check_false(a1.isActive);
57 do_check_neq(a2, null);
58 do_check_false(a2.isActive);
59 do_check_neq(a3, null);
60 do_check_false(a3.isActive);
61 do_check_neq(a4, null);
62 do_check_true(a4.isActive);
63 do_check_neq(a5, null);
64 do_check_true(a5.isActive);
65
66 do_execute_soon(run_test_2);
67 });
68 }
69
70 function run_test_2() {
71 AddonManager.checkCompatibility = false;
72
73 restartManager();
74
75 AddonManager.getAddonsByIDs(["bug470377_1@tests.mozilla.org",
76 "bug470377_2@tests.mozilla.org",
77 "bug470377_3@tests.mozilla.org",
78 "bug470377_4@tests.mozilla.org",
79 "bug470377_5@tests.mozilla.org"],
80 function([a1, a2, a3, a4, a5]) {
81 do_check_neq(a1, null);
82 do_check_false(a1.isActive);
83 do_check_neq(a2, null);
84 do_check_true(a2.isActive);
85 do_check_neq(a3, null);
86 do_check_true(a3.isActive);
87 do_check_neq(a4, null);
88 do_check_true(a4.isActive);
89 do_check_neq(a5, null);
90 do_check_true(a5.isActive);
91
92 do_execute_soon(do_test_finished);
93 });
94 }

mercurial