<html>
<head>
<script>
if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

function clickLink() {
    var link = document.getElementById("anchorLink");
    eventSender.mouseMoveTo(link.offsetLeft + 2, link.offsetTop + 2);
    eventSender.mouseDown(); 
    eventSender.mouseUp(); 
}

function run() {
    clickLink();
    window.scroll(0, 0);
    clickLink();
    var scrollY = window.scrollY;
    var line = document.createElement('div');
    line.appendChild(document.createTextNode("Scroll position is " + scrollY + "px"));
    document.getElementById('anchor').appendChild(line);
    testRunner.notifyDone();    
}

</script>
</head>
<body onload="run();">
<div style="height: 600px">
<a id="anchorLink" href="#anchor">Anchor link</a>
</div>
<div id="anchor" style="height: 600px"></div>
</body>
</html>
