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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/debugger/test/browser_dbg_chrome-create.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,80 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +/**
     1.8 + * Tests that a chrome debugger can be created in a new process.
     1.9 + */
    1.10 +
    1.11 +let gProcess;
    1.12 +
    1.13 +function test() {
    1.14 +  // Windows XP and 8.1 test slaves are terribly slow at this test.
    1.15 +  requestLongerTimeout(5);
    1.16 +
    1.17 +  initChromeDebugger(aOnClose).then(aProcess => {
    1.18 +    gProcess = aProcess;
    1.19 +
    1.20 +    info("Starting test...");
    1.21 +    performTest();
    1.22 +  });
    1.23 +}
    1.24 +
    1.25 +function performTest() {
    1.26 +  ok(gProcess._dbgProcess,
    1.27 +    "The remote debugger process wasn't created properly!");
    1.28 +  ok(gProcess._dbgProcess.isRunning,
    1.29 +    "The remote debugger process isn't running!");
    1.30 +  is(typeof gProcess._dbgProcess.pid, "number",
    1.31 +    "The remote debugger process doesn't have a pid (?!)");
    1.32 +
    1.33 +  info("process location: " + gProcess._dbgProcess.location);
    1.34 +  info("process pid: " + gProcess._dbgProcess.pid);
    1.35 +  info("process name: " + gProcess._dbgProcess.processName);
    1.36 +  info("process sig: " + gProcess._dbgProcess.processSignature);
    1.37 +
    1.38 +  ok(gProcess._dbgProfile,
    1.39 +    "The remote debugger profile wasn't created properly!");
    1.40 +  ok(gProcess._dbgProfile.localDir,
    1.41 +    "The remote debugger profile doesn't have a localDir...");
    1.42 +  ok(gProcess._dbgProfile.rootDir,
    1.43 +    "The remote debugger profile doesn't have a rootDir...");
    1.44 +  ok(gProcess._dbgProfile.name,
    1.45 +    "The remote debugger profile doesn't have a name...");
    1.46 +
    1.47 +  info("profile localDir: " + gProcess._dbgProfile.localDir.path);
    1.48 +  info("profile rootDir: " + gProcess._dbgProfile.rootDir.path);
    1.49 +  info("profile name: " + gProcess._dbgProfile.name);
    1.50 +
    1.51 +  let profileService = Cc["@mozilla.org/toolkit/profile-service;1"]
    1.52 +    .createInstance(Ci.nsIToolkitProfileService);
    1.53 +
    1.54 +  let profile = profileService.getProfileByName(gProcess._dbgProfile.name);
    1.55 +
    1.56 +  ok(profile,
    1.57 +    "The remote debugger profile wasn't *actually* created properly!");
    1.58 +  is(profile.localDir.path, gProcess._dbgProfile.localDir.path,
    1.59 +    "The remote debugger profile doesn't have the correct localDir!");
    1.60 +  is(profile.rootDir.path, gProcess._dbgProfile.rootDir.path,
    1.61 +    "The remote debugger profile doesn't have the correct rootDir!");
    1.62 +
    1.63 +  gProcess.close();
    1.64 +}
    1.65 +
    1.66 +function aOnClose() {
    1.67 +  ok(!gProcess._dbgProcess.isRunning,
    1.68 +    "The remote debugger process isn't closed as it should be!");
    1.69 +  is(gProcess._dbgProcess.exitValue, (Services.appinfo.OS == "WINNT" ? 0 : 256),
    1.70 +    "The remote debugger process didn't die cleanly.");
    1.71 +
    1.72 +  info("process exit value: " + gProcess._dbgProcess.exitValue);
    1.73 +
    1.74 +  info("profile localDir: " + gProcess._dbgProfile.localDir.path);
    1.75 +  info("profile rootDir: " + gProcess._dbgProfile.rootDir.path);
    1.76 +  info("profile name: " + gProcess._dbgProfile.name);
    1.77 +
    1.78 +  finish();
    1.79 +}
    1.80 +
    1.81 +registerCleanupFunction(function() {
    1.82 +  gProcess = null;
    1.83 +});

mercurial