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

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:d4f2a623023c
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 */
5
6 // Disables security checking our updates which haven't been signed
7 Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false);
8
9 // Get the HTTP server.
10 Components.utils.import("resource://testing-common/httpd.js");
11 var testserver;
12
13 var ADDON = {
14 id: "bug299716-2@tests.mozilla.org",
15 addon: "test_bug299716_2"
16 };
17
18 function run_test() {
19 do_test_pending();
20
21 createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2", "1.9");
22
23 const dataDir = do_get_file("data");
24 const addonsDir = do_get_addon(ADDON.addon).parent;
25
26 // Create and configure the HTTP server.
27 testserver = new HttpServer();
28 testserver.registerDirectory("/addons/", addonsDir);
29 testserver.registerDirectory("/data/", dataDir);
30 testserver.start(4444);
31
32 startupManager();
33
34 installAllFiles([do_get_addon(ADDON.addon)], function() {
35 restartManager();
36
37 AddonManager.getAddonByID(ADDON.id, function(item) {
38 do_check_eq(item.version, 0.1);
39 do_check_false(item.isCompatible);
40
41 item.findUpdates({
42 onUpdateFinished: function(addon) {
43 do_check_false(item.isCompatible);
44
45 testserver.stop(do_test_finished);
46 }
47 }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
48 });
49 });
50 }

mercurial