michael@0: /* michael@0: * Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ michael@0: */ michael@0: michael@0: // Test the webconsole output for DOM events. michael@0: michael@0: const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console-output-events.html"; michael@0: michael@0: function test() { michael@0: addTab(TEST_URI); michael@0: browser.addEventListener("load", function onLoad() { michael@0: browser.removeEventListener("load", onLoad, true); michael@0: Task.spawn(runner); michael@0: }, true); michael@0: michael@0: function* runner() michael@0: { michael@0: let hud = yield openConsole(); michael@0: michael@0: hud.jsterm.clearOutput(); michael@0: hud.jsterm.execute("testDOMEvents()"); michael@0: michael@0: yield waitForMessages({ michael@0: webconsole: hud, michael@0: messages: [{ michael@0: name: "testDOMEvents() output", michael@0: text: "undefined", michael@0: category: CATEGORY_OUTPUT, michael@0: }], michael@0: }); michael@0: michael@0: EventUtils.synthesizeMouse(content.document.body, 2, 2, {type: "mousemove"}, content); michael@0: michael@0: yield waitForMessages({ michael@0: webconsole: hud, michael@0: messages: [{ michael@0: name: "console.log() output for mousemove", michael@0: text: /"eventLogger" mousemove { target: .+, buttons: 1, clientX: \d+, clientY: \d+, layerX: \d+, layerY: \d+ }/, michael@0: category: CATEGORY_WEBDEV, michael@0: severity: SEVERITY_LOG, michael@0: }], michael@0: }); michael@0: michael@0: content.focus(); michael@0: EventUtils.synthesizeKey("a", {shiftKey: true}, content); michael@0: michael@0: yield waitForMessages({ michael@0: webconsole: hud, michael@0: messages: [{ michael@0: name: "console.log() output for keypress", michael@0: text: /"eventLogger" keypress Shift { target: .+, key: .+, charCode: \d+, keyCode: \d+ }/, michael@0: category: CATEGORY_WEBDEV, michael@0: severity: SEVERITY_LOG, michael@0: }], michael@0: }); michael@0: michael@0: finishTest(); michael@0: } michael@0: }