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