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

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:17376161da29
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 Services.prefs.setBoolPref(PREF_EM_STRICT_COMPATIBILITY, false);
7
8 function run_test() {
9 do_test_pending();
10 createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2.2.3", "2");
11
12 // inject the add-ons into the profile
13 var dest = gProfD.clone();
14 dest.append("extensions");
15 dest.append("bug470377_1@tests.mozilla.org");
16 dest.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755);
17 var source = do_get_file("data/test_bug470377/install_1.rdf");
18 source.copyTo(dest, "install.rdf");
19 dest = gProfD.clone();
20 dest.append("extensions");
21 dest.append("bug470377_2@tests.mozilla.org");
22 dest.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755);
23 source = do_get_file("data/test_bug470377/install_2.rdf");
24 source.copyTo(dest, "install.rdf");
25 dest = gProfD.clone();
26 dest.append("extensions");
27 dest.append("bug470377_3@tests.mozilla.org");
28 dest.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755);
29 source = do_get_file("data/test_bug470377/install_3.rdf");
30 source.copyTo(dest, "install.rdf");
31 dest = gProfD.clone();
32 dest.append("extensions");
33 dest.append("bug470377_4@tests.mozilla.org");
34 dest.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755);
35 source = do_get_file("data/test_bug470377/install_4.rdf");
36 source.copyTo(dest, "install.rdf");
37 dest = gProfD.clone();
38 dest.append("extensions");
39 dest.append("bug470377_5@tests.mozilla.org");
40 dest.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755);
41 source = do_get_file("data/test_bug470377/install_5.rdf");
42 source.copyTo(dest, "install.rdf");
43
44 startupManager();
45
46 run_test_1();
47 }
48
49 function run_test_1() {
50 AddonManager.getAddonsByIDs(["bug470377_1@tests.mozilla.org",
51 "bug470377_2@tests.mozilla.org",
52 "bug470377_3@tests.mozilla.org",
53 "bug470377_4@tests.mozilla.org",
54 "bug470377_5@tests.mozilla.org"],
55 function([a1, a2, a3, a4, a5]) {
56 do_check_neq(a1, null);
57 do_check_false(a1.isActive);
58 do_check_neq(a2, null);
59 do_check_true(a2.isActive);
60 do_check_neq(a3, null);
61 do_check_true(a3.isActive);
62 do_check_neq(a4, null);
63 do_check_true(a4.isActive);
64 do_check_neq(a5, null);
65 do_check_true(a5.isActive);
66
67 do_execute_soon(run_test_2);
68 });
69 }
70
71 function run_test_2() {
72 AddonManager.checkCompatibility = false;
73
74 restartManager();
75
76 AddonManager.getAddonsByIDs(["bug470377_1@tests.mozilla.org",
77 "bug470377_2@tests.mozilla.org",
78 "bug470377_3@tests.mozilla.org",
79 "bug470377_4@tests.mozilla.org",
80 "bug470377_5@tests.mozilla.org"],
81 function([a1, a2, a3, a4, a5]) {
82 do_check_neq(a1, null);
83 do_check_false(a1.isActive);
84 do_check_neq(a2, null);
85 do_check_true(a2.isActive);
86 do_check_neq(a3, null);
87 do_check_true(a3.isActive);
88 do_check_neq(a4, null);
89 do_check_true(a4.isActive);
90 do_check_neq(a5, null);
91 do_check_true(a5.isActive);
92
93 do_execute_soon(do_test_finished);
94 });
95 }

mercurial