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.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 * http://creativecommons.org/publicdomain/zero/1.0/
michael@0 3 */
michael@0 4
michael@0 5 // Bug 656269 - Add link to Mozilla plugin check from Add-ons Manager
michael@0 6
michael@0 7 const MAIN_URL = "https://example.com/" + RELATIVE_DIR + "discovery.html";
michael@0 8 const PREF_PLUGINCHECKURL = "plugins.update.url";
michael@0 9
michael@0 10 function test() {
michael@0 11 waitForExplicitFinish();
michael@0 12
michael@0 13 Services.prefs.setCharPref(PREF_PLUGINCHECKURL, MAIN_URL);
michael@0 14 registerCleanupFunction(function() {
michael@0 15 Services.prefs.clearUserPref(PREF_PLUGINCHECKURL);
michael@0 16 });
michael@0 17
michael@0 18 run_next_test();
michael@0 19 }
michael@0 20
michael@0 21 function end_test() {
michael@0 22 finish();
michael@0 23 }
michael@0 24
michael@0 25 add_test(function() {
michael@0 26 open_manager("addons://list/extension", function(aManager) {
michael@0 27 info("Testing plugin check information");
michael@0 28 var button = aManager.document.querySelector("#list-view button.global-info-plugincheck");
michael@0 29 is_element_hidden(button, "Plugin Check message button should be hidden");
michael@0 30
michael@0 31 info("Changing view to plugins")
michael@0 32 EventUtils.synthesizeMouseAtCenter(aManager.document.getElementById("category-plugin"), { }, aManager);
michael@0 33
michael@0 34 wait_for_view_load(aManager, function(aManager) {
michael@0 35 var button = aManager.document.querySelector("#list-view button.global-info-plugincheck");
michael@0 36 is_element_visible(button, "Plugin Check message button should be visible");
michael@0 37
michael@0 38 info("Clicking 'Plugin Check' button");
michael@0 39 EventUtils.synthesizeMouseAtCenter(button, { }, aManager);
michael@0 40 gBrowser.addEventListener("load", function(event) {
michael@0 41 if (!(event.target instanceof Document) ||
michael@0 42 event.target.location.href == "about:blank")
michael@0 43 return;
michael@0 44 gBrowser.removeEventListener("load", arguments.callee, true);
michael@0 45
michael@0 46 is(gBrowser.currentURI.spec, Services.urlFormatter.formatURLPref("plugins.update.url"), "Plugin Check URL should match");
michael@0 47
michael@0 48 gBrowser.removeCurrentTab();
michael@0 49 close_manager(aManager, function() {
michael@0 50 run_next_test();
michael@0 51 });
michael@0 52 }, true);
michael@0 53 });
michael@0 54 });
michael@0 55 });

mercurial