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