From 05770ad59e6b3fb041a074141d433a68159a4139 Mon Sep 17 00:00:00 2001 From: Frank Yan Date: Fri, 19 Oct 2012 04:15:25 -0700 Subject: [PATCH] Bug 619652 - Display plugin file and mime types in Add-ons Manager. Part 2: Test. r=Unfocused --- .../extensions/test/browser/Makefile.in | 1 + .../test/browser/browser_pluginprefs.js | 59 +++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 toolkit/mozapps/extensions/test/browser/browser_pluginprefs.js diff --git a/toolkit/mozapps/extensions/test/browser/Makefile.in b/toolkit/mozapps/extensions/test/browser/Makefile.in index 658f0b49469b..b569bedaed0c 100644 --- a/toolkit/mozapps/extensions/test/browser/Makefile.in +++ b/toolkit/mozapps/extensions/test/browser/Makefile.in @@ -59,6 +59,7 @@ MOCHITEST_BROWSER_MAIN = \ browser_types.js \ browser_inlinesettings.js \ browser_tabsettings.js \ + browser_pluginprefs.js \ $(NULL) MOCHITEST_BROWSER_SECONDARY = \ diff --git a/toolkit/mozapps/extensions/test/browser/browser_pluginprefs.js b/toolkit/mozapps/extensions/test/browser/browser_pluginprefs.js new file mode 100644 index 000000000000..dc0262eb9956 --- /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(); + }); + }); + }); +});