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 | // use httpserver to find an available port |
michael@0 | 6 | Components.utils.import("resource://testing-common/httpd.js"); |
michael@0 | 7 | var gServer = new HttpServer(); |
michael@0 | 8 | gServer.start(-1); |
michael@0 | 9 | gPort = gServer.identity.primaryPort; |
michael@0 | 10 | |
michael@0 | 11 | var addon_url = "http://localhost:" + gPort + "/test.xpi"; |
michael@0 | 12 | var icon32_url = "http://localhost:" + gPort + "/icon.png"; |
michael@0 | 13 | var icon64_url = "http://localhost:" + gPort + "/icon64.png"; |
michael@0 | 14 | |
michael@0 | 15 | function run_test() { |
michael@0 | 16 | do_test_pending(); |
michael@0 | 17 | createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); |
michael@0 | 18 | startupManager(); |
michael@0 | 19 | |
michael@0 | 20 | test_1(); |
michael@0 | 21 | } |
michael@0 | 22 | |
michael@0 | 23 | function test_1() { |
michael@0 | 24 | AddonManager.getInstallForURL(addon_url, function(aInstall) { |
michael@0 | 25 | do_check_eq(aInstall.iconURL, null); |
michael@0 | 26 | do_check_neq(aInstall.icons, null); |
michael@0 | 27 | do_check_eq(aInstall.icons[32], undefined); |
michael@0 | 28 | do_check_eq(aInstall.icons[64], undefined); |
michael@0 | 29 | test_2(); |
michael@0 | 30 | }, "application/x-xpinstall", null, null, null, null, null); |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | function test_2() { |
michael@0 | 34 | AddonManager.getInstallForURL(addon_url, function(aInstall) { |
michael@0 | 35 | do_check_eq(aInstall.iconURL, icon32_url); |
michael@0 | 36 | do_check_neq(aInstall.icons, null); |
michael@0 | 37 | do_check_eq(aInstall.icons[32], icon32_url); |
michael@0 | 38 | do_check_eq(aInstall.icons[64], undefined); |
michael@0 | 39 | test_3(); |
michael@0 | 40 | }, "application/x-xpinstall", null, null, icon32_url, null, null); |
michael@0 | 41 | } |
michael@0 | 42 | |
michael@0 | 43 | function test_3() { |
michael@0 | 44 | AddonManager.getInstallForURL(addon_url, function(aInstall) { |
michael@0 | 45 | do_check_eq(aInstall.iconURL, icon32_url); |
michael@0 | 46 | do_check_neq(aInstall.icons, null); |
michael@0 | 47 | do_check_eq(aInstall.icons[32], icon32_url); |
michael@0 | 48 | do_check_eq(aInstall.icons[64], undefined); |
michael@0 | 49 | test_4(); |
michael@0 | 50 | }, "application/x-xpinstall", null, null, { "32": icon32_url }, null, null); |
michael@0 | 51 | } |
michael@0 | 52 | |
michael@0 | 53 | function test_4() { |
michael@0 | 54 | AddonManager.getInstallForURL(addon_url, function(aInstall) { |
michael@0 | 55 | do_check_eq(aInstall.iconURL, icon32_url); |
michael@0 | 56 | do_check_neq(aInstall.icons, null); |
michael@0 | 57 | do_check_eq(aInstall.icons[32], icon32_url); |
michael@0 | 58 | do_check_eq(aInstall.icons[64], icon64_url); |
michael@0 | 59 | do_execute_soon(do_test_finished); |
michael@0 | 60 | }, "application/x-xpinstall", null, null, { "32": icon32_url, "64": icon64_url }, null, null); |
michael@0 | 61 | } |