michael@0: // ---------------------------------------------------------------------------- michael@0: // Tests installing an signed add-on by navigating directly to the url michael@0: function test() { michael@0: Harness.installConfirmCallback = confirm_install; michael@0: Harness.installEndedCallback = install_ended; michael@0: Harness.installsCompletedCallback = finish_test; michael@0: Harness.setup(); michael@0: michael@0: gBrowser.selectedTab = gBrowser.addTab(); michael@0: gBrowser.loadURI(TESTROOT + "multipackage.xpi"); michael@0: } michael@0: michael@0: function get_item(items, name) { michael@0: for (let item of items) { michael@0: if (item.name == name) michael@0: return item; michael@0: } michael@0: ok(false, "Item for " + name + " was not listed"); michael@0: return null; michael@0: } michael@0: michael@0: function confirm_install(window) { michael@0: let items = window.document.getElementById("itemList").childNodes; michael@0: is(items.length, 2, "Should be 2 items listed in the confirmation dialog"); michael@0: michael@0: let item = get_item(items, "XPI Test"); michael@0: if (item) { michael@0: is(item.signed, "false", "Should not have listed the item as signed"); michael@0: is(item.icon, "", "Should have listed no icon for the item"); michael@0: } michael@0: michael@0: item = get_item(items, "Signed XPI Test"); michael@0: if (item) { michael@0: is(item.cert, "(Object Signer)", "Should have seen the signer"); michael@0: is(item.signed, "true", "Should have listed the item as signed"); michael@0: is(item.icon, "", "Should have listed no icon for the item"); michael@0: } michael@0: michael@0: return true; michael@0: } michael@0: michael@0: function install_ended(install, addon) { michael@0: install.cancel(); michael@0: } michael@0: michael@0: function finish_test(count) { michael@0: is(count, 2, "2 Add-ons should have been successfully installed"); michael@0: gBrowser.removeCurrentTab(); michael@0: Harness.finish(); michael@0: } michael@0: // ----------------------------------------------------------------------------