|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 * http://creativecommons.org/publicdomain/zero/1.0/ |
|
3 */ |
|
4 |
|
5 // Bug 656269 - Add link to Mozilla plugin check from Add-ons Manager |
|
6 |
|
7 const MAIN_URL = "https://example.com/" + RELATIVE_DIR + "discovery.html"; |
|
8 const PREF_PLUGINCHECKURL = "plugins.update.url"; |
|
9 |
|
10 function test() { |
|
11 waitForExplicitFinish(); |
|
12 |
|
13 Services.prefs.setCharPref(PREF_PLUGINCHECKURL, MAIN_URL); |
|
14 registerCleanupFunction(function() { |
|
15 Services.prefs.clearUserPref(PREF_PLUGINCHECKURL); |
|
16 }); |
|
17 |
|
18 run_next_test(); |
|
19 } |
|
20 |
|
21 function end_test() { |
|
22 finish(); |
|
23 } |
|
24 |
|
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"); |
|
30 |
|
31 info("Changing view to plugins") |
|
32 EventUtils.synthesizeMouseAtCenter(aManager.document.getElementById("category-plugin"), { }, aManager); |
|
33 |
|
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"); |
|
37 |
|
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); |
|
45 |
|
46 is(gBrowser.currentURI.spec, Services.urlFormatter.formatURLPref("plugins.update.url"), "Plugin Check URL should match"); |
|
47 |
|
48 gBrowser.removeCurrentTab(); |
|
49 close_manager(aManager, function() { |
|
50 run_next_test(); |
|
51 }); |
|
52 }, true); |
|
53 }); |
|
54 }); |
|
55 }); |