browser/devtools/debugger/test/browser_dbg_chrome-create.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:4c343001db9e
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 /**
5 * Tests that a chrome debugger can be created in a new process.
6 */
7
8 let gProcess;
9
10 function test() {
11 // Windows XP and 8.1 test slaves are terribly slow at this test.
12 requestLongerTimeout(5);
13
14 initChromeDebugger(aOnClose).then(aProcess => {
15 gProcess = aProcess;
16
17 info("Starting test...");
18 performTest();
19 });
20 }
21
22 function performTest() {
23 ok(gProcess._dbgProcess,
24 "The remote debugger process wasn't created properly!");
25 ok(gProcess._dbgProcess.isRunning,
26 "The remote debugger process isn't running!");
27 is(typeof gProcess._dbgProcess.pid, "number",
28 "The remote debugger process doesn't have a pid (?!)");
29
30 info("process location: " + gProcess._dbgProcess.location);
31 info("process pid: " + gProcess._dbgProcess.pid);
32 info("process name: " + gProcess._dbgProcess.processName);
33 info("process sig: " + gProcess._dbgProcess.processSignature);
34
35 ok(gProcess._dbgProfile,
36 "The remote debugger profile wasn't created properly!");
37 ok(gProcess._dbgProfile.localDir,
38 "The remote debugger profile doesn't have a localDir...");
39 ok(gProcess._dbgProfile.rootDir,
40 "The remote debugger profile doesn't have a rootDir...");
41 ok(gProcess._dbgProfile.name,
42 "The remote debugger profile doesn't have a name...");
43
44 info("profile localDir: " + gProcess._dbgProfile.localDir.path);
45 info("profile rootDir: " + gProcess._dbgProfile.rootDir.path);
46 info("profile name: " + gProcess._dbgProfile.name);
47
48 let profileService = Cc["@mozilla.org/toolkit/profile-service;1"]
49 .createInstance(Ci.nsIToolkitProfileService);
50
51 let profile = profileService.getProfileByName(gProcess._dbgProfile.name);
52
53 ok(profile,
54 "The remote debugger profile wasn't *actually* created properly!");
55 is(profile.localDir.path, gProcess._dbgProfile.localDir.path,
56 "The remote debugger profile doesn't have the correct localDir!");
57 is(profile.rootDir.path, gProcess._dbgProfile.rootDir.path,
58 "The remote debugger profile doesn't have the correct rootDir!");
59
60 gProcess.close();
61 }
62
63 function aOnClose() {
64 ok(!gProcess._dbgProcess.isRunning,
65 "The remote debugger process isn't closed as it should be!");
66 is(gProcess._dbgProcess.exitValue, (Services.appinfo.OS == "WINNT" ? 0 : 256),
67 "The remote debugger process didn't die cleanly.");
68
69 info("process exit value: " + gProcess._dbgProcess.exitValue);
70
71 info("profile localDir: " + gProcess._dbgProfile.localDir.path);
72 info("profile rootDir: " + gProcess._dbgProfile.rootDir.path);
73 info("profile name: " + gProcess._dbgProfile.name);
74
75 finish();
76 }
77
78 registerCleanupFunction(function() {
79 gProcess = null;
80 });

mercurial