1 // Load in the test harness
2 var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
3 .getService(Components.interfaces.mozIJSSubScriptLoader);
4 scriptLoader.loadSubScript("chrome://mochikit/content/browser/xpinstall/tests/harness.js", this);
6 // ----------------------------------------------------------------------------
7 // Tests installing an signed add-on by navigating directly to the url
9 Harness.installConfirmCallback = confirm_install;
10 Harness.installEndedCallback = check_xpi_install;
11 Harness.installsCompletedCallback = finish_test;
14 gBrowser.selectedTab = gBrowser.addTab();
15 gBrowser.loadURI(TESTROOT + "signed.xpi");
18 function confirm_install(window) {
19 items = window.document.getElementById("itemList").childNodes;
20 is(items.length, 1, "Should only be 1 item listed in the confirmation dialog");
21 is(items[0].name, "signed.xpi", "Should have had the filename for the item name");
22 is(items[0].url, TESTROOT + "signed.xpi", "Should have listed the correct url for the item");
23 is(items[0].cert, "(Object Signer)", "Should have seen the signer");
24 is(items[0].signed, "true", "Should have listed the item as signed");
28 function check_xpi_install(addon, status) {
29 is(status, 0, "Install should succeed");
32 function finish_test() {
33 var em = Components.classes["@mozilla.org/extensions/manager;1"]
34 .getService(Components.interfaces.nsIExtensionManager);
35 em.cancelInstallItem("signed-xpi@tests.mozilla.org");
37 gBrowser.removeCurrentTab();
40 // ----------------------------------------------------------------------------