toolkit/mozapps/extensions/test/xpinstall/browser_signed_trigger.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:3f5db27c232d
1 // ----------------------------------------------------------------------------
2 // Tests installing an signed add-on through an InstallTrigger call in web
3 // content.
4 function test() {
5 Harness.installConfirmCallback = confirm_install;
6 Harness.installEndedCallback = install_ended;
7 Harness.installsCompletedCallback = finish_test;
8 Harness.setup();
9
10 var pm = Services.perms;
11 pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
12
13 var triggers = encodeURIComponent(JSON.stringify({
14 "Signed XPI": TESTROOT + "signed.xpi"
15 }));
16 gBrowser.selectedTab = gBrowser.addTab();
17 gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
18 }
19
20 function confirm_install(window) {
21 var items = window.document.getElementById("itemList").childNodes;
22 is(items.length, 1, "Should only be 1 item listed in the confirmation dialog");
23 is(items[0].name, "Signed XPI Test", "Should have seen the name from the trigger list");
24 is(items[0].url, TESTROOT + "signed.xpi", "Should have listed the correct url for the item");
25 is(items[0].cert, "(Object Signer)", "Should have seen the signer");
26 is(items[0].signed, "true", "Should have listed the item as signed");
27 return true;
28 }
29
30 function install_ended(install, addon) {
31 install.cancel();
32 }
33
34 function finish_test(count) {
35 is(count, 1, "1 Add-on should have been successfully installed");
36
37 Services.perms.remove("example.com", "install");
38
39 gBrowser.removeCurrentTab();
40 Harness.finish();
41 }

mercurial