<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 input = document.getElementById('shortTextField');
           if (window.eventSender) {
               var x = input.offsetLeft + 7;
               var y = input.offsetTop + 7;
               eventSender.dragMode = false;
               eventSender.mouseMoveTo(x, y);
               eventSender.mouseDown();
               eventSender.mouseMoveTo(x + 20, y);
               eventSender.mouseMoveTo(x + 600, y);
           }
           setTimeout(autoscrollTestPart2, 100);
       }

       function autoscrollTestPart2()
       {
           if (window.eventSender)
               eventSender.mouseUp();
           
           var input = document.getElementById('shortTextField');
           if (input.scrollLeft == 0)
               log("FAILED the textfield should have been scrolled");
           else
               log("PASSED");
           
           if (window.testRunner)
               testRunner.notifyDone();
       }       
        </script>
    </head>
<body onload="test()">
    <div id="console">
    <input id="shortTextField" value="This text should be autoscrollable and if it doesn't then the test failed" size="25">
       https://bugs.webkit.org/show_bug.cgi?id=20201 <br>
       To do the test manually you have to try triggering the autoscroll by starting the dragging from within the text field and moving to the right. If the autoscroll occurs the test has PASSED.<br>
   </div>
    
</body>
</html>

