Bug 619652 - Display plugin file and mime types in Add-ons Manager. Part 2: Test. r=Unfocused
authorFrank Yan <fyan@mozilla.com>
Fri, 19 Oct 2012 04:15:25 -0700
changeset 110763 907385f76803514ac59444775177f9d059d9d77a
parent 110762 81e812a83e9becc5e8c3cc66d92a2e33fd312e2b
child 110764 57431b8b1ae93bd42fcac9ea1bc3317c1bedd87b
push id23716
push userryanvm@gmail.com
push dateSat, 20 Oct 2012 01:43:16 +0000
treeherdermozilla-central@ff4af83233dc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersUnfocused
bugs619652
milestone19.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 619652 - Display plugin file and mime types in Add-ons Manager. Part 2: Test. r=Unfocused
toolkit/mozapps/extensions/test/browser/Makefile.in
toolkit/mozapps/extensions/test/browser/browser_pluginprefs.js
--- a/toolkit/mozapps/extensions/test/browser/Makefile.in
+++ b/toolkit/mozapps/extensions/test/browser/Makefile.in
@@ -54,16 +54,17 @@ MOCHITEST_BROWSER_MAIN = \
   browser_globalinformations.js \
   browser_eula.js \
   browser_updateid.js \
   browser_purchase.js \
   browser_openDialog.js \
   browser_types.js \
   browser_inlinesettings.js \
   browser_tabsettings.js \
+  browser_pluginprefs.js \
   $(NULL)
 
 MOCHITEST_BROWSER_SECONDARY = \
   head.js \
   browser_addonrepository_performance.js \
   browser_bug557956.js \
   browser_bug616841.js \
   browser_checkAddonCompatibility.js \
new file mode 100644
--- /dev/null
+++ b/toolkit/mozapps/extensions/test/browser/browser_pluginprefs.js
@@ -0,0 +1,59 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+// Tests the detail view of plugins
+
+var gManagerWindow;
+
+function test() {
+  waitForExplicitFinish();
+
+  open_manager("addons://list/plugin", function(aWindow) {
+    gManagerWindow = aWindow;
+
+    run_next_test();
+  });
+}
+
+function end_test() {
+  close_manager(gManagerWindow, function() {
+    finish();
+  });
+}
+
+add_test(function() {
+  AddonManager.getAddonsByTypes(["plugin"], function(plugins) {
+    let testPluginId;
+    for (let plugin of plugins) {
+      if (plugin.name == "Test Plug-in") {
+        testPluginId = plugin.id;
+        break;
+      }
+    }
+    ok(testPluginId, "Test Plug-in should exist")
+
+    AddonManager.getAddonByID(testPluginId, function(testPlugin) {
+      let pluginEl = get_addon_element(gManagerWindow, testPluginId);
+      is(pluginEl.mAddon.optionsType, AddonManager.OPTIONS_TYPE_INLINE, "Options should be inline type");
+      pluginEl.parentNode.ensureElementIsVisible(pluginEl);
+
+      let button = gManagerWindow.document.getAnonymousElementByAttribute(pluginEl, "anonid", "preferences-btn");
+      is_element_visible(button, "Preferences button should be visible");
+      EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
+
+      wait_for_view_load(gManagerWindow, function() {
+        let pluginLibraries = gManagerWindow.document.getElementById("pluginLibraries");
+        ok(pluginLibraries, "Plugin file name row should be displayed");
+        // the file name depends on the platform
+        ok(pluginLibraries.textContent, testPlugin.pluginLibraries, "Plugin file name should be displayed");
+
+        let pluginMimeTypes = gManagerWindow.document.getElementById("pluginMimeTypes");
+        ok(pluginMimeTypes, "Plugin mime type row should be displayed");
+        ok(pluginMimeTypes.textContent, "application/x-test (tst)", "Plugin mime type should be displayed");
+
+        run_next_test();
+      });
+    });
+  });
+});