toolkit/mozapps/extensions/test/xpinstall/browser_softwareupdate.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_softwareupdate.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,25 @@
     1.4 +// ----------------------------------------------------------------------------
     1.5 +// Tests that calling InstallTrigger.startSoftwareUpdate works
     1.6 +function test() {
     1.7 +  Harness.installEndedCallback = install_ended;
     1.8 +  Harness.installsCompletedCallback = finish_test;
     1.9 +  Harness.setup();
    1.10 +
    1.11 +  var pm = Services.perms;
    1.12 +  pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
    1.13 +
    1.14 +  gBrowser.selectedTab = gBrowser.addTab();
    1.15 +  gBrowser.loadURI(TESTROOT + "startsoftwareupdate.html? " + encodeURIComponent(TESTROOT + "unsigned.xpi"));
    1.16 +}
    1.17 +
    1.18 +function install_ended(install, addon) {
    1.19 +  install.cancel();
    1.20 +}
    1.21 +
    1.22 +function finish_test(count) {
    1.23 +  is(count, 1, "1 Add-on should have been successfully installed");
    1.24 +  Services.perms.remove("example.com", "install");
    1.25 +
    1.26 +  gBrowser.removeCurrentTab();
    1.27 +  Harness.finish();
    1.28 +}

mercurial