toolkit/mozapps/extensions/test/browser/browser_globalinformations.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 // Bug 656269 - Add link to Mozilla plugin check from Add-ons Manager
     7 const MAIN_URL = "https://example.com/" + RELATIVE_DIR + "discovery.html";
     8 const PREF_PLUGINCHECKURL = "plugins.update.url";
    10 function test() {
    11   waitForExplicitFinish();
    13   Services.prefs.setCharPref(PREF_PLUGINCHECKURL, MAIN_URL);
    14   registerCleanupFunction(function() {
    15     Services.prefs.clearUserPref(PREF_PLUGINCHECKURL);
    16   });
    18   run_next_test();
    19 }
    21 function end_test() {
    22   finish();
    23 }
    25 add_test(function() {
    26   open_manager("addons://list/extension", function(aManager) {
    27     info("Testing plugin check information");
    28     var button = aManager.document.querySelector("#list-view button.global-info-plugincheck");
    29     is_element_hidden(button, "Plugin Check message button should be hidden");
    31     info("Changing view to plugins")
    32     EventUtils.synthesizeMouseAtCenter(aManager.document.getElementById("category-plugin"), { }, aManager);
    34     wait_for_view_load(aManager, function(aManager) {
    35       var button = aManager.document.querySelector("#list-view button.global-info-plugincheck");
    36       is_element_visible(button, "Plugin Check message button should be visible");
    38       info("Clicking 'Plugin Check' button");
    39       EventUtils.synthesizeMouseAtCenter(button, { }, aManager);
    40       gBrowser.addEventListener("load", function(event) {
    41         if (!(event.target instanceof Document) ||
    42             event.target.location.href == "about:blank")
    43           return;
    44         gBrowser.removeEventListener("load", arguments.callee, true);
    46         is(gBrowser.currentURI.spec, Services.urlFormatter.formatURLPref("plugins.update.url"), "Plugin Check URL should match");
    48         gBrowser.removeCurrentTab();
    49         close_manager(aManager, function() {
    50           run_next_test();
    51         });
    52       }, true);
    53     });
    54   });
    55 });

mercurial