toolkit/mozapps/extensions/test/browser/browser_pluginprefs.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* Any copyright is dedicated to the Public Domain.
     2  * http://creativecommons.org/publicdomain/zero/1.0/
     3  */
     5 // Tests the detail view of plugins
     7 var gManagerWindow;
     9 function test() {
    10   waitForExplicitFinish();
    12   open_manager("addons://list/plugin", function(aWindow) {
    13     gManagerWindow = aWindow;
    15     run_next_test();
    16   });
    17 }
    19 function end_test() {
    20   close_manager(gManagerWindow, function() {
    21     finish();
    22   });
    23 }
    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")
    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);
    41       let button = gManagerWindow.document.getAnonymousElementByAttribute(pluginEl, "anonid", "preferences-btn");
    42       is_element_hidden(button, "Preferences button should be hidden");
    44       button = gManagerWindow.document.getAnonymousElementByAttribute(pluginEl, "anonid", "details-btn");
    45       EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
    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");
    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");
    57         run_next_test();
    58       });
    59     });
    60   });
    61 });

mercurial