michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ michael@0: */ michael@0: michael@0: // Tests the detail view of plugins michael@0: michael@0: var gManagerWindow; michael@0: michael@0: function test() { michael@0: waitForExplicitFinish(); michael@0: michael@0: open_manager("addons://list/plugin", function(aWindow) { michael@0: gManagerWindow = aWindow; michael@0: michael@0: run_next_test(); michael@0: }); michael@0: } michael@0: michael@0: function end_test() { michael@0: close_manager(gManagerWindow, function() { michael@0: finish(); michael@0: }); michael@0: } michael@0: michael@0: add_test(function() { michael@0: AddonManager.getAddonsByTypes(["plugin"], function(plugins) { michael@0: let testPluginId; michael@0: for (let plugin of plugins) { michael@0: if (plugin.name == "Test Plug-in") { michael@0: testPluginId = plugin.id; michael@0: break; michael@0: } michael@0: } michael@0: ok(testPluginId, "Test Plug-in should exist") michael@0: michael@0: AddonManager.getAddonByID(testPluginId, function(testPlugin) { michael@0: let pluginEl = get_addon_element(gManagerWindow, testPluginId); michael@0: is(pluginEl.mAddon.optionsType, AddonManager.OPTIONS_TYPE_INLINE_INFO, "Options should be inline info type"); michael@0: pluginEl.parentNode.ensureElementIsVisible(pluginEl); michael@0: michael@0: let button = gManagerWindow.document.getAnonymousElementByAttribute(pluginEl, "anonid", "preferences-btn"); michael@0: is_element_hidden(button, "Preferences button should be hidden"); michael@0: michael@0: button = gManagerWindow.document.getAnonymousElementByAttribute(pluginEl, "anonid", "details-btn"); michael@0: EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow); michael@0: michael@0: wait_for_view_load(gManagerWindow, function() { michael@0: let pluginLibraries = gManagerWindow.document.getElementById("pluginLibraries"); michael@0: ok(pluginLibraries, "Plugin file name row should be displayed"); michael@0: // the file name depends on the platform michael@0: ok(pluginLibraries.textContent, testPlugin.pluginLibraries, "Plugin file name should be displayed"); michael@0: michael@0: let pluginMimeTypes = gManagerWindow.document.getElementById("pluginMimeTypes"); michael@0: ok(pluginMimeTypes, "Plugin mime type row should be displayed"); michael@0: ok(pluginMimeTypes.textContent, "application/x-test (tst)", "Plugin mime type should be displayed"); michael@0: michael@0: run_next_test(); michael@0: }); michael@0: }); michael@0: }); michael@0: });