OLD | NEW |
1 <html> | 1 <!DOCTYPE html> |
2 <body> | 2 <title>Test that a "source" element is not used when a bogus "src" attribute is
present.</title> |
3 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | 3 <script src="../resources/testharness.js"></script> |
4 (Please avoid writing new tests using video-test.js) --> | 4 <script src="../resources/testharnessreport.js"></script> |
5 <script src=video-test.js></script> | 5 <script src="media-file.js"></script> |
| 6 <video> |
| 7 <source></source> |
| 8 </video> |
| 9 <script> |
| 10 async_test(function(t) { |
| 11 var video = document.querySelector("video"); |
6 | 12 |
7 <script> | 13 video.onloadedmetadata = t.unreached_func(); |
8 mediaElement.addEventListener('loadedmetadata', function() { | 14 video.onloadstart = t.step_func(function () { |
9 failTest("'loadedmetadata' event fired" ); | 15 var url = video.currentSrc; |
10 }, true); | 16 assert_equals(url.substr(url.lastIndexOf("/media/")+7), mediaFile); |
| 17 }); |
11 | 18 |
12 waitForEvent('loadstart', function () { | 19 video.onerror = t.step_func(function () { |
13 findMediaElement(); | 20 var url = video.currentSrc; |
14 testExpected("relativeURL(video.currentSrc)", "content/bogus.mpeg"); | 21 assert_equals(url.substr(url.lastIndexOf("/media/")+7), mediaFile); |
15 consoleWrite(""); | 22 assert_equals(video.error.code, MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED); |
16 }); | 23 setTimeout(t.step_func_done(), 200) ; |
| 24 }); |
17 | 25 |
18 waitForEvent('error', function () { | 26 document.querySelector("source").src = findMediaFile("video", "content/test"
); |
19 findMediaElement(); | 27 var mediaFile = "content/bogus.mpeg"; |
20 testExpected("relativeURL(video.currentSrc)", "content/bogus.mpeg"); | 28 video.src = mediaFile; |
21 testExpected("mediaElement.error.code", MediaError.MEDIA_ERR_SRC_NOT
_SUPPORTED); | 29 }); |
22 setTimeout(endTest, 200) ; | 30 </script> |
23 consoleWrite(""); | |
24 }); | |
25 </script> | |
26 | |
27 <video src=content/bogus.mpeg controls> | |
28 <source src=content/test.mp4> | |
29 </video> | |
30 | |
31 <p>Test that a <source> element is not used when a bogus 'src' attribute i
s present | |
32 </p> | |
33 | |
34 </body> | |
35 </html> | |
OLD | NEW |