chromium/third_party/blink/web_tests/fast/events/autoscroll.html

<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
    let originalScrollOffset;
    let t = async_test("Scroll Offset Hasn't Changed");

    function test()
    {
        setTimeout(autoscrollTestPart1, 0);
    }
    function autoscrollTestPart1()
    {
        var ta = document.getElementById('ta');
        if (window.eventSender) {
            ta.scrollIntoView();
            var h = ta.offsetTop - document.scrollingElement.scrollTop + 10;
            originalScrollOffset = window.scrollY;
            eventSender.dragMode = false;
            eventSender.mouseMoveTo(20, h);
            eventSender.mouseDown();
            eventSender.mouseMoveTo(20, h);
            eventSender.mouseMoveTo(100, h);
        }
        setTimeout(autoscrollTestPart2, 100);
    }
    function autoscrollTestPart2()
    {
        if (window.eventSender)
            eventSender.mouseUp();
        t.step(() => {
          assert_not_equals(window.getSelection().toString(), "");
          assert_equals(window.scrollY, originalScrollOffset);
        });
        t.done();
    }
    function log(msg)
    {
        var res = document.getElementById('res');
        res.innerHTML = res.innerHTML + msg + "<br>";
    }

    addEventListener('load', test);
</script>
<p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=12331">bug 12331</a>.</p>
<p>To test manually, scroll down until you find the input element. Select some text. If the bug occurs, the page will scroll back up to the top.</p>
<div style="height:3000px"></div>
<input id="ta" value="select some of this text"></input>
<p>If the bug does not occur, you'll be left down here at the bottom.</p>