michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: "use strict"; michael@0: michael@0: const {classes: Cc, interfaces: Ci, utils: Cu} = Components; michael@0: michael@0: Cu.import("resource://gre/modules/Services.jsm", this); michael@0: Cu.import("resource://testing-common/AppData.jsm", this); michael@0: let bsp = Cu.import("resource://gre/modules/CrashManager.jsm", this); michael@0: michael@0: function run_test() { michael@0: run_next_test(); michael@0: } michael@0: michael@0: add_task(function* test_instantiation() { michael@0: Assert.ok(!bsp.gCrashManager, "CrashManager global instance not initially defined."); michael@0: michael@0: do_get_profile(); michael@0: yield makeFakeAppDir(); michael@0: michael@0: // Fake profile creation. michael@0: Cc["@mozilla.org/crashservice;1"] michael@0: .getService(Ci.nsIObserver) michael@0: .observe(null, "profile-after-change", null); michael@0: michael@0: Assert.ok(bsp.gCrashManager, "Profile creation makes it available."); michael@0: Assert.ok(Services.crashmanager, "CrashManager available via Services."); michael@0: Assert.strictEqual(bsp.gCrashManager, Services.crashmanager, michael@0: "The objects are the same."); michael@0: });