michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ michael@0: */ michael@0: michael@0: // Tests detection of binary components via parsing of chrome manifests. michael@0: michael@0: const profileDir = gProfD.clone(); michael@0: profileDir.append("extensions"); michael@0: michael@0: function run_test() { michael@0: do_test_pending(); michael@0: createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2", "2"); michael@0: michael@0: startupManager(); michael@0: michael@0: installAllFiles([do_get_addon("test_chromemanifest_1"), michael@0: do_get_addon("test_chromemanifest_2"), michael@0: do_get_addon("test_chromemanifest_3"), michael@0: do_get_addon("test_chromemanifest_4"), michael@0: do_get_addon("test_chromemanifest_5")], michael@0: function() { michael@0: michael@0: restartManager(); michael@0: michael@0: AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org", michael@0: "addon2@tests.mozilla.org", michael@0: "addon3@tests.mozilla.org", michael@0: "addon4@tests.mozilla.org", michael@0: "addon5@tests.mozilla.org"], michael@0: function([a1, a2, a3, a4, a5]) { michael@0: // addon1 has no binary components michael@0: do_check_neq(a1, null); michael@0: do_check_false(a1.userDisabled); michael@0: do_check_false(a1.hasBinaryComponents); michael@0: do_check_true(a1.isCompatible); michael@0: do_check_false(a1.appDisabled); michael@0: do_check_true(a1.isActive); michael@0: do_check_true(isExtensionInAddonsList(profileDir, a1.id)); michael@0: michael@0: // addon2 has a binary component, is compatible michael@0: do_check_neq(a2, null); michael@0: do_check_false(a2.userDisabled); michael@0: do_check_true(a2.hasBinaryComponents); michael@0: do_check_true(a2.isCompatible); michael@0: do_check_false(a2.appDisabled); michael@0: do_check_true(a2.isActive); michael@0: do_check_true(isExtensionInAddonsList(profileDir, a2.id)); michael@0: michael@0: // addon3 has a binary component, is incompatible michael@0: do_check_neq(a3, null); michael@0: do_check_false(a3.userDisabled); michael@0: do_check_true(a2.hasBinaryComponents); michael@0: do_check_false(a3.isCompatible); michael@0: do_check_true(a3.appDisabled); michael@0: do_check_false(a3.isActive); michael@0: do_check_false(isExtensionInAddonsList(profileDir, a3.id)); michael@0: michael@0: // addon4 has a binary component listed in a sub-manifest, is incompatible michael@0: do_check_neq(a4, null); michael@0: do_check_false(a4.userDisabled); michael@0: do_check_true(a2.hasBinaryComponents); michael@0: do_check_false(a4.isCompatible); michael@0: do_check_true(a4.appDisabled); michael@0: do_check_false(a4.isActive); michael@0: do_check_false(isExtensionInAddonsList(profileDir, a4.id)); michael@0: michael@0: // addon5 has a binary component, but is set to not unpack michael@0: do_check_neq(a5, null); michael@0: do_check_false(a5.userDisabled); michael@0: if (TEST_UNPACKED) michael@0: do_check_true(a5.hasBinaryComponents); michael@0: else michael@0: do_check_false(a5.hasBinaryComponents); michael@0: do_check_true(a5.isCompatible); michael@0: do_check_false(a5.appDisabled); michael@0: do_check_true(a5.isActive); michael@0: do_check_true(isExtensionInAddonsList(profileDir, a5.id)); michael@0: michael@0: do_execute_soon(do_test_finished); michael@0: }); michael@0: }); michael@0: }