Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 4 | */ |
michael@0 | 5 | |
michael@0 | 6 | // Disables security checking our updates which haven't been signed |
michael@0 | 7 | Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false); |
michael@0 | 8 | |
michael@0 | 9 | Components.utils.import("resource://testing-common/httpd.js"); |
michael@0 | 10 | var server; |
michael@0 | 11 | |
michael@0 | 12 | // nsIAddonUpdateCheckListener implementation |
michael@0 | 13 | var updateListener = { |
michael@0 | 14 | _count: 0, |
michael@0 | 15 | |
michael@0 | 16 | onUpdateAvailable: function onAddonUpdateEnded(aAddon, aInstall) { |
michael@0 | 17 | do_check_eq(aInstall.version, 10); |
michael@0 | 18 | }, |
michael@0 | 19 | |
michael@0 | 20 | onNoUpdateAvailable: function onNoUpdateAvailable(aAddon) { |
michael@0 | 21 | do_throw("Expected an available update for " + aAddon.id); |
michael@0 | 22 | }, |
michael@0 | 23 | |
michael@0 | 24 | onUpdateFinished: function onUpdateFinished() { |
michael@0 | 25 | if (++this._count == 2) |
michael@0 | 26 | server.stop(do_test_finished); |
michael@0 | 27 | }, |
michael@0 | 28 | } |
michael@0 | 29 | |
michael@0 | 30 | function run_test() |
michael@0 | 31 | { |
michael@0 | 32 | // Setup for test |
michael@0 | 33 | do_test_pending(); |
michael@0 | 34 | createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9"); |
michael@0 | 35 | startupManager(); |
michael@0 | 36 | |
michael@0 | 37 | installAllFiles([do_get_addon("test_bug394300_1"), |
michael@0 | 38 | do_get_addon("test_bug394300_2")], function() { |
michael@0 | 39 | |
michael@0 | 40 | restartManager(); |
michael@0 | 41 | |
michael@0 | 42 | AddonManager.getAddonsByIDs(["bug394300_1@tests.mozilla.org", |
michael@0 | 43 | "bug394300_2@tests.mozilla.org"], function(updates) { |
michael@0 | 44 | |
michael@0 | 45 | do_check_neq(updates[0], null); |
michael@0 | 46 | do_check_neq(updates[1], null); |
michael@0 | 47 | |
michael@0 | 48 | server = new HttpServer(); |
michael@0 | 49 | server.registerDirectory("/", do_get_file("data")); |
michael@0 | 50 | server.start(4444); |
michael@0 | 51 | |
michael@0 | 52 | updates[0].findUpdates(updateListener, AddonManager.UPDATE_WHEN_USER_REQUESTED); |
michael@0 | 53 | updates[1].findUpdates(updateListener, AddonManager.UPDATE_WHEN_USER_REQUESTED); |
michael@0 | 54 | }); |
michael@0 | 55 | }); |
michael@0 | 56 | } |