browser/devtools/webconsole/test/browser_webconsole_output_events.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /*
michael@0 2 * Any copyright is dedicated to the Public Domain.
michael@0 3 * http://creativecommons.org/publicdomain/zero/1.0/
michael@0 4 */
michael@0 5
michael@0 6 // Test the webconsole output for DOM events.
michael@0 7
michael@0 8 const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console-output-events.html";
michael@0 9
michael@0 10 function test() {
michael@0 11 addTab(TEST_URI);
michael@0 12 browser.addEventListener("load", function onLoad() {
michael@0 13 browser.removeEventListener("load", onLoad, true);
michael@0 14 Task.spawn(runner);
michael@0 15 }, true);
michael@0 16
michael@0 17 function* runner()
michael@0 18 {
michael@0 19 let hud = yield openConsole();
michael@0 20
michael@0 21 hud.jsterm.clearOutput();
michael@0 22 hud.jsterm.execute("testDOMEvents()");
michael@0 23
michael@0 24 yield waitForMessages({
michael@0 25 webconsole: hud,
michael@0 26 messages: [{
michael@0 27 name: "testDOMEvents() output",
michael@0 28 text: "undefined",
michael@0 29 category: CATEGORY_OUTPUT,
michael@0 30 }],
michael@0 31 });
michael@0 32
michael@0 33 EventUtils.synthesizeMouse(content.document.body, 2, 2, {type: "mousemove"}, content);
michael@0 34
michael@0 35 yield waitForMessages({
michael@0 36 webconsole: hud,
michael@0 37 messages: [{
michael@0 38 name: "console.log() output for mousemove",
michael@0 39 text: /"eventLogger" mousemove { target: .+, buttons: 1, clientX: \d+, clientY: \d+, layerX: \d+, layerY: \d+ }/,
michael@0 40 category: CATEGORY_WEBDEV,
michael@0 41 severity: SEVERITY_LOG,
michael@0 42 }],
michael@0 43 });
michael@0 44
michael@0 45 content.focus();
michael@0 46 EventUtils.synthesizeKey("a", {shiftKey: true}, content);
michael@0 47
michael@0 48 yield waitForMessages({
michael@0 49 webconsole: hud,
michael@0 50 messages: [{
michael@0 51 name: "console.log() output for keypress",
michael@0 52 text: /"eventLogger" keypress Shift { target: .+, key: .+, charCode: \d+, keyCode: \d+ }/,
michael@0 53 category: CATEGORY_WEBDEV,
michael@0 54 severity: SEVERITY_LOG,
michael@0 55 }],
michael@0 56 });
michael@0 57
michael@0 58 finishTest();
michael@0 59 }
michael@0 60 }

mercurial