Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | * http://creativecommons.org/publicdomain/zero/1.0/ |
michael@0 | 3 | */ |
michael@0 | 4 | |
michael@0 | 5 | // Tests the detail view of plugins |
michael@0 | 6 | |
michael@0 | 7 | var gManagerWindow; |
michael@0 | 8 | |
michael@0 | 9 | function test() { |
michael@0 | 10 | waitForExplicitFinish(); |
michael@0 | 11 | |
michael@0 | 12 | open_manager("addons://list/plugin", function(aWindow) { |
michael@0 | 13 | gManagerWindow = aWindow; |
michael@0 | 14 | |
michael@0 | 15 | run_next_test(); |
michael@0 | 16 | }); |
michael@0 | 17 | } |
michael@0 | 18 | |
michael@0 | 19 | function end_test() { |
michael@0 | 20 | close_manager(gManagerWindow, function() { |
michael@0 | 21 | finish(); |
michael@0 | 22 | }); |
michael@0 | 23 | } |
michael@0 | 24 | |
michael@0 | 25 | add_test(function() { |
michael@0 | 26 | AddonManager.getAddonsByTypes(["plugin"], function(plugins) { |
michael@0 | 27 | let testPluginId; |
michael@0 | 28 | for (let plugin of plugins) { |
michael@0 | 29 | if (plugin.name == "Test Plug-in") { |
michael@0 | 30 | testPluginId = plugin.id; |
michael@0 | 31 | break; |
michael@0 | 32 | } |
michael@0 | 33 | } |
michael@0 | 34 | ok(testPluginId, "Test Plug-in should exist") |
michael@0 | 35 | |
michael@0 | 36 | AddonManager.getAddonByID(testPluginId, function(testPlugin) { |
michael@0 | 37 | let pluginEl = get_addon_element(gManagerWindow, testPluginId); |
michael@0 | 38 | is(pluginEl.mAddon.optionsType, AddonManager.OPTIONS_TYPE_INLINE_INFO, "Options should be inline info type"); |
michael@0 | 39 | pluginEl.parentNode.ensureElementIsVisible(pluginEl); |
michael@0 | 40 | |
michael@0 | 41 | let button = gManagerWindow.document.getAnonymousElementByAttribute(pluginEl, "anonid", "preferences-btn"); |
michael@0 | 42 | is_element_hidden(button, "Preferences button should be hidden"); |
michael@0 | 43 | |
michael@0 | 44 | button = gManagerWindow.document.getAnonymousElementByAttribute(pluginEl, "anonid", "details-btn"); |
michael@0 | 45 | EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow); |
michael@0 | 46 | |
michael@0 | 47 | wait_for_view_load(gManagerWindow, function() { |
michael@0 | 48 | let pluginLibraries = gManagerWindow.document.getElementById("pluginLibraries"); |
michael@0 | 49 | ok(pluginLibraries, "Plugin file name row should be displayed"); |
michael@0 | 50 | // the file name depends on the platform |
michael@0 | 51 | ok(pluginLibraries.textContent, testPlugin.pluginLibraries, "Plugin file name should be displayed"); |
michael@0 | 52 | |
michael@0 | 53 | let pluginMimeTypes = gManagerWindow.document.getElementById("pluginMimeTypes"); |
michael@0 | 54 | ok(pluginMimeTypes, "Plugin mime type row should be displayed"); |
michael@0 | 55 | ok(pluginMimeTypes.textContent, "application/x-test (tst)", "Plugin mime type should be displayed"); |
michael@0 | 56 | |
michael@0 | 57 | run_next_test(); |
michael@0 | 58 | }); |
michael@0 | 59 | }); |
michael@0 | 60 | }); |
michael@0 | 61 | }); |