diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /toolkit/mozapps/extensions/test/browser/browser_bug573062.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'toolkit/mozapps/extensions/test/browser/browser_bug573062.js')
-rw-r--r-- | toolkit/mozapps/extensions/test/browser/browser_bug573062.js | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/toolkit/mozapps/extensions/test/browser/browser_bug573062.js b/toolkit/mozapps/extensions/test/browser/browser_bug573062.js new file mode 100644 index 000000000..6554451fb --- /dev/null +++ b/toolkit/mozapps/extensions/test/browser/browser_bug573062.js @@ -0,0 +1,116 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +function test() { + waitForExplicitFinish(); + + var gProvider = new MockProvider(); + let perms = AddonManager.PERM_CAN_UNINSTALL | + AddonManager.PERM_CAN_ENABLE | AddonManager.PERM_CAN_DISABLE; + + gProvider.createAddons([{ + id: "restart-enable-disable@tests.mozilla.org", + name: "restart-enable-disable", + description: "foo", + permissions: perms, + operationsRequiringRestart: AddonManager.OP_NEEDS_RESTART_ENABLE | + AddonManager.OP_NEEDS_RESTART_DISABLE + }, + { + id: "restart-uninstall@tests.mozilla.org", + name: "restart-uninstall", + description: "foo", + permissions: perms, + operationsRequiringRestart: AddonManager.OP_NEEDS_RESTART_UNINSTALL + }, + { + id: "no-restart-required@tests.mozilla.org", + name: "no-restart-required", + description: "bar", + permissions: perms, + operationsRequiringRestart: AddonManager.OP_NEEDS_RESTART_NONE + }]); + + open_manager("addons://list/extension", function(aWindow) { + let addonList = aWindow.document.getElementById("addon-list"); + let ed_r_Item, un_r_Item, no_r_Item; + for (let addonItem of addonList.childNodes) { + let name = addonItem.getAttribute("name"); + switch (name) { + case "restart-enable-disable": + ed_r_Item = addonItem; + break; + case "restart-uninstall": + un_r_Item = addonItem; + break; + case "no-restart-required": + no_r_Item = addonItem; + break; + } + } + + // Check the buttons in the list view. + function checkTooltips(aItem, aEnable, aDisable, aRemove) { + is(aItem._enableBtn.getAttribute("tooltiptext"), aEnable); + is(aItem._disableBtn.getAttribute("tooltiptext"), aDisable); + is(aItem._removeBtn.getAttribute("tooltiptext"), aRemove); + } + + let strs = aWindow.gStrings.ext; + addonList.selectedItem = ed_r_Item; + let ed_args = [ed_r_Item, + strs.GetStringFromName("enableAddonRestartRequiredTooltip"), + strs.GetStringFromName("disableAddonRestartRequiredTooltip"), + strs.GetStringFromName("uninstallAddonTooltip")]; + checkTooltips.apply(null, ed_args); + + addonList.selectedItem = un_r_Item; + let un_args = [un_r_Item, + strs.GetStringFromName("enableAddonTooltip"), + strs.GetStringFromName("disableAddonTooltip"), + strs.GetStringFromName("uninstallAddonRestartRequiredTooltip")]; + checkTooltips.apply(null, un_args); + + addonList.selectedItem = no_r_Item; + let no_args = [no_r_Item, + strs.GetStringFromName("enableAddonTooltip"), + strs.GetStringFromName("disableAddonTooltip"), + strs.GetStringFromName("uninstallAddonTooltip")]; + checkTooltips.apply(null, no_args); + + // Check the buttons in the details view. + function checkTooltips2(aItem, aEnable, aDisable, aRemove) { + let detailEnable = aWindow.document.getElementById("detail-enable-btn"); + let detailDisable = aWindow.document.getElementById("detail-disable-btn"); + let detailUninstall = aWindow.document.getElementById("detail-uninstall-btn"); + ok(detailEnable.getAttribute("tooltiptext") == aEnable); + ok(detailDisable.getAttribute("tooltiptext") == aDisable); + ok(detailUninstall.getAttribute("tooltiptext") == aRemove); + } + + function showInDetailView(aAddonId) { + aWindow.gViewController.loadView("addons://detail/" + + aWindow.encodeURIComponent(aAddonId)); + } + + // enable-disable: + showInDetailView("restart-enable-disable@tests.mozilla.org"); + wait_for_view_load(aWindow, function() { + checkTooltips2.apply(null, ed_args); + // uninstall: + showInDetailView("restart-uninstall@tests.mozilla.org"); + wait_for_view_load(aWindow, function() { + checkTooltips2.apply(null, un_args); + // no restart: + showInDetailView("no-restart-required@tests.mozilla.org"); + wait_for_view_load(aWindow, function() { + checkTooltips2.apply(null, no_args); + aWindow.close(); + finish(); + }); + }); + }); + + }); +} |