<html>
<head>
<script>

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

function run() {
if (window.eventSender) {
    var anchor = document.getElementById("start");
    var x = window.frameElement.offsetLeft + anchor.offsetLeft + 2;
    var y = window.frameElement.offsetTop + anchor.offsetTop + 2;
    eventSender.mouseMoveTo(x, y);
    eventSender.mouseDown();
    eventSender.mouseUp();
    setTimeout(finish, 1000);
}

function finish() {
    var result;
    if (window.top.scrollY == 0)
        result = "FAIL: navigating to the anchor should trigger a scroll";
    else
        result = "PASS";

    window.top.document.body.appendChild(document.createTextNode(result));
    if (window.testRunner)
        testRunner.notifyDone();
}

}
</script>
</head>
<body onload="run();">

<a id="start" href="#anchor">Go to anchor</a>
<div style="height: 1000px"></div>
<a name="anchor">Anchor</a>
</body>
</html>
