chromium/third_party/blink/web_tests/http/tests/misc/image-blocked-src-change.html

<html>
    <head>
    <script type="text/ecmascript">
        function logSuccessOrFailure()
        {
            var console = document.getElementById('console');
            var image = document.getElementById('image');

            if (image.naturalHeight && image.naturalWidth)
                console.innerHTML = "PASSED";
            else
                console.innerHTML = "FAILED";

            if (window.testRunner)
                testRunner.notifyDone();
        }

        function changeSrc()
        {
            if (window.testRunner) {
                testRunner.dumpAsText();
                testRunner.waitUntilDone();
            }
            var image = document.getElementById('image');

            if (image.naturalHeight || image.naturalWidth) {
                console.innerHTML = "FAILED";
                return;
            }

            image.src = "../security/resources/green250x50.png";

            // The image may not be loaded, so just wait a little
            // before checking if it was loaded.
            window.setTimeout("logSuccessOrFailure()", 100);
        }
    </script>
    </head>
    <body onload="changeSrc()">
        <p> Test case for <a href="https://bugs.webkit.org/show_bug.cgi?id=17897"> bug 17897 </a>:  Not Rendering Images Imported from XHTML Document </p>
        <p> You should see PASSED once and 250 x 50 green box. The console should also show a blocked attempt to load a local resource.</p>
        <p id='console'> </p>
        <!-- This image should be blocked (see security/local-image-from-remote.html) -->
        <img id='image' src="file:///tmp/web_tests/http/tests/security/resources/compass.jpg"/>
    </body>
</html>