diff options
author | Matt A. Tobin <email@mattatobin.com> | 2018-02-10 02:49:12 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2018-02-10 02:49:12 -0500 |
commit | 4fb11cd5966461bccc3ed1599b808237be6b0de9 (patch) | |
tree | d7f0ccd49cebb3544d52635ff1bd6ed4d763823f /toolkit/mozapps/webextensions/test/browser/browser_sorting_plugins.js | |
parent | f164d9124708b50789dbb6959e1de96cc5697c48 (diff) | |
download | UXP-4fb11cd5966461bccc3ed1599b808237be6b0de9.tar UXP-4fb11cd5966461bccc3ed1599b808237be6b0de9.tar.gz UXP-4fb11cd5966461bccc3ed1599b808237be6b0de9.tar.lz UXP-4fb11cd5966461bccc3ed1599b808237be6b0de9.tar.xz UXP-4fb11cd5966461bccc3ed1599b808237be6b0de9.zip |
Move WebExtensions enabled Add-ons Manager
Diffstat (limited to 'toolkit/mozapps/webextensions/test/browser/browser_sorting_plugins.js')
-rw-r--r-- | toolkit/mozapps/webextensions/test/browser/browser_sorting_plugins.js | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/toolkit/mozapps/webextensions/test/browser/browser_sorting_plugins.js b/toolkit/mozapps/webextensions/test/browser/browser_sorting_plugins.js new file mode 100644 index 000000000..2bb6b4ba4 --- /dev/null +++ b/toolkit/mozapps/webextensions/test/browser/browser_sorting_plugins.js @@ -0,0 +1,95 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +// Tests that sorting of plugins works correctly +// (this test checks that plugins with "ask to activate" state appear after those with +// "always activate" and before those with "never activate") + +var gManagerWindow; +var gProvider; + +function test() { + waitForExplicitFinish(); + + gProvider = new MockProvider(); + gProvider.createAddons([{ + // enabledInstalled group + // * Always activate + // * Ask to activate + // * Never activate + id: "test1@tests.mozilla.org", + name: "Java Applet Plug-in Java 7 Update 51", + description: "foo", + type: "plugin", + isActive: true, + userDisabled: AddonManager.STATE_ASK_TO_ACTIVATE + }, { + id: "test2@tests.mozilla.org", + name: "Quick Time Plug-in", + description: "foo", + type: "plugin", + isActive: true, + userDisabled: false + }, { + id: "test3@tests.mozilla.org", + name: "Shockwave Flash", + description: "foo", + type: "plugin", + isActive: false, + userDisabled: true + }, { + id: "test4@tests.mozilla.org", + name: "Adobe Reader Plug-in", + description: "foo", + type: "plugin", + isActive: true, + userDisabled: AddonManager.STATE_ASK_TO_ACTIVATE + }, { + id: "test5@tests.mozilla.org", + name: "3rd Party Plug-in", + description: "foo", + type: "plugin", + isActive: true, + userDisabled: false + }]); + + open_manager("addons://list/plugin", function(aWindow) { + gManagerWindow = aWindow; + run_next_test(); + }); +} + +function end_test() { + close_manager(gManagerWindow, function() { + finish(); + }); +} + +function check_order(aExpectedOrder) { + var order = []; + var list = gManagerWindow.document.getElementById("addon-list"); + var node = list.firstChild; + while (node) { + var id = node.getAttribute("value"); + if (id && id.endsWith("@tests.mozilla.org")) + order.push(node.getAttribute("value")); + node = node.nextSibling; + } + + is(order.toSource(), aExpectedOrder.toSource(), "Should have seen the right order"); +} + +// Tests that ascending name ordering was the default +add_test(function() { + + check_order([ + "test5@tests.mozilla.org", + "test2@tests.mozilla.org", + "test4@tests.mozilla.org", + "test1@tests.mozilla.org", + "test3@tests.mozilla.org" + ]); + + run_next_test(); +}); |