Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / media / video-source-error-no-candidate.html
blob347192d7621b9eec8d73452c020323f4a486e5b0
1 <html lang="en">
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
4 <title>&lt;video&gt; and &lt;source&gt; error test</title>
5 <script src=video-test.js></script>
7 <script>
9 var sources = [];
10 var errorCount = 0;
11 var expectedErrorCount = 4;
13 function errorEvent(evt)
15 consoleWrite("");
17 var ndx;
18 for (ndx = 0; ndx < sources.length; ndx++) {
19 if (sources[ndx] == evt.target)
20 break;
23 var src = sources[ndx].getAttribute('src') == null ? "null" : "'" + relativeURL(evt.target.src) + "'";
24 if (sources[ndx] == evt.target)
25 logResult(true, "EVENT(error) from &lt;source id='<em>" + evt.target.id + "</em>' src=<em>" + src + "</em>&gt;");
26 else
27 logResult(false, "EVENT(error) from " + evt.target);
29 testExpected("video.error", null);
31 if (++errorCount == expectedErrorCount) {
32 consoleWrite("");
33 setTimeout(endTest, 200);
37 function start()
39 document.addEventListener("error", errorEvent, true);
41 sources = document.getElementsByTagName('source');
43 findMediaElement();
45 </script>
46 </head>
48 <body>
50 <video onloadstart="start()" controls>
51 <source id=missing-src type="video/blahblah">
52 <source id=bogus-type src=content/test.ogv type="video/blahblah">
53 <source id=empty-src src="" type="video/ogg">
54 <source id=no-extension-no-type src=nonexistent>
55 </video>
57 <p>Test that 'error' events are fired from &lt;source&gt; element when it can not be used.</p>
59 </body>
60 </html>