blob: 47c49e658a5ab916173dd336ca0b5ac4513f379a [file] [log] [blame]
eric.carlson@apple.comf60a0b22009-05-08 18:37:59 +00001<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>
mihaip@chromium.org9d9ccc12011-02-24 23:10:46 +00005 <script src=media-file.js></script>
6 <script src=video-test.js></script>
eric.carlson@apple.comf60a0b22009-05-08 18:37:59 +00007
8 <script>
9
10 var sources = [];
11
12 function loadeddata()
13 {
14 consoleWrite("");
eric@webkit.orgbff0b2d2009-09-18 22:20:01 +000015 testExpected("relativeURL(video.currentSrc)", findMediaFile("video", "content/test"));
eric.carlson@apple.comf60a0b22009-05-08 18:37:59 +000016 testExpected("video.error", null);
17 consoleWrite("");
18 endTest();
19 }
20
21 function errorEvent(evt)
22 {
23 var ndx;
24 for (ndx = 0; ndx < sources.length; ndx++) {
25 if (sources[ndx] == evt.target)
26 break;
27 }
28
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);
33
34 testExpected("video.error", null);
35 consoleWrite("");
36 }
37
38 function start()
39 {
40 findMediaElement();
41
42 sources = document.getElementsByTagName('source');
43
44 document.addEventListener("error", errorEvent, true);
45 waitForEvent("loadstart");
eric.carlson@apple.comf60a0b22009-05-08 18:37:59 +000046 waitForEvent("waiting");
47 waitForEvent("ratechange");
48 waitForEvent("durationchange");
49 waitForEvent("pause");
50 waitForEvent("play");
51 waitForEvent("playing");
52
53 waitForEvent('loadeddata', loadeddata);
54 }
55 </script>
56 </head>
57
eric.carlson@apple.com57f320212010-08-27 23:14:44 +000058 <body>
eric.carlson@apple.comf60a0b22009-05-08 18:37:59 +000059
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">
eric.carlson@apple.com318d8a12011-06-23 20:22:43 +000066 <source id=supported-format-mp4 src=content/test.mp4 type="video/mp4; codecs=&quot;avc1.4D400C&quot;">
eric@webkit.orgbff0b2d2009-09-18 22:20:01 +000067 <source id=supported-format-ogv src=content/test.ogv type="video/ogg">
eric.carlson@apple.comf60a0b22009-05-08 18:37:59 +000068 </video>
69
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>
74
eric.carlson@apple.com57f320212010-08-27 23:14:44 +000075 <script>start()</script>
eric.carlson@apple.comf60a0b22009-05-08 18:37:59 +000076 </body>
77</html>