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

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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