Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector-protocol / input / dispatchMouseEvent.html
blob296343e796bb9ed8601ef3c650fc6d243f2d1f78
1 <html>
2 <head>
3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
4 <script>
6 function addListeners()
8 window.addEventListener("mousedown", logEvent);
9 window.addEventListener("mouseup", logEvent);
10 window.addEventListener("mousemove", logEvent);
11 window.addEventListener("contextmenu", logEvent);
14 function logEvent(event)
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();
26 function test()
28 var events = [
30 "type": "mousePressed",
31 "button": "left",
32 "clickCount": 1,
33 "x": 100,
34 "y": 200
37 "type": "mouseReleased",
38 "button": "left",
39 "clickCount": 1,
40 "x": 100,
41 "y": 200
44 "type": "mouseMoved",
45 "modifiers": 8, // shift
46 "x": 50,
47 "y": 150
50 "type": "mousePressed",
51 "button": "right",
52 "clickCount": 1,
53 "x": 100,
54 "y": 200
57 "type": "mouseReleased",
58 "button": "right",
59 "clickCount": 1,
60 "x": 100,
61 "y": 200
65 InspectorTest.evaluateInPage("addListeners();", function() {
66 for (var i = 0; i < events.length; i++)
67 InspectorTest.sendCommand("Input.dispatchMouseEvent", events[i], checkResponse.bind(undefined, i == events.length - 1));
68 });
70 function checkResponse(isLastCommand, msg)
72 if (msg.error)
73 InspectorTest.log("Error: " + msg.error.message);
74 if (isLastCommand)
75 InspectorTest.completeTest();
79 </script>
80 </head>
81 <body onload="runTest()">
82 </body>
83 </html>