OLD | NEW |
1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
| 2 <title>Tests that duration is known after playback ended.</title> |
| 3 <script src="../resources/testharness.js"></script> |
| 4 <script src="../resources/testharnessreport.js"></script> |
| 5 <script src="media-file.js"></script> |
| 6 <video></video> |
| 7 <script> |
| 8 async_test(function(t) { |
| 9 var video = document.querySelector("video"); |
2 | 10 |
3 <html> | 11 video.onended = t.step_func_done(function() { |
4 <head> | 12 assert_greater_than(video.duration, 0); |
5 <title>local video</title> | 13 }); |
6 | 14 |
7 <script src=media-file.js></script> | 15 video.onplaying = t.step_func(function() { |
8 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | 16 video.onplaying = null; |
9 (Please avoid writing new tests using video-test.js) --> | 17 video.currentTime = video.duration - 0.2; |
10 <script src=video-test.js></script> | 18 }); |
11 | 19 |
12 <script> | 20 video.src = findMediaFile("video", "content/test"); |
13 function ended() | 21 video.play(); |
14 { | 22 }); |
15 testExpected("video.duration", 0, '>'); | 23 </script> |
16 endTest(); | |
17 } | |
18 | |
19 function playing() | |
20 { | |
21 video.removeEventListener("playing", playing); | |
22 run("video.currentTime = video.duration - 0.2"); | |
23 } | |
24 | |
25 function loadedmetadata() | |
26 { | |
27 video.addEventListener("ended", ended); | |
28 video.addEventListener("playing", playing); | |
29 | |
30 run("video.play()"); | |
31 } | |
32 | |
33 function start() | |
34 { | |
35 findMediaElement(); | |
36 | |
37 video.addEventListener("loadedmetadata", loadedmetadata); | |
38 video.src = findMediaFile("video", "content/test"); | |
39 consoleWrite(""); | |
40 } | |
41 | |
42 </script> | |
43 </head> | |
44 <body onload="start()"> | |
45 <video controls autobuffer></video> | |
46 <p>Tests that duration is known after playback ended.</p> | |
47 </body> | |
48 </html> | |
OLD | NEW |