<html>
<head>
<script>

var didNavigate = false;

window.onbeforeunload = function () {
    didNavigate = true;
};

function checkForDone()
{
    if (!didNavigate) {
        var console = document.getElementById("console");
        console.innerHTML = "SUCCESS! We did not navigate to the link after starting a force click.";
    }

    if (window.testRunner)
        testRunner.notifyDone();
}

function spinRunLoop()
{
    window.setTimeout(checkForDone, 0);
}

function startTest()
{
    if (window.testRunner) {
        testRunner.dumpAsText();
        testRunner.waitUntilDone();
    }

    if (window.eventSender) {
        eventSender.mouseMoveTo(16, 16);
        eventSender.startAndCancelMouseForceClick();
        window.setTimeout(spinRunLoop, 0);
    }
}
</script>
</head>

<body onload="startTest()">

<a href="resources/do-not-navigate-here.html">Link</a>
<pre id="console">Failed. This test must be run in the test harness. To run the test manually, start force clicking on the link, but don't click hard enough to pop open the preview. Then make sure that the original document does not navigate anywhere.</pre>

</body>
</html>
