| <!DOCTYPE> |
| <html> |
| <head> |
| <title>Video with poster</title> |
| <script> |
| |
| var count = 0; |
| function log(str) |
| { |
| document.getElementById('result').innerHTML += str + "<br>"; |
| } |
| |
| function hasLayers() |
| { |
| if (window.testRunner) |
| return window.internals.layerTreeAsText(document) != ""; |
| return false; |
| } |
| |
| function checkLayers(prefix, wantsLayers) |
| { |
| var layers = hasLayers(); |
| log(prefix + " <br> " + (wantsLayers == layers ? "PASS" : "FAIL") + ": wants layers = " + wantsLayers + ", has layers = " + layers); |
| log(""); |
| } |
| |
| function layerTest() |
| { |
| var video = document.getElementsByTagName('video')[0]; |
| |
| switch (event.type) |
| { |
| case "load": |
| checkLayers("No src, no poster", false); |
| video.src = "../resources/video." + (video.canPlayType("video/ogg") ? "ogv" : "mp4"); |
| video.poster = "../resources/apple.jpg"; |
| break; |
| case "canplaythrough": |
| checkLayers("Displaying poster", false); |
| video.currentTime = 0.5; |
| break; |
| case "seeked": |
| checkLayers("Displaying movie", true); |
| if (window.testRunner) |
| testRunner.notifyDone(); |
| break; |
| } |
| } |
| |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| testRunner.waitUntilDone(); |
| } |
| window.addEventListener('load', layerTest, false); |
| </script> |
| </head> |
| <body> |
| |
| <video oncanplaythrough="layerTest()" onseeked="layerTest()"></video> |
| |
| <p>A <video> should not have a layer until playback begins.<br> |
| This test can not be run manually, it requires testRunner.layerTreeAsText.</p> |
| <p id="result"></p> |
| |
| </body> |
| </html> |