summaryrefslogtreecommitdiffstats
path: root/toolkit/mozapps/extensions/test/browser/browser_sorting_plugins.js
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2018-02-11 07:03:16 -0500
committerMatt A. Tobin <email@mattatobin.com>2018-02-11 07:03:16 -0500
commit203eb0f61a09372310a2a8fb57e169cb3f47800b (patch)
tree8490329d3dae4de3c7ffd127bce1f65fdc009abd /toolkit/mozapps/extensions/test/browser/browser_sorting_plugins.js
parente45706ca3acbb6530419433212becc61d5953a2d (diff)
parent8f6d3dab81c7f8f97ef197e26ab9439b09735b8f (diff)
downloadUXP-FF_Checkpoint_1.tar
UXP-FF_Checkpoint_1.tar.gz
UXP-FF_Checkpoint_1.tar.lz
UXP-FF_Checkpoint_1.tar.xz
UXP-FF_Checkpoint_1.zip
Merge branch 'ext-work'FF_Checkpoint_1
Diffstat (limited to 'toolkit/mozapps/extensions/test/browser/browser_sorting_plugins.js')
-rw-r--r--toolkit/mozapps/extensions/test/browser/browser_sorting_plugins.js95
1 files changed, 95 insertions, 0 deletions
diff --git a/toolkit/mozapps/extensions/test/browser/browser_sorting_plugins.js b/toolkit/mozapps/extensions/test/browser/browser_sorting_plugins.js
new file mode 100644
index 000000000..2bb6b4ba4
--- /dev/null
+++ b/toolkit/mozapps/extensions/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();
+});