chromium/third_party/blink/web_tests/http/tests/misc/canvas-pattern-from-incremental-image.html

Tests that incomplete (not fully loaded/decoded) images cannot be used to create a CanvasPattern.<br/><br/>
<script>
if (window.testRunner)
    testRunner.dumpAsText();

var canvas = document.createElement("canvas");
var ctx = canvas.getContext('2d');
ctx.fillRect(0,0,150,150);
var img = new Image();
img.src = 'resources/image-slow.pl';
var ptrn
try {
    ptrn = ctx.createPattern(img, 'repeat');
    if (!img.complete)
        document.write("PASS - image is not complete");
    else
        document.write("FAIL - image is complete");
    document.write("<br/>");
    if (!ptrn)
        document.write("PASS - createPattern() failed for incomplete image");
    else
        document.write("FAIL - createPattern() succeeded for incomplete image");
} catch (e) {
    document.write("FAIL - caught exception: " + e);
}
</script>