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