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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/mozapps/extensions/test/xpinstall/browser_unsigned_url.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,33 @@
     1.4 +// ----------------------------------------------------------------------------
     1.5 +// Tests installing an unsigned add-on by navigating directly to the url
     1.6 +function test() {
     1.7 +  Harness.installConfirmCallback = confirm_install;
     1.8 +  Harness.installEndedCallback = install_ended;
     1.9 +  Harness.installsCompletedCallback = finish_test;
    1.10 +  Harness.setup();
    1.11 +
    1.12 +  gBrowser.selectedTab = gBrowser.addTab();
    1.13 +  gBrowser.loadURI(TESTROOT + "unsigned.xpi");
    1.14 +}
    1.15 +
    1.16 +function confirm_install(window) {
    1.17 +  let items = window.document.getElementById("itemList").childNodes;
    1.18 +  is(items.length, 1, "Should only be 1 item listed in the confirmation dialog");
    1.19 +  is(items[0].name, "XPI Test", "Should have had the filename for the item name");
    1.20 +  is(items[0].url, TESTROOT + "unsigned.xpi", "Should have listed the correct url for the item");
    1.21 +  is(items[0].icon, "", "Should have listed no icon for the item");
    1.22 +  is(items[0].signed, "false", "Should have listed the item as unsigned");
    1.23 +  return true;
    1.24 +}
    1.25 +
    1.26 +function install_ended(install, addon) {
    1.27 +  install.cancel();
    1.28 +}
    1.29 +
    1.30 +function finish_test(count) {
    1.31 +  is(count, 1, "1 Add-on should have been successfully installed");
    1.32 +
    1.33 +  gBrowser.removeCurrentTab();
    1.34 +  Harness.finish();
    1.35 +}
    1.36 +// ----------------------------------------------------------------------------

mercurial