browser/devtools/webconsole/test/browser_webconsole_output_events.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_output_events.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,60 @@
     1.4 +/*
     1.5 + * Any copyright is dedicated to the Public Domain.
     1.6 + * http://creativecommons.org/publicdomain/zero/1.0/
     1.7 + */
     1.8 +
     1.9 +// Test the webconsole output for DOM events.
    1.10 +
    1.11 +const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console-output-events.html";
    1.12 +
    1.13 +function test() {
    1.14 +  addTab(TEST_URI);
    1.15 +  browser.addEventListener("load", function onLoad() {
    1.16 +    browser.removeEventListener("load", onLoad, true);
    1.17 +    Task.spawn(runner);
    1.18 +  }, true);
    1.19 +
    1.20 +  function* runner()
    1.21 +  {
    1.22 +    let hud = yield openConsole();
    1.23 +
    1.24 +    hud.jsterm.clearOutput();
    1.25 +    hud.jsterm.execute("testDOMEvents()");
    1.26 +
    1.27 +    yield waitForMessages({
    1.28 +      webconsole: hud,
    1.29 +      messages: [{
    1.30 +        name: "testDOMEvents() output",
    1.31 +        text: "undefined",
    1.32 +        category: CATEGORY_OUTPUT,
    1.33 +      }],
    1.34 +    });
    1.35 +
    1.36 +    EventUtils.synthesizeMouse(content.document.body, 2, 2, {type: "mousemove"}, content);
    1.37 +
    1.38 +    yield waitForMessages({
    1.39 +      webconsole: hud,
    1.40 +      messages: [{
    1.41 +        name: "console.log() output for mousemove",
    1.42 +        text: /"eventLogger" mousemove { target: .+, buttons: 1, clientX: \d+, clientY: \d+, layerX: \d+, layerY: \d+ }/,
    1.43 +        category: CATEGORY_WEBDEV,
    1.44 +        severity: SEVERITY_LOG,
    1.45 +      }],
    1.46 +    });
    1.47 +
    1.48 +    content.focus();
    1.49 +    EventUtils.synthesizeKey("a", {shiftKey: true}, content);
    1.50 +
    1.51 +    yield waitForMessages({
    1.52 +      webconsole: hud,
    1.53 +      messages: [{
    1.54 +        name: "console.log() output for keypress",
    1.55 +        text: /"eventLogger" keypress Shift { target: .+, key: .+, charCode: \d+, keyCode: \d+ }/,
    1.56 +        category: CATEGORY_WEBDEV,
    1.57 +        severity: SEVERITY_LOG,
    1.58 +      }],
    1.59 +    });
    1.60 +
    1.61 +    finishTest();
    1.62 +  }
    1.63 +}

mercurial