Add the default video poster if it doesn't exist in video tag
[WebKit-https.git] / LayoutTests / media / video-default-poster.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script>
5   if (window.testRunner) {
6     testRunner.dumpAsText();
7     testRunner.waitUntilDone();
8   }
9   if (window.internals) {
10     var default_poster = 'content/greenbox.png';
11     window.internals.settings.setDefaultVideoPosterURL(default_poster);
12     addEventListener("load", function() {
13       var poster = window.internals.getImageSourceURL(document.getElementById("video-no-poster"));
14       if (poster) {
15         if (poster == default_poster)
16           document.getElementById("result-no-poster").innerText = "PASS";
17         else
18           document.getElementById("result-no-poster").innerText = "FAIL";
19       } else
20         document.getElementById("result-no-poster").innerText = "FAIL: image source is null";
21
22       poster =  window.internals.getImageSourceURL(document.getElementById("video-has-poster"));
23       if (poster) {
24         if (poster == "content/abe.png")
25           document.getElementById("result-has-poster").innerText = "PASS";
26         else
27           document.getElementById("result-has-poster").innerText = "FAIL: poster was changed";
28       } else
29         document.getElementById("result-has-poster").innerText = "FAIL: image source is null";
30
31       poster =  window.internals.getImageSourceURL(document.getElementById("video-has-empty-poster"));
32       if (poster) {
33         if (poster == default_poster)
34           document.getElementById("result-has-empty-poster").innerText = "PASS";
35         else
36           document.getElementById("result-has-empty-poster").innerText = "FAIL";
37       } else
38         document.getElementById("result-has-empty-poster").innerText = "FAIL: image source is null";
39
40       testRunner.notifyDone();
41     }, false);
42   }
43
44 </script>
45 </head>
46 <body>
47 <pre id="result-no-poster"></pre>
48 <pre id="result-has-poster"></pre>
49 <pre id="result-has-empty-poster"></pre>
50 <video id="video-no-poster" src="content/test.mp4" preload="none" />
51 <video id="video-has-poster" src="content/test.mp4" poster="content/abe.png" preload="none" />
52 <video id="video-has-empty-poster" src="content/test.mp4" poster="" preload="none" />
53 </body>
54 </html>