<!DOCTYPE html> <!-- webkit-test-runner [ AsyncOverflowScrollingEnabled=true ] -->
<html dir="rtl">
<head>
    <style>
        .wide {
            width: 2000px;
            height: 10px;
            background-color: silver;
        }

        .scroller {
            position: absolute;
            left: 100px;
            top: 20px;
            height: 300px;
            width: 300px;
            border: 20px solid gray;
            padding: 5px;
            margin: 20px;
            overflow: scroll;
        }
        .content {
            width: 200%;
            height: 300%;
        }
    </style>
    <script src="../../../resources/js-test-pre.js"></script>
    <script src="../../../resources/ui-helper.js"></script>
    <script>
        var jsTestIsAsync = true;

        var scroller;
        var overflowScrollEventCount = 0;
        var windowScrollEventCount = 0;

        async function testScrollOverContent()
        {
            debug('');
            debug('Test scroll over content');
            await UIHelper.mouseWheelScrollAt(300, 250); // Over the scroller

            shouldBe('overflowScrollEventCount > 0', 'true');
            shouldBe('windowScrollEventCount', '0');
        }

        async function scrollTest()
        {
            await testScrollOverContent();

            finishJSTest();
        }

        window.addEventListener('load', () => {
            scroller = document.querySelector('.scroller');
            scroller.addEventListener('scroll', () => {
                ++overflowScrollEventCount;
            }, false);

            window.addEventListener('scroll', () => {
                ++windowScrollEventCount;
            }, false);

            setTimeout(scrollTest, 0);
        }, false);
    </script>
</head>
<body>
    <div class="wide"></div>
    <div class="scroller">
        <div class="content"></div>
    </div>
    <div id="console"></div>
    <script src="../../../resources/js-test-post.js"></script>
</body>
</html>
