diff options
author | Matt A. Tobin <email@mattatobin.com> | 2018-06-26 16:09:08 -0400 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2018-06-26 16:09:08 -0400 |
commit | eda567b364a06e9e63efb865a6b1c73f1cb5232e (patch) | |
tree | 912ab15d877f733318e2c0394713bca33b830547 /toolkit/mozapps/extensions/test/xpcshell/test_bug563256.js | |
parent | 80eb356d57fc310cdf812cae63de30d6e56c1788 (diff) | |
download | UXP-eda567b364a06e9e63efb865a6b1c73f1cb5232e.tar UXP-eda567b364a06e9e63efb865a6b1c73f1cb5232e.tar.gz UXP-eda567b364a06e9e63efb865a6b1c73f1cb5232e.tar.lz UXP-eda567b364a06e9e63efb865a6b1c73f1cb5232e.tar.xz UXP-eda567b364a06e9e63efb865a6b1c73f1cb5232e.zip |
[AllAM] Remove Mozilla Tests
Diffstat (limited to 'toolkit/mozapps/extensions/test/xpcshell/test_bug563256.js')
-rw-r--r-- | toolkit/mozapps/extensions/test/xpcshell/test_bug563256.js | 259 |
1 files changed, 0 insertions, 259 deletions
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug563256.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug563256.js deleted file mode 100644 index 2437cf748..000000000 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug563256.js +++ /dev/null @@ -1,259 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -// This verifies that the themes switch as expected - -const PREF_GENERAL_SKINS_SELECTEDSKIN = "general.skins.selectedSkin"; - -const profileDir = gProfD.clone(); -profileDir.append("extensions"); - -function run_test() { - do_test_pending(); - createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); - - writeInstallRDFForExtension({ - id: "default@tests.mozilla.org", - version: "1.0", - name: "Default", - internalName: "classic/1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "2" - }] - }, profileDir); - - writeInstallRDFForExtension({ - id: "alternate@tests.mozilla.org", - version: "1.0", - name: "Test 1", - type: 4, - internalName: "alternate/1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "2" - }] - }, profileDir); - - startupManager(); - - do_check_eq(Services.prefs.getCharPref(PREF_GENERAL_SKINS_SELECTEDSKIN), "classic/1.0"); - - AddonManager.getAddonsByIDs(["default@tests.mozilla.org", - "alternate@tests.mozilla.org"], function([d, a]) { - do_check_neq(d, null); - do_check_false(d.userDisabled); - do_check_false(d.appDisabled); - do_check_true(d.isActive); - do_check_true(isThemeInAddonsList(profileDir, d.id)); - do_check_false(hasFlag(d.permissions, AddonManager.PERM_CAN_DISABLE)); - do_check_false(hasFlag(d.permissions, AddonManager.PERM_CAN_ENABLE)); - - do_check_neq(a, null); - do_check_true(a.userDisabled); - do_check_false(a.appDisabled); - do_check_false(a.isActive); - do_check_false(isThemeInAddonsList(profileDir, a.id)); - do_check_false(hasFlag(a.permissions, AddonManager.PERM_CAN_DISABLE)); - do_check_true(hasFlag(a.permissions, AddonManager.PERM_CAN_ENABLE)); - - run_test_1(d, a); - }); -} - -function end_test() { - do_execute_soon(do_test_finished); -} - -// Checks switching to a different theme and back again leaves everything the -// same -function run_test_1(d, a) { - a.userDisabled = false; - - do_check_true(d.userDisabled); - do_check_false(d.appDisabled); - do_check_true(d.isActive); - do_check_true(isThemeInAddonsList(profileDir, d.id)); - do_check_false(hasFlag(d.permissions, AddonManager.PERM_CAN_DISABLE)); - do_check_true(hasFlag(d.permissions, AddonManager.PERM_CAN_ENABLE)); - - do_check_false(a.userDisabled); - do_check_false(a.appDisabled); - do_check_false(a.isActive); - do_check_false(isThemeInAddonsList(profileDir, a.id)); - do_check_false(hasFlag(a.permissions, AddonManager.PERM_CAN_DISABLE)); - do_check_false(hasFlag(a.permissions, AddonManager.PERM_CAN_ENABLE)); - - do_check_eq(Services.prefs.getCharPref(PREF_GENERAL_SKINS_SELECTEDSKIN), "classic/1.0"); - - d.userDisabled = false; - - do_check_false(d.userDisabled); - do_check_false(d.appDisabled); - do_check_true(d.isActive); - do_check_true(isThemeInAddonsList(profileDir, d.id)); - do_check_false(hasFlag(d.permissions, AddonManager.PERM_CAN_DISABLE)); - do_check_false(hasFlag(d.permissions, AddonManager.PERM_CAN_ENABLE)); - - do_check_true(a.userDisabled); - do_check_false(a.appDisabled); - do_check_false(a.isActive); - do_check_false(isThemeInAddonsList(profileDir, a.id)); - do_check_false(hasFlag(a.permissions, AddonManager.PERM_CAN_DISABLE)); - do_check_true(hasFlag(a.permissions, AddonManager.PERM_CAN_ENABLE)); - - do_check_eq(Services.prefs.getCharPref(PREF_GENERAL_SKINS_SELECTEDSKIN), "classic/1.0"); - - do_execute_soon(run_test_2); -} - -// Tests that after the restart themes can be changed as expected -function run_test_2() { - restartManager(); - AddonManager.getAddonsByIDs(["default@tests.mozilla.org", - "alternate@tests.mozilla.org"], function([d, a]) { - do_check_eq(Services.prefs.getCharPref(PREF_GENERAL_SKINS_SELECTEDSKIN), "classic/1.0"); - - do_check_neq(d, null); - do_check_false(d.userDisabled); - do_check_false(d.appDisabled); - do_check_true(d.isActive); - do_check_true(isThemeInAddonsList(profileDir, d.id)); - do_check_false(hasFlag(d.permissions, AddonManager.PERM_CAN_DISABLE)); - do_check_false(hasFlag(d.permissions, AddonManager.PERM_CAN_ENABLE)); - - do_check_neq(a, null); - do_check_true(a.userDisabled); - do_check_false(a.appDisabled); - do_check_false(a.isActive); - do_check_false(isThemeInAddonsList(profileDir, a.id)); - do_check_false(hasFlag(a.permissions, AddonManager.PERM_CAN_DISABLE)); - do_check_true(hasFlag(a.permissions, AddonManager.PERM_CAN_ENABLE)); - - do_check_eq(Services.prefs.getCharPref(PREF_GENERAL_SKINS_SELECTEDSKIN), "classic/1.0"); - - a.userDisabled = false; - - do_check_true(d.userDisabled); - do_check_false(d.appDisabled); - do_check_true(d.isActive); - do_check_true(isThemeInAddonsList(profileDir, d.id)); - do_check_false(hasFlag(d.permissions, AddonManager.PERM_CAN_DISABLE)); - do_check_true(hasFlag(d.permissions, AddonManager.PERM_CAN_ENABLE)); - - do_check_false(a.userDisabled); - do_check_false(a.appDisabled); - do_check_false(a.isActive); - do_check_false(isThemeInAddonsList(profileDir, a.id)); - do_check_false(hasFlag(a.permissions, AddonManager.PERM_CAN_DISABLE)); - do_check_false(hasFlag(a.permissions, AddonManager.PERM_CAN_ENABLE)); - - do_check_eq(Services.prefs.getCharPref(PREF_GENERAL_SKINS_SELECTEDSKIN), "classic/1.0"); - - d.userDisabled = false; - - do_check_false(d.userDisabled); - do_check_false(d.appDisabled); - do_check_true(d.isActive); - do_check_true(isThemeInAddonsList(profileDir, d.id)); - do_check_false(hasFlag(d.permissions, AddonManager.PERM_CAN_DISABLE)); - do_check_false(hasFlag(d.permissions, AddonManager.PERM_CAN_ENABLE)); - - do_check_true(a.userDisabled); - do_check_false(a.appDisabled); - do_check_false(a.isActive); - do_check_false(isThemeInAddonsList(profileDir, a.id)); - do_check_false(hasFlag(a.permissions, AddonManager.PERM_CAN_DISABLE)); - do_check_true(hasFlag(a.permissions, AddonManager.PERM_CAN_ENABLE)); - - do_check_eq(Services.prefs.getCharPref(PREF_GENERAL_SKINS_SELECTEDSKIN), "classic/1.0"); - - a.userDisabled = false; - - do_check_true(d.userDisabled); - do_check_false(d.appDisabled); - do_check_true(d.isActive); - do_check_true(isThemeInAddonsList(profileDir, d.id)); - do_check_false(hasFlag(d.permissions, AddonManager.PERM_CAN_DISABLE)); - do_check_true(hasFlag(d.permissions, AddonManager.PERM_CAN_ENABLE)); - - do_check_false(a.userDisabled); - do_check_false(a.appDisabled); - do_check_false(a.isActive); - do_check_false(isThemeInAddonsList(profileDir, a.id)); - do_check_false(hasFlag(a.permissions, AddonManager.PERM_CAN_DISABLE)); - do_check_false(hasFlag(a.permissions, AddonManager.PERM_CAN_ENABLE)); - - do_check_eq(Services.prefs.getCharPref(PREF_GENERAL_SKINS_SELECTEDSKIN), "classic/1.0"); - - do_execute_soon(check_test_2); - }); -} - -function check_test_2() { - restartManager(); - AddonManager.getAddonsByIDs(["default@tests.mozilla.org", - "alternate@tests.mozilla.org"], callback_soon(function([d, a]) { - do_check_eq(Services.prefs.getCharPref(PREF_GENERAL_SKINS_SELECTEDSKIN), "alternate/1.0"); - - do_check_true(d.userDisabled); - do_check_false(d.appDisabled); - do_check_false(d.isActive); - do_check_false(isThemeInAddonsList(profileDir, d.id)); - do_check_false(hasFlag(d.permissions, AddonManager.PERM_CAN_DISABLE)); - do_check_true(hasFlag(d.permissions, AddonManager.PERM_CAN_ENABLE)); - - do_check_false(a.userDisabled); - do_check_false(a.appDisabled); - do_check_true(a.isActive); - do_check_true(isThemeInAddonsList(profileDir, a.id)); - do_check_false(hasFlag(a.permissions, AddonManager.PERM_CAN_DISABLE)); - do_check_false(hasFlag(a.permissions, AddonManager.PERM_CAN_ENABLE)); - - d.userDisabled = false; - - do_check_false(d.userDisabled); - do_check_false(d.appDisabled); - do_check_false(d.isActive); - do_check_false(isThemeInAddonsList(profileDir, d.id)); - do_check_false(hasFlag(d.permissions, AddonManager.PERM_CAN_DISABLE)); - do_check_false(hasFlag(d.permissions, AddonManager.PERM_CAN_ENABLE)); - - do_check_true(a.userDisabled); - do_check_false(a.appDisabled); - do_check_true(a.isActive); - do_check_true(isThemeInAddonsList(profileDir, a.id)); - do_check_false(hasFlag(a.permissions, AddonManager.PERM_CAN_DISABLE)); - do_check_true(hasFlag(a.permissions, AddonManager.PERM_CAN_ENABLE)); - - do_check_eq(Services.prefs.getCharPref(PREF_GENERAL_SKINS_SELECTEDSKIN), "alternate/1.0"); - - restartManager(); - - do_check_eq(Services.prefs.getCharPref(PREF_GENERAL_SKINS_SELECTEDSKIN), "classic/1.0"); - - AddonManager.getAddonsByIDs(["default@tests.mozilla.org", - "alternate@tests.mozilla.org"], function([d, a]) { - do_check_neq(d, null); - do_check_false(d.userDisabled); - do_check_false(d.appDisabled); - do_check_true(d.isActive); - do_check_true(isThemeInAddonsList(profileDir, d.id)); - do_check_false(hasFlag(d.permissions, AddonManager.PERM_CAN_DISABLE)); - do_check_false(hasFlag(d.permissions, AddonManager.PERM_CAN_ENABLE)); - - do_check_neq(a, null); - do_check_true(a.userDisabled); - do_check_false(a.appDisabled); - do_check_false(a.isActive); - do_check_false(isThemeInAddonsList(profileDir, a.id)); - do_check_false(hasFlag(a.permissions, AddonManager.PERM_CAN_DISABLE)); - do_check_true(hasFlag(a.permissions, AddonManager.PERM_CAN_ENABLE)); - - end_test(); - }); - })); -} |