browser/devtools/webconsole/test/browser_webconsole_console_extras.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_console_extras.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,42 @@
     1.4 +/* vim:set ts=2 sw=2 sts=2 et: */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +// Test that window.console functions that are not implemented yet do not
    1.10 +// output anything in the web console and they do not throw any exceptions.
    1.11 +// See bug 614350.
    1.12 +
    1.13 +const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console-extras.html";
    1.14 +
    1.15 +function test() {
    1.16 +  addTab(TEST_URI);
    1.17 +  browser.addEventListener("load", function onLoad() {
    1.18 +    browser.removeEventListener("load", onLoad, true);
    1.19 +    openConsole(null, consoleOpened);
    1.20 +  }, true);
    1.21 +}
    1.22 +
    1.23 +function consoleOpened(hud) {
    1.24 +  waitForMessages({
    1.25 +    webconsole: hud,
    1.26 +    messages: [{
    1.27 +      text: "start",
    1.28 +      category: CATEGORY_WEBDEV,
    1.29 +      severity: SEVERITY_LOG,
    1.30 +    },
    1.31 +    {
    1.32 +      text: "end",
    1.33 +      category: CATEGORY_WEBDEV,
    1.34 +      severity: SEVERITY_LOG,
    1.35 +    }],
    1.36 +  }).then(() => {
    1.37 +    let nodes = hud.outputNode.querySelectorAll(".message");
    1.38 +    is(nodes.length, 2, "only two messages are displayed");
    1.39 +    finishTest();
    1.40 +  });
    1.41 +
    1.42 +  let button = content.document.querySelector("button");
    1.43 +  ok(button, "we have the button");
    1.44 +  EventUtils.sendMouseEvent({ type: "click" }, button, content);
    1.45 +}

mercurial