blob: 640e9d2f1116b14ac3ab772fe69130ff2466d299 [file] [log] [blame]
<html>
<head>
<script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
<script>
window.addEventListener("touchstart", logEvent);
window.addEventListener("touchend", logEvent);
window.addEventListener("touchmove", logEvent);
function logEvent(event)
{
log("-----Event-----");
log("type: " + event.type);
if (event.shiftKey)
log("shiftKey");
log("----Touches----");
for (var i = 0; i < event.touches.length; i++) {
var touch = event.touches[i];
log("id: " + i);
log("pageX: " + touch.pageX);
log("pageY: " + touch.pageY);
log("radiusX: " + touch.radiusX);
log("radiusY: " + touch.radiusY);
log("rotationAngle: " + touch.rotationAngle);
log("force: " + touch.force);
}
}
function test()
{
var events = [
{
"type": "touchStart",
"touchPoints": [
{
"state": "touchPressed",
"x": 100,
"y": 200
}
]
},
{
"type": "touchMove",
"touchPoints": [
{
"state": "touchMoved",
"x": 100,
"y": 200
}
]
},
{
"type": "touchEnd",
"touchPoints": [
{
"state": "touchReleased",
"x": 100,
"y": 200
}
]
},
{
"type": "touchStart",
"touchPoints": [
{
"state": "touchPressed",
"x": 20,
"y": 30,
"id": 0
},
{
"state": "touchPressed",
"x": 100,
"y": 200,
"radiusX": 5,
"radiusY": 6,
"rotationAngle": 1.0,
"force": 0.0,
"id": 1
}
],
"modifiers": 8 // shift
},
{
"type": "touchEnd",
"touchPoints": [
{
"state": "touchReleased",
"x": 100,
"y": 100,
"id": 0
},
{
"state": "touchReleased",
"x": 100,
"y": 200,
"id": 1
}
]
}
];
for (var i = 0; i < events.length; i++)
InspectorTest.sendCommand("Input.dispatchTouchEvent", events[i], checkResponse.bind(undefined, i == events.length - 1));
function checkResponse(isLastCommand, msg)
{
if (msg.error)
InspectorTest.log("Error: " + msg.error.message);
if (isLastCommand)
InspectorTest.completeTest();
}
}
</script>
</head>
<body onload="runTest()">
</body>
</html>