1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/components/crashes/tests/xpcshell/test_crash_service.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,31 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + * http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +"use strict"; 1.8 + 1.9 +const {classes: Cc, interfaces: Ci, utils: Cu} = Components; 1.10 + 1.11 +Cu.import("resource://gre/modules/Services.jsm", this); 1.12 +Cu.import("resource://testing-common/AppData.jsm", this); 1.13 +let bsp = Cu.import("resource://gre/modules/CrashManager.jsm", this); 1.14 + 1.15 +function run_test() { 1.16 + run_next_test(); 1.17 +} 1.18 + 1.19 +add_task(function* test_instantiation() { 1.20 + Assert.ok(!bsp.gCrashManager, "CrashManager global instance not initially defined."); 1.21 + 1.22 + do_get_profile(); 1.23 + yield makeFakeAppDir(); 1.24 + 1.25 + // Fake profile creation. 1.26 + Cc["@mozilla.org/crashservice;1"] 1.27 + .getService(Ci.nsIObserver) 1.28 + .observe(null, "profile-after-change", null); 1.29 + 1.30 + Assert.ok(bsp.gCrashManager, "Profile creation makes it available."); 1.31 + Assert.ok(Services.crashmanager, "CrashManager available via Services."); 1.32 + Assert.strictEqual(bsp.gCrashManager, Services.crashmanager, 1.33 + "The objects are the same."); 1.34 +});