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.

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 /**
     5  * Tests that a chrome debugger can be created in a new process.
     6  */
     8 let gProcess;
    10 function test() {
    11   // Windows XP and 8.1 test slaves are terribly slow at this test.
    12   requestLongerTimeout(5);
    14   initChromeDebugger(aOnClose).then(aProcess => {
    15     gProcess = aProcess;
    17     info("Starting test...");
    18     performTest();
    19   });
    20 }
    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 (?!)");
    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);
    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...");
    44   info("profile localDir: " + gProcess._dbgProfile.localDir.path);
    45   info("profile rootDir: " + gProcess._dbgProfile.rootDir.path);
    46   info("profile name: " + gProcess._dbgProfile.name);
    48   let profileService = Cc["@mozilla.org/toolkit/profile-service;1"]
    49     .createInstance(Ci.nsIToolkitProfileService);
    51   let profile = profileService.getProfileByName(gProcess._dbgProfile.name);
    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!");
    60   gProcess.close();
    61 }
    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.");
    69   info("process exit value: " + gProcess._dbgProcess.exitValue);
    71   info("profile localDir: " + gProcess._dbgProfile.localDir.path);
    72   info("profile rootDir: " + gProcess._dbgProfile.rootDir.path);
    73   info("profile name: " + gProcess._dbgProfile.name);
    75   finish();
    76 }
    78 registerCleanupFunction(function() {
    79   gProcess = null;
    80 });

mercurial