Rubber-stamped by Brady Eidson.
[webbrowser.git] / LayoutTests / media / video-source-error.html
blob47ad6d139f02d03fe07a8ae03ab68feba89d56c0
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=media-file.js></script>
6 <script src=video-test.js></script>
8 <script>
10 var sources = [];
12 function loadeddata()
14 consoleWrite("");
15 testExpected("relativeURL(video.currentSrc)", findMediaFile("video", "content/test"));
16 testExpected("video.error", null);
17 consoleWrite("");
18 endTest();
21 function errorEvent(evt)
23 var ndx;
24 for (ndx = 0; ndx < sources.length; ndx++) {
25 if (sources[ndx] == evt.target)
26 break;
29 if (sources[ndx] == evt.target)
30 logResult(true, "EVENT(error) from &lt;source id='<em>" + evt.target.id + "</em>' src='<em>" + relativeURL(evt.target.src) + "</em>'&gt;");
31 else
32 logResult(false, "EVENT(error) from " + evt.target);
34 testExpected("video.error", null);
35 consoleWrite("");
38 function start()
40 findMediaElement();
42 sources = document.getElementsByTagName('source');
44 document.addEventListener("error", errorEvent, true);
45 waitForEvent("loadstart");
46 waitForEvent("waiting");
47 waitForEvent("ratechange");
48 waitForEvent("durationchange");
49 waitForEvent("pause");
50 waitForEvent("play");
51 waitForEvent("playing");
53 waitForEvent('loadeddata', loadeddata);
55 </script>
56 </head>
58 <body onload="start()">
60 <video controls>
61 <source id=missing-src type="video/blahblah">
62 <source id=bogus-type src=content/test.mp4 type="video/blahblah">
63 <source id=unsupported-media-query src=content/test.mp4 media=print>
64 <source id=missing-file src=content/error2.mpeg type=video/mpeg>
65 <source id=format-error src="content/unsupported_track.mov">
66 <source id=supported-format-mp4 src=content/test.mp4 type="video/mpeg; codecs=&quot;avc1.4D400C&quot;">
67 <source id=supported-format-ogv src=content/test.ogv type="video/ogg">
68 </video>
70 <p>1. Test that errors fired while evaluating/loading &lt;source&gt; elements are fired at the
71 &lt;source&gt; and not at the &lt;video&gt; element.
72 <br>2. Verifiy that an 'error' event fired while processing/loading a &lt;source&gt; element
73 does not set the media element's 'error' attribute.</p>
75 </body>
76 </html>