OLD | NEW |
1 <html> | 1 <!DOCTYPE html> |
2 <head> | 2 <title>Test "source" element.</title> |
3 <script src=media-file.js></script> | 3 <script src="../resources/testharness.js"></script> |
4 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | 4 <script src="../resources/testharnessreport.js"></script> |
5 (Please avoid writing new tests using video-test.js) --> | 5 <script src="media-file.js"></script> |
6 <script src=video-test.js></script> | 6 <video> |
7 <script> | 7 <source></source> |
| 8 </video> |
| 9 <script> |
| 10 async_test(function(t) { |
| 11 var video = document.querySelector("video"); |
| 12 var source = document.querySelector("source"); |
| 13 var mediaFile = findMediaFile("video", "content/test"); |
| 14 source.src = mediaFile; |
8 | 15 |
9 function test() | 16 video.onloadstart = t.step_func_done(function() { |
10 { | 17 var url = video.currentSrc; |
11 var panel = document.getElementById("panel"); | 18 assert_equals(url.substr(url.lastIndexOf("/media/") + 7), mediaFile); |
12 var mediaFile = findMediaFile("video", "content/test"); | |
13 | 19 |
14 panel.innerHTML = "<video controls><source src='" + mediaFile +
"'></video>"; | 20 assert_equals(source.getAttribute("src"), mediaFile); |
15 | 21 |
16 video = mediaElement = document.getElementsByTagName('video')[0]
; | 22 url = source.src; |
17 waitForEvent("loadstart", function () { | 23 assert_equals(url.substr(url.lastIndexOf("/media/") + 7), mediaFile); |
18 testExpected("stripExtension(relativeURL(video.currentSrc))"
, stripExtension(mediaFile)); | 24 }); |
19 | 25 }); |
20 source = document.querySelector('source'); | 26 </script> |
21 testExpected("stripExtension(source.getAttribute('src'))", s
tripExtension(mediaFile)); | |
22 testExpected("stripExtension(relativeURL(source.src))", stri
pExtension(mediaFile)); | |
23 | |
24 endTest(); | |
25 }); | |
26 } | |
27 </script> | |
28 </head> | |
29 | |
30 <body onload="setTimeout(test, 100)"> | |
31 | |
32 <div id=panel></div> | |
33 | |
34 </body> | |
35 </html> | |
OLD | NEW |