toolkit/mozapps/extensions/test/xpcshell/test_bug521905.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_bug521905.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,59 @@
     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 +const ADDON = "test_bug521905";
    1.10 +const ID = "bug521905@tests.mozilla.org";
    1.11 +
    1.12 +// Disables security checking our updates which haven't been signed
    1.13 +Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false);
    1.14 +
    1.15 +function run_test() {
    1.16 +  // This test is only relevant on builds where the version is included in the
    1.17 +  // checkCompatibility preference name
    1.18 +  if (isNightlyChannel()) {
    1.19 +    return;
    1.20 +  }
    1.21 +
    1.22 +  do_test_pending();
    1.23 +  createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2.0pre", "2");
    1.24 +
    1.25 +  startupManager();
    1.26 +  AddonManager.checkCompatibility = false;
    1.27 +
    1.28 +  installAllFiles([do_get_addon(ADDON)], function() {
    1.29 +    restartManager();
    1.30 +
    1.31 +    AddonManager.getAddonByID(ID, function(addon) {
    1.32 +      do_check_neq(addon, null);
    1.33 +      do_check_true(addon.isActive);
    1.34 +
    1.35 +      do_execute_soon(run_test_1);
    1.36 +    });
    1.37 +  });
    1.38 +}
    1.39 +
    1.40 +function run_test_1() {
    1.41 +  Services.prefs.setBoolPref("extensions.checkCompatibility.2.0pre", true);
    1.42 +
    1.43 +  restartManager();
    1.44 +  AddonManager.getAddonByID(ID, function(addon) {
    1.45 +    do_check_neq(addon, null);
    1.46 +    do_check_false(addon.isActive);
    1.47 +
    1.48 +    do_execute_soon(run_test_2);
    1.49 +  });
    1.50 +}
    1.51 +
    1.52 +function run_test_2() {
    1.53 +  Services.prefs.setBoolPref("extensions.checkCompatibility.2.0p", false);
    1.54 +
    1.55 +  restartManager();
    1.56 +  AddonManager.getAddonByID(ID, function(addon) {
    1.57 +    do_check_neq(addon, null);
    1.58 +    do_check_false(addon.isActive);
    1.59 +
    1.60 +    do_execute_soon(do_test_finished);
    1.61 +  });
    1.62 +}

mercurial