| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/resource
s/inspector-protocol-test.js"></script> | |
| 4 <script> | |
| 5 | |
| 6 function addListeners() | |
| 7 { | |
| 8 window.addEventListener("mousedown", logEvent); | |
| 9 window.addEventListener("mouseup", logEvent); | |
| 10 window.addEventListener("mousemove", logEvent); | |
| 11 window.addEventListener("contextmenu", logEvent); | |
| 12 } | |
| 13 | |
| 14 function logEvent(event) | |
| 15 { | |
| 16 log("-----Event-----"); | |
| 17 log("type: " + event.type); | |
| 18 log("button: " + event.button); | |
| 19 if (event.shiftKey) | |
| 20 log("shiftKey"); | |
| 21 log("x: " + event.x); | |
| 22 log("y: " + event.y); | |
| 23 event.preventDefault(); | |
| 24 } | |
| 25 | |
| 26 function test() | |
| 27 { | |
| 28 var events = [ | |
| 29 { | |
| 30 "type": "mousePressed", | |
| 31 "button": "left", | |
| 32 "clickCount": 1, | |
| 33 "x": 100, | |
| 34 "y": 200 | |
| 35 }, | |
| 36 { | |
| 37 "type": "mouseReleased", | |
| 38 "button": "left", | |
| 39 "clickCount": 1, | |
| 40 "x": 100, | |
| 41 "y": 200 | |
| 42 }, | |
| 43 { | |
| 44 "type": "mouseMoved", | |
| 45 "modifiers": 8, // shift | |
| 46 "x": 50, | |
| 47 "y": 150 | |
| 48 }, | |
| 49 { | |
| 50 "type": "mousePressed", | |
| 51 "button": "right", | |
| 52 "clickCount": 1, | |
| 53 "x": 100, | |
| 54 "y": 200 | |
| 55 }, | |
| 56 { | |
| 57 "type": "mouseReleased", | |
| 58 "button": "right", | |
| 59 "clickCount": 1, | |
| 60 "x": 100, | |
| 61 "y": 200 | |
| 62 } | |
| 63 ]; | |
| 64 | |
| 65 InspectorTest.evaluateInPage("addListeners();", function() { | |
| 66 for (var i = 0; i < events.length; i++) | |
| 67 InspectorTest.sendCommand("Input.dispatchMouseEvent", events[i], che
ckResponse.bind(undefined, i == events.length - 1)); | |
| 68 }); | |
| 69 | |
| 70 function checkResponse(isLastCommand, msg) | |
| 71 { | |
| 72 if (msg.error) | |
| 73 InspectorTest.log("Error: " + msg.error.message); | |
| 74 if (isLastCommand) | |
| 75 InspectorTest.completeTest(); | |
| 76 } | |
| 77 } | |
| 78 | |
| 79 </script> | |
| 80 </head> | |
| 81 <body onload="runTest()"> | |
| 82 </body> | |
| 83 </html> | |
| OLD | NEW |