toolkit/mozapps/extensions/test/xpcshell/test_bug526598.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug526598.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,54 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/.
     1.7 + */
     1.8 +
     1.9 +function run_test() {
    1.10 +  do_test_pending();
    1.11 +  createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1");
    1.12 +
    1.13 +  startupManager();
    1.14 +
    1.15 +  installAllFiles([do_get_file("data/test_bug526598_1.xpi"),
    1.16 +                   do_get_file("data/test_bug526598_2.xpi")], function() {
    1.17 +
    1.18 +    restartManager();
    1.19 +
    1.20 +    AddonManager.getAddonsByIDs(["bug526598_1@tests.mozilla.org",
    1.21 +                                 "bug526598_2@tests.mozilla.org"],
    1.22 +                                 callback_soon(function([a1, a2]) {
    1.23 +
    1.24 +      do_check_neq(a1, null);
    1.25 +      do_check_true(a1.hasResource("install.rdf"));
    1.26 +      let uri = a1.getResourceURI("install.rdf");
    1.27 +      do_check_true(uri instanceof AM_Ci.nsIFileURL);
    1.28 +      let file = uri.file;
    1.29 +      do_check_true(file.exists());
    1.30 +      do_check_true(file.isReadable());
    1.31 +      do_check_true(file.isWritable());
    1.32 +
    1.33 +      do_check_neq(a2, null);
    1.34 +      do_check_true(a2.hasResource("install.rdf"));
    1.35 +      uri = a2.getResourceURI("install.rdf");
    1.36 +      do_check_true(uri instanceof AM_Ci.nsIFileURL);
    1.37 +      file = uri.file;
    1.38 +      do_check_true(file.exists());
    1.39 +      do_check_true(file.isReadable());
    1.40 +      do_check_true(file.isWritable());
    1.41 +
    1.42 +      a1.uninstall();
    1.43 +      a2.uninstall();
    1.44 +
    1.45 +      restartManager();
    1.46 +
    1.47 +      AddonManager.getAddonsByIDs(["bug526598_1@tests.mozilla.org",
    1.48 +                                   "bug526598_2@tests.mozilla.org"],
    1.49 +                                   function([newa1, newa2]) {
    1.50 +        do_check_eq(newa1, null);
    1.51 +        do_check_eq(newa2, null);
    1.52 +
    1.53 +        do_execute_soon(do_test_finished);
    1.54 +      });
    1.55 +    }));
    1.56 +  });
    1.57 +}

mercurial