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

mercurial