browser/devtools/webconsole/test/browser_webconsole_start_netmon_first.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/webconsole/test/browser_webconsole_start_netmon_first.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,37 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +// Check that the webconsole works if the network monitor is first opened, then
     1.9 +// the user switches to the webconsole. See bug 970914.
    1.10 +
    1.11 +function test() {
    1.12 +  Task.spawn(runner).then(finishTest);
    1.13 +
    1.14 +  function* runner() {
    1.15 +    const {tab} = yield loadTab("data:text/html;charset=utf8,<p>hello");
    1.16 +
    1.17 +    const target = TargetFactory.forTab(tab);
    1.18 +    const toolbox = yield gDevTools.showToolbox(target, "netmonitor");
    1.19 +
    1.20 +    const hud = yield openConsole(tab);
    1.21 +
    1.22 +    hud.jsterm.execute("console.log('foobar bug970914')");
    1.23 +
    1.24 +    yield waitForMessages({
    1.25 +      webconsole: hud,
    1.26 +      messages: [{
    1.27 +        name: "console.log",
    1.28 +        text: "foobar bug970914",
    1.29 +        category: CATEGORY_WEBDEV,
    1.30 +        severity: SEVERITY_LOG,
    1.31 +      }],
    1.32 +    });
    1.33 +
    1.34 +    let text = hud.outputNode.textContent;
    1.35 +    isnot(text.indexOf("foobar bug970914"), -1, "console.log message confirmed");
    1.36 +    ok(!/logging API|disabled by a script/i.test(text),
    1.37 +       "no warning about disabled console API");
    1.38 +  }
    1.39 +}
    1.40 +

mercurial