|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 * http://creativecommons.org/publicdomain/zero/1.0/ |
|
3 */ |
|
4 |
|
5 // Tests detection of binary components via parsing of chrome manifests. |
|
6 |
|
7 const profileDir = gProfD.clone(); |
|
8 profileDir.append("extensions"); |
|
9 |
|
10 function run_test() { |
|
11 do_test_pending(); |
|
12 createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2", "2"); |
|
13 |
|
14 startupManager(); |
|
15 |
|
16 installAllFiles([do_get_addon("test_chromemanifest_1"), |
|
17 do_get_addon("test_chromemanifest_2"), |
|
18 do_get_addon("test_chromemanifest_3"), |
|
19 do_get_addon("test_chromemanifest_4"), |
|
20 do_get_addon("test_chromemanifest_5")], |
|
21 function() { |
|
22 |
|
23 restartManager(); |
|
24 |
|
25 AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org", |
|
26 "addon2@tests.mozilla.org", |
|
27 "addon3@tests.mozilla.org", |
|
28 "addon4@tests.mozilla.org", |
|
29 "addon5@tests.mozilla.org"], |
|
30 function([a1, a2, a3, a4, a5]) { |
|
31 // addon1 has no binary components |
|
32 do_check_neq(a1, null); |
|
33 do_check_false(a1.userDisabled); |
|
34 do_check_false(a1.hasBinaryComponents); |
|
35 do_check_true(a1.isCompatible); |
|
36 do_check_false(a1.appDisabled); |
|
37 do_check_true(a1.isActive); |
|
38 do_check_true(isExtensionInAddonsList(profileDir, a1.id)); |
|
39 |
|
40 // addon2 has a binary component, is compatible |
|
41 do_check_neq(a2, null); |
|
42 do_check_false(a2.userDisabled); |
|
43 do_check_true(a2.hasBinaryComponents); |
|
44 do_check_true(a2.isCompatible); |
|
45 do_check_false(a2.appDisabled); |
|
46 do_check_true(a2.isActive); |
|
47 do_check_true(isExtensionInAddonsList(profileDir, a2.id)); |
|
48 |
|
49 // addon3 has a binary component, is incompatible |
|
50 do_check_neq(a3, null); |
|
51 do_check_false(a3.userDisabled); |
|
52 do_check_true(a2.hasBinaryComponents); |
|
53 do_check_false(a3.isCompatible); |
|
54 do_check_true(a3.appDisabled); |
|
55 do_check_false(a3.isActive); |
|
56 do_check_false(isExtensionInAddonsList(profileDir, a3.id)); |
|
57 |
|
58 // addon4 has a binary component listed in a sub-manifest, is incompatible |
|
59 do_check_neq(a4, null); |
|
60 do_check_false(a4.userDisabled); |
|
61 do_check_true(a2.hasBinaryComponents); |
|
62 do_check_false(a4.isCompatible); |
|
63 do_check_true(a4.appDisabled); |
|
64 do_check_false(a4.isActive); |
|
65 do_check_false(isExtensionInAddonsList(profileDir, a4.id)); |
|
66 |
|
67 // addon5 has a binary component, but is set to not unpack |
|
68 do_check_neq(a5, null); |
|
69 do_check_false(a5.userDisabled); |
|
70 if (TEST_UNPACKED) |
|
71 do_check_true(a5.hasBinaryComponents); |
|
72 else |
|
73 do_check_false(a5.hasBinaryComponents); |
|
74 do_check_true(a5.isCompatible); |
|
75 do_check_false(a5.appDisabled); |
|
76 do_check_true(a5.isActive); |
|
77 do_check_true(isExtensionInAddonsList(profileDir, a5.id)); |
|
78 |
|
79 do_execute_soon(do_test_finished); |
|
80 }); |
|
81 }); |
|
82 } |