Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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();
9 gBrowser.selectedTab = gBrowser.addTab();
10 gBrowser.loadURI(TESTROOT + "multipackage.xpi");
11 }
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 }
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");
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 }
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 }
39 return true;
40 }
42 function install_ended(install, addon) {
43 install.cancel();
44 }
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 // ----------------------------------------------------------------------------