blob: 5c018f108b9c7a3faac604b3fe3aee9e45f74066 [file] [log] [blame]
<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
<html>
<meta name="viewport" content="initial-scale=1.0, width=device-width">
<head>
<style>
#target {
height: 100px;
width: 100px;
background-color: gray;
}
</style>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
function getUIScript(x, y)
{
return `
(function() {
var eventStream = {
events : [
{
inputType : "hand",
timeOffset : 0,
touches : [
{
inputType : "finger",
phase : "began",
id : 1,
x : ${x},
y : ${y}
}
]
},
{
inputType : "hand",
timeOffset : 0.0005,
touches : [
{
inputType : "finger",
phase : "ended",
id : 1,
x : ${x},
y : ${y}
}
]
},
]
};
uiController.sendEventStream(JSON.stringify(eventStream), function() {
uiController.uiScriptComplete();
});
})();`
}
function handleClick()
{
document.getElementById("result").textContent = "PASS: received click.";
if (window.testRunner)
testRunner.notifyDone();
}
function runTest()
{
var target = document.getElementById("target");
target.addEventListener("click", handleClick, false);
if (!testRunner.runUIScript)
return;
testRunner.runUIScript(getUIScript(60, 60), function() {});
}
window.addEventListener("load", runTest, false);
</script>
</head>
<body>
<div id="target"></div>
<div id="result">FAIL: did not receive click event.</div>
</body>
</html>