<html lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>remote &lt;video&gt; with local poster</title>

        <script>

            var console = null;
            var video = null;

            var localImageLocation = "file:///tmp/LayoutTests/http/tests/security/resources/compass.jpg";
            if (window.testRunner) {
                localImageLocation = testRunner.pathToLocalResource(localImageLocation);
                testRunner.dumpAsText();
                testRunner.waitUntilDone();
            }

            function logConsole()
            {
                if (!console && document.body) {
                    console = document.createElement('div');
                    document.body.appendChild(console);
                }
                return console;
            }
            function consoleWrite(text)
            {
                logConsole().innerHTML += text + "<br>";
            }

            function logResult(msg, success)
            {
                if (success)
                    consoleWrite("<span style='color:green'>SUCCESS: " + msg + "</span>");
                else
                    consoleWrite("<span style='color:red'>FAIL: " + msg + "</span>");
            }
            
            function checkPoster()
            {
                document.body.offsetLeft;

                // The poster image is 128x128, so if it loads the element should be that size, otherwise
                // it should be the default 300x150.
                if (video.clientHeight == 150 && video.clientWidth == 300)
                    logResult("Local image failed to load from remote page.", true);
                else
                    logResult("Local image loaded from remote page.", false);

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

            function test() {
                video = document.getElementById("vid");
    
                video.poster=localImageLocation;
                setTimeout(checkPoster, 200);
            }
    
        </script>
    
    </head>

    <body onLoad="test()">

        <video controls id=vid></video>

        <p>Test that a remote video element can not use a local poster</p>

        <p>This test requires the run-webkit httpd server (run-webkit-httpd)</p>

    </body>
</html>
