<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->

<html>
<head>
    <meta name="viewport" content="initial-scale=1.0">
    <style>
        body {
            height: 2000px;
            margin: 0;
        }

        .fixed {
            position: fixed;
        }
        
        .fixed-bar {
            position: fixed;
            top: 10px;
            left: 0;
            height: 100px;
            width: 400px;
            background-color: blue;
        }
    </style>
    <script>
        if (window.testRunner)
            testRunner.waitUntilDone();

        function getScrollDownUIScript()
        {
            return `(function() {
                uiController.scrollToOffset(0, 300);
                
                uiController.didEndScrollingCallback = function() {
                    uiController.uiScriptComplete();
                };
            })();`;
        }
        
        function makeBodyFixed()
        {
            document.body.classList.add('fixed');
            testRunner.notifyDone();
        }

        function doTest()
        {
            if (!testRunner.runUIScript)
                return

            testRunner.runUIScript(getScrollDownUIScript(), function() {
                makeBodyFixed();
            });
        }
        
        window.addEventListener('load', doTest, false);
    </script>
</head>
<body>
    <div class="fixed-bar"></div>
</body>
</html>
