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