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 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | * http://creativecommons.org/publicdomain/zero/1.0/ |
michael@0 | 3 | */ |
michael@0 | 4 | |
michael@0 | 5 | // This verifies that deleting the database from the profile doesn't break |
michael@0 | 6 | // anything |
michael@0 | 7 | |
michael@0 | 8 | const profileDir = gProfD.clone(); |
michael@0 | 9 | profileDir.append("extensions"); |
michael@0 | 10 | |
michael@0 | 11 | // getting an unused port |
michael@0 | 12 | Components.utils.import("resource://testing-common/httpd.js"); |
michael@0 | 13 | let gServer = new HttpServer(); |
michael@0 | 14 | gServer.start(-1); |
michael@0 | 15 | gPort = gServer.identity.primaryPort; |
michael@0 | 16 | |
michael@0 | 17 | function run_test() { |
michael@0 | 18 | createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); |
michael@0 | 19 | |
michael@0 | 20 | writeInstallRDFForExtension({ |
michael@0 | 21 | id: "addon1@tests.mozilla.org", |
michael@0 | 22 | version: "1.0", |
michael@0 | 23 | updateURL: "http://localhost:" + gPort + "/data/test_update.rdf", |
michael@0 | 24 | targetApplications: [{ |
michael@0 | 25 | id: "xpcshell@tests.mozilla.org", |
michael@0 | 26 | minVersion: "1", |
michael@0 | 27 | maxVersion: "1" |
michael@0 | 28 | }], |
michael@0 | 29 | name: "Test Addon 1", |
michael@0 | 30 | }, profileDir); |
michael@0 | 31 | |
michael@0 | 32 | startupManager(); |
michael@0 | 33 | |
michael@0 | 34 | do_test_pending(); |
michael@0 | 35 | |
michael@0 | 36 | run_test_1(); |
michael@0 | 37 | } |
michael@0 | 38 | |
michael@0 | 39 | function end_test() { |
michael@0 | 40 | gServer.stop(do_test_finished); |
michael@0 | 41 | } |
michael@0 | 42 | |
michael@0 | 43 | function run_test_1() { |
michael@0 | 44 | AddonManager.getAddonByID("addon1@tests.mozilla.org", callback_soon(function(a1) { |
michael@0 | 45 | do_check_neq(a1, null); |
michael@0 | 46 | do_check_eq(a1.version, "1.0"); |
michael@0 | 47 | |
michael@0 | 48 | shutdownManager(); |
michael@0 | 49 | |
michael@0 | 50 | gExtensionsJSON.remove(true); |
michael@0 | 51 | |
michael@0 | 52 | do_execute_soon(check_test_1); |
michael@0 | 53 | })); |
michael@0 | 54 | } |
michael@0 | 55 | |
michael@0 | 56 | function check_test_1() { |
michael@0 | 57 | startupManager(false); |
michael@0 | 58 | |
michael@0 | 59 | AddonManager.getAddonByID("addon1@tests.mozilla.org", callback_soon(function(a1) { |
michael@0 | 60 | do_check_neq(a1, null); |
michael@0 | 61 | do_check_eq(a1.version, "1.0"); |
michael@0 | 62 | |
michael@0 | 63 | // due to delayed write, the file may not exist until |
michael@0 | 64 | // after shutdown |
michael@0 | 65 | shutdownManager(); |
michael@0 | 66 | do_check_true(gExtensionsJSON.exists()); |
michael@0 | 67 | do_check_true(gExtensionsJSON.fileSize > 0); |
michael@0 | 68 | |
michael@0 | 69 | end_test(); |
michael@0 | 70 | })); |
michael@0 | 71 | } |