<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body onload="runTest();" onclick="doNothing();">
<div style="transform: translateZ(0); position: relative; left: 10px; top: 40px">
<a href="" id="targetLink" style="-webkit-tap-highlight-color: rgba(0, 255, 0, 0.5)">Target Link.</a>
</div>
<div style="position: relative; left: 10px; top: 70px">
This test is successful if "Target Link" above is covered in a green rectangle.
</div>
<script>
function runTest() {
    var clientRect = document.getElementById('targetLink').getBoundingClientRect();
    x = (clientRect.left + clientRect.right) / 2;
    y = (clientRect.top + clientRect.bottom) / 2;
    if (window.testRunner) {
        testRunner.dumpAsTextWithPixelResults();
        testRunner.waitUntilDone();
    }

    if (window.eventSender) {
        // Generate valid link highlight.
        eventSender.gestureShowPress(x, y);

        // Send GestureTapCancel, this should cause the highlight to animate away.
        // FIXME: remove params from all gestureTapCancel calls in LayoutTests
        eventSender.gestureTapCancel(x, y);
        window.setTimeout(function() { window.testRunner.notifyDone(); }, 0);
    } else {
        debug("This test requires DumpRenderTree.");
    }
}
</script>
</body>
</html>