<body>
    <script>
        function resolvedImageSourceURL() {
            return "http://127.0.0.1:8000/resources/load-and-stall.py"
                 + "?name=../../../fast/images/resources/green-400x400.png"
                 + "&mimeType=image%2Fpng"
                 + "&stallAt=1024"
                 + "&stallFor=1";
        }

        (function() {
            if (window.internals && window.testRunner) {
                internals.clearMemoryCache();
                internals.settings.setLargeImageAsyncDecodingEnabled(true);
                testRunner.waitUntilDone();
            }

            var image = new Image;
            document.body.appendChild(image);

            // Force async image decoding for this image.
            if (window.internals)
                internals.setAsyncDecodingEnabledForTesting(image, true);

            image.onload = (() => {
                if (window.testRunner)
                    testRunner.notifyDone();
            });
            image.src = resolvedImageSourceURL();
        })();
    </script>
</body>
