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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

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 just verifies that the EM can actually startup and shutdown a few times
michael@0 6 // without any errors
michael@0 7
michael@0 8 // We have to look up how many add-ons are present since there will be plugins
michael@0 9 // etc. detected
michael@0 10 var gCount;
michael@0 11
michael@0 12 function run_test() {
michael@0 13 do_test_pending();
michael@0 14 createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
michael@0 15
michael@0 16 var count = 0;
michael@0 17 startupManager();
michael@0 18 AddonManager.getAddonsByTypes(null, function(list) {
michael@0 19 gCount = list.length;
michael@0 20
michael@0 21 do_execute_soon(run_test_1);
michael@0 22 });
michael@0 23 }
michael@0 24
michael@0 25 function run_test_1() {
michael@0 26 restartManager();
michael@0 27
michael@0 28 AddonManager.getAddonsByTypes(null, function(addons) {
michael@0 29 do_check_eq(gCount, addons.length);
michael@0 30
michael@0 31 AddonManager.getAddonsWithOperationsByTypes(null, function(pendingAddons) {
michael@0 32 do_check_eq(0, pendingAddons.length);
michael@0 33
michael@0 34 do_execute_soon(run_test_2);
michael@0 35 });
michael@0 36 });
michael@0 37 }
michael@0 38
michael@0 39 function run_test_2() {
michael@0 40 shutdownManager();
michael@0 41
michael@0 42 startupManager(false);
michael@0 43
michael@0 44 AddonManager.getAddonsByTypes(null, function(addons) {
michael@0 45 do_check_eq(gCount, addons.length);
michael@0 46
michael@0 47 do_execute_soon(run_test_3);
michael@0 48 });
michael@0 49 }
michael@0 50
michael@0 51 function run_test_3() {
michael@0 52 restartManager();
michael@0 53
michael@0 54 AddonManager.getAddonsByTypes(null, callback_soon(function(addons) {
michael@0 55 do_check_eq(gCount, addons.length);
michael@0 56 do_test_finished();
michael@0 57 }));
michael@0 58 }

mercurial