browser/devtools/webconsole/test/browser_webconsole_assert.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 /* vim:set ts=2 sw=2 sts=2 et: */
     2 /* Any copyright is dedicated to the Public Domain.
     3  * http://creativecommons.org/publicdomain/zero/1.0/ */
     5 // Test that console.assert() works as expected (i.e. outputs only on falsy
     6 // asserts). See bug 760193.
     8 const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console-assert.html";
    10 function test() {
    11   addTab(TEST_URI);
    12   browser.addEventListener("load", function onLoad() {
    13     browser.removeEventListener("load", onLoad, true);
    14     openConsole(null, consoleOpened);
    15   }, true);
    16 }
    18 function consoleOpened(hud) {
    19   waitForMessages({
    20     webconsole: hud,
    21     messages: [{
    22       text: "start",
    23       category: CATEGORY_WEBDEV,
    24       severity: SEVERITY_LOG,
    25     },
    26     {
    27       text: "false assert",
    28       category: CATEGORY_WEBDEV,
    29       severity: SEVERITY_ERROR,
    30     },
    31     {
    32       text: "falsy assert",
    33       category: CATEGORY_WEBDEV,
    34       severity: SEVERITY_ERROR,
    35     },
    36     {
    37       text: "end",
    38       category: CATEGORY_WEBDEV,
    39       severity: SEVERITY_LOG,
    40     }],
    41   }).then(() => {
    42     let nodes = hud.outputNode.querySelectorAll(".message");
    43     is(nodes.length, 4, "only four messages are displayed, no output from the true assert");
    44     finishTest();
    45   });
    47   let button = content.document.querySelector("button");
    48   ok(button, "we have the button");
    49   EventUtils.sendMouseEvent({ type: "click" }, button, content);
    50 }

mercurial