1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/mozapps/extensions/test/browser/browser_pluginprefs.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,61 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + * http://creativecommons.org/publicdomain/zero/1.0/ 1.6 + */ 1.7 + 1.8 +// Tests the detail view of plugins 1.9 + 1.10 +var gManagerWindow; 1.11 + 1.12 +function test() { 1.13 + waitForExplicitFinish(); 1.14 + 1.15 + open_manager("addons://list/plugin", function(aWindow) { 1.16 + gManagerWindow = aWindow; 1.17 + 1.18 + run_next_test(); 1.19 + }); 1.20 +} 1.21 + 1.22 +function end_test() { 1.23 + close_manager(gManagerWindow, function() { 1.24 + finish(); 1.25 + }); 1.26 +} 1.27 + 1.28 +add_test(function() { 1.29 + AddonManager.getAddonsByTypes(["plugin"], function(plugins) { 1.30 + let testPluginId; 1.31 + for (let plugin of plugins) { 1.32 + if (plugin.name == "Test Plug-in") { 1.33 + testPluginId = plugin.id; 1.34 + break; 1.35 + } 1.36 + } 1.37 + ok(testPluginId, "Test Plug-in should exist") 1.38 + 1.39 + AddonManager.getAddonByID(testPluginId, function(testPlugin) { 1.40 + let pluginEl = get_addon_element(gManagerWindow, testPluginId); 1.41 + is(pluginEl.mAddon.optionsType, AddonManager.OPTIONS_TYPE_INLINE_INFO, "Options should be inline info type"); 1.42 + pluginEl.parentNode.ensureElementIsVisible(pluginEl); 1.43 + 1.44 + let button = gManagerWindow.document.getAnonymousElementByAttribute(pluginEl, "anonid", "preferences-btn"); 1.45 + is_element_hidden(button, "Preferences button should be hidden"); 1.46 + 1.47 + button = gManagerWindow.document.getAnonymousElementByAttribute(pluginEl, "anonid", "details-btn"); 1.48 + EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow); 1.49 + 1.50 + wait_for_view_load(gManagerWindow, function() { 1.51 + let pluginLibraries = gManagerWindow.document.getElementById("pluginLibraries"); 1.52 + ok(pluginLibraries, "Plugin file name row should be displayed"); 1.53 + // the file name depends on the platform 1.54 + ok(pluginLibraries.textContent, testPlugin.pluginLibraries, "Plugin file name should be displayed"); 1.55 + 1.56 + let pluginMimeTypes = gManagerWindow.document.getElementById("pluginMimeTypes"); 1.57 + ok(pluginMimeTypes, "Plugin mime type row should be displayed"); 1.58 + ok(pluginMimeTypes.textContent, "application/x-test (tst)", "Plugin mime type should be displayed"); 1.59 + 1.60 + run_next_test(); 1.61 + }); 1.62 + }); 1.63 + }); 1.64 +});