eric.carlson@apple.com | f60a0b2 | 2009-05-08 18:37:59 +0000 | [diff] [blame] | 1 | <html lang="en"> |
| 2 | <head> |
| 3 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 4 | <title><video> and <source> error test</title> |
mihaip@chromium.org | 9d9ccc1 | 2011-02-24 23:10:46 +0000 | [diff] [blame] | 5 | <script src=media-file.js></script> |
| 6 | <script src=video-test.js></script> |
eric.carlson@apple.com | f60a0b2 | 2009-05-08 18:37:59 +0000 | [diff] [blame] | 7 | |
| 8 | <script> |
| 9 | |
| 10 | var sources = []; |
| 11 | |
| 12 | function loadeddata() |
| 13 | { |
| 14 | consoleWrite(""); |
eric@webkit.org | bff0b2d | 2009-09-18 22:20:01 +0000 | [diff] [blame] | 15 | testExpected("relativeURL(video.currentSrc)", findMediaFile("video", "content/test")); |
eric.carlson@apple.com | f60a0b2 | 2009-05-08 18:37:59 +0000 | [diff] [blame] | 16 | 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 <source id='<em>" + evt.target.id + "</em>' src='<em>" + relativeURL(evt.target.src) + "</em>'>"); |
| 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.com | f60a0b2 | 2009-05-08 18:37:59 +0000 | [diff] [blame] | 46 | 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.com | 57f32021 | 2010-08-27 23:14:44 +0000 | [diff] [blame] | 58 | <body> |
eric.carlson@apple.com | f60a0b2 | 2009-05-08 18:37:59 +0000 | [diff] [blame] | 59 | |
| 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.com | 318d8a1 | 2011-06-23 20:22:43 +0000 | [diff] [blame] | 66 | <source id=supported-format-mp4 src=content/test.mp4 type="video/mp4; codecs="avc1.4D400C""> |
eric@webkit.org | bff0b2d | 2009-09-18 22:20:01 +0000 | [diff] [blame] | 67 | <source id=supported-format-ogv src=content/test.ogv type="video/ogg"> |
eric.carlson@apple.com | f60a0b2 | 2009-05-08 18:37:59 +0000 | [diff] [blame] | 68 | </video> |
| 69 | |
| 70 | <p>1. Test that errors fired while evaluating/loading <source> elements are fired at the |
| 71 | <source> and not at the <video> element. |
| 72 | <br>2. Verifiy that an 'error' event fired while processing/loading a <source> element |
| 73 | does not set the media element's 'error' attribute.</p> |
| 74 | |
eric.carlson@apple.com | 57f32021 | 2010-08-27 23:14:44 +0000 | [diff] [blame] | 75 | <script>start()</script> |
eric.carlson@apple.com | f60a0b2 | 2009-05-08 18:37:59 +0000 | [diff] [blame] | 76 | </body> |
| 77 | </html> |