|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 * http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 "use strict"; |
|
5 |
|
6 const {classes: Cc, interfaces: Ci, utils: Cu} = Components; |
|
7 |
|
8 Cu.import("resource://gre/modules/Services.jsm", this); |
|
9 Cu.import("resource://testing-common/AppData.jsm", this); |
|
10 let bsp = Cu.import("resource://gre/modules/CrashManager.jsm", this); |
|
11 |
|
12 function run_test() { |
|
13 run_next_test(); |
|
14 } |
|
15 |
|
16 add_task(function* test_instantiation() { |
|
17 Assert.ok(!bsp.gCrashManager, "CrashManager global instance not initially defined."); |
|
18 |
|
19 do_get_profile(); |
|
20 yield makeFakeAppDir(); |
|
21 |
|
22 // Fake profile creation. |
|
23 Cc["@mozilla.org/crashservice;1"] |
|
24 .getService(Ci.nsIObserver) |
|
25 .observe(null, "profile-after-change", null); |
|
26 |
|
27 Assert.ok(bsp.gCrashManager, "Profile creation makes it available."); |
|
28 Assert.ok(Services.crashmanager, "CrashManager available via Services."); |
|
29 Assert.strictEqual(bsp.gCrashManager, Services.crashmanager, |
|
30 "The objects are the same."); |
|
31 }); |