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

mercurial