<!DOCTYPE html>
<html>
<meta name="fuzzy" content="maxDifference=0-1;totalPixels=14400-14600" />
<style>
    .box {
        width: 200px;
        height: 50px;
        display: inline-block;
        zoom: 2;
        image-rendering: crisp-edges;
    }
    .image-background {
        background-position: 0px -16500px;
    }
</style>
<body>
    <div class="box image-background"></div>
    <script>
        (function() {
            if (window.internals && window.testRunner) {
                internals.clearMemoryCache();
                internals.settings.setWebkitImageReadyEventEnabled(true);
                internals.settings.setLargeImageAsyncDecodingEnabled(true);
                testRunner.waitUntilDone();
            }

            var image = new Image();
            image.onload = function() {
                // Force async image decoding for this image.
                if (window.internals)
                    internals.setLargeImageAsyncDecodingEnabledForTesting(image, true);

                // Change the background of the element.
                var element = document.getElementsByClassName("image-background")[0];
                element.style.backgroundImage = 'url(' + image.src + ')';
 
                if (window.internals && window.testRunner) {
                    // Force layout and display so the image frame starts decoding.
                    document.body.offsetHeight;
                    testRunner.display();
 
                    // Wait for the image frame to finish decoding before finishing the test.
                    element.addEventListener("webkitImageFrameReady", function() {
                        // Ensure internals.destroyDecodedDataForAllImages() will not destroy
                        // the image's decoded data because it is inside the viewport.
                        internals.destroyDecodedDataForAllImages();
                        testRunner.notifyDone();
                    }, false);
                }
            }
            image.src = "resources/sprite-sheet-red-green-blue.png";
        })();
    </script>
</body>
</html>
