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

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:6a4cba32ed74
1 // ----------------------------------------------------------------------------
2 // Tests installing an signed add-on by navigating directly to the url
3 function test() {
4 Harness.installConfirmCallback = confirm_install;
5 Harness.installEndedCallback = install_ended;
6 Harness.installsCompletedCallback = finish_test;
7 Harness.setup();
8
9 gBrowser.selectedTab = gBrowser.addTab();
10 gBrowser.loadURI(TESTROOT + "multipackage.xpi");
11 }
12
13 function get_item(items, name) {
14 for (let item of items) {
15 if (item.name == name)
16 return item;
17 }
18 ok(false, "Item for " + name + " was not listed");
19 return null;
20 }
21
22 function confirm_install(window) {
23 let items = window.document.getElementById("itemList").childNodes;
24 is(items.length, 2, "Should be 2 items listed in the confirmation dialog");
25
26 let item = get_item(items, "XPI Test");
27 if (item) {
28 is(item.signed, "false", "Should not have listed the item as signed");
29 is(item.icon, "", "Should have listed no icon for the item");
30 }
31
32 item = get_item(items, "Signed XPI Test");
33 if (item) {
34 is(item.cert, "(Object Signer)", "Should have seen the signer");
35 is(item.signed, "true", "Should have listed the item as signed");
36 is(item.icon, "", "Should have listed no icon for the item");
37 }
38
39 return true;
40 }
41
42 function install_ended(install, addon) {
43 install.cancel();
44 }
45
46 function finish_test(count) {
47 is(count, 2, "2 Add-ons should have been successfully installed");
48 gBrowser.removeCurrentTab();
49 Harness.finish();
50 }
51 // ----------------------------------------------------------------------------

mercurial