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