1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug299716_2.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,50 @@ 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 +// Disables security checking our updates which haven't been signed 1.10 +Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false); 1.11 + 1.12 +// Get the HTTP server. 1.13 +Components.utils.import("resource://testing-common/httpd.js"); 1.14 +var testserver; 1.15 + 1.16 +var ADDON = { 1.17 + id: "bug299716-2@tests.mozilla.org", 1.18 + addon: "test_bug299716_2" 1.19 +}; 1.20 + 1.21 +function run_test() { 1.22 + do_test_pending(); 1.23 + 1.24 + createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2", "1.9"); 1.25 + 1.26 + const dataDir = do_get_file("data"); 1.27 + const addonsDir = do_get_addon(ADDON.addon).parent; 1.28 + 1.29 + // Create and configure the HTTP server. 1.30 + testserver = new HttpServer(); 1.31 + testserver.registerDirectory("/addons/", addonsDir); 1.32 + testserver.registerDirectory("/data/", dataDir); 1.33 + testserver.start(4444); 1.34 + 1.35 + startupManager(); 1.36 + 1.37 + installAllFiles([do_get_addon(ADDON.addon)], function() { 1.38 + restartManager(); 1.39 + 1.40 + AddonManager.getAddonByID(ADDON.id, function(item) { 1.41 + do_check_eq(item.version, 0.1); 1.42 + do_check_false(item.isCompatible); 1.43 + 1.44 + item.findUpdates({ 1.45 + onUpdateFinished: function(addon) { 1.46 + do_check_false(item.isCompatible); 1.47 + 1.48 + testserver.stop(do_test_finished); 1.49 + } 1.50 + }, AddonManager.UPDATE_WHEN_USER_REQUESTED); 1.51 + }); 1.52 + }); 1.53 +}