<html>
    <head>
        <script>
       function log(msg)
       {
           document.getElementById('console').appendChild(document.createTextNode(msg + '\n'));
       }

       function test()
       {
           if (window.testRunner) {
               testRunner.waitUntilDone();
               testRunner.dumpAsText();
               setTimeout(autoscrollTestPart1, 0);
           }
       }

       function autoscrollTestPart1()
       {
           var textInDiv = document.getElementById('textInDiv');
           if (window.eventSender) {
               var x = textInDiv.offsetLeft + 17;
               var y = textInDiv.offsetTop + 7;
               eventSender.dragMode = false;
               eventSender.mouseMoveTo(x, y);
               eventSender.mouseDown();
               eventSender.mouseMoveTo(x, y + 20);
               eventSender.mouseMoveTo(x, y + 220);
           }
           setTimeout(autoscrollTestPart2, 100);
       }

       function autoscrollTestPart2()
       {
           if (window.eventSender)
               eventSender.mouseUp();
           var sd = document.getElementById('nonScrollableDiv');
           if (sd.scrollTop == 0)
               log("PASSED : the autoscroll did not happen!");
           else
               log("FAILED : the autoscroll has happened :-(");
           
           if (window.testRunner)
               testRunner.notifyDone();
       }       
        </script>
    </head>
<body onload="test()">
   <div id="nonScrollableDiv" style="height: 100px; overflow-x: auto; overflow-y: hidden; width: 100px">
       <div id="tailDiv" style=" height: 1000px; background-color: yellow">
           <span id='textInDiv'> Try to autoscroll this text.<br>
       </div>
   </div>
   <div id="console"></div>
</body>
</html>
