<html>
<head>
<script type="text/javascript">
    var startElem;
    var targetElem;
    var consoleElm;

    window.onload = function()
    {
        startElem = document.getElementById("startElem");
        targetElem = document.getElementById("targetElem");
        consoleElm = document.getElementById("console");

        if (!startElem || !targetElem || !consoleElm)
            return;

        runTest();
    }

    function pass()
    {
        var div = document.createElement("div");
        document.getElementById("console").appendChild(div);
        div.innerHTML = "PASS";
    };

    function runTest()
    {
        if (!window.eventSender)
            return;

        if (window.testRunner)
            testRunner.dumpAsText();

        var startX = startElem.offsetLeft + 10;
        var startY = startElem.offsetTop + startElem.offsetHeight / 2;
        var endX = targetElem.offsetLeft + 10;
        var endY = targetElem.offsetTop + targetElem.offsetHeight / 2;

        eventSender.mouseMoveTo(startX, startY);
        eventSender.leapForward(100);
        eventSender.mouseMoveTo(endX, endY);

        var testContainer = document.getElementById("test-container");
        if (testContainer)
            document.body.removeChild(testContainer);
    }
</script>
</head>
<body>
    <p id="description">This should test if the test driver doesn't eat the last event if there's a leapForward call beforehand.</p>
    <div id="test-container">
        <br/><br/>
        <div id="targetElem" style="border: 1px dashed" onmouseover="pass()">Pass the mouse over me.<br/><br/></div>
        <hr/>
        <div id="startElem">Mouse start location</div>
        <hr/>
    </div>
    <div id="console"></div>
</body>
</html>
