3 <script type=
"text/javascript" src=
"../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
6 window
.addEventListener("touchstart", logEvent
);
7 window
.addEventListener("touchend", logEvent
);
8 window
.addEventListener("touchmove", logEvent
);
9 window
.addEventListener("touchcancel", logEvent
);
11 function logEvent(event
)
13 event
.preventDefault();
14 log("-----Event-----");
15 log("type: " + event
.type
);
18 log("----Touches----");
19 for (var i
= 0; i
< event
.touches
.length
; i
++) {
20 var touch
= event
.touches
[i
];
22 log("pageX: " + touch
.pageX
);
23 log("pageY: " + touch
.pageY
);
24 log("radiusX: " + touch
.radiusX
);
25 log("radiusY: " + touch
.radiusY
);
26 log("rotationAngle: " + touch
.rotationAngle
);
27 log("force: " + touch
.force
);
29 evaluateInFrontend("onEvent();");
36 "type": "mousePressed",
50 "type": "mouseReleased",
59 "modifiers": 8, // shift
64 "type": "mousePressed",
78 "type": "mouseReleased",
86 var time
= Number(new Date()) / 1000;
89 function sendNextEvent() {
90 if (index
=== events
.length
) {
94 var event
= events
[index
];
95 event
.timestamp
= time
+ index
;
97 InspectorTest
.sendCommand("Input.emulateTouchFromMouseEvent", event
, checkResponse
);
100 function checkResponse(msg
)
103 InspectorTest
.log("Error: " + msg
.error
.message
);
107 const expectedEventCount
= 6;
109 window
.onEvent = function()
115 function maybeFinish()
117 if (index
=== events
.length
&& eventCount
=== expectedEventCount
)
118 InspectorTest
.completeTest();
121 InspectorTest
.sendCommand("Page.enable", {}, function() {
122 InspectorTest
.sendCommand("Page.startScreencast", {}, sendNextEvent
);
128 <body onload=
"runTest()">