| OLD | NEW |
| 1 <html> | 1 <!DOCTYPE html> |
| 2 <body> | 2 <title>Test, a delay in playing the movie still results in an "ended" event.</ti
tle> |
| 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"); |
| 3 | 10 |
| 4 <video controls></video> | 11 video.oncanplaythrough = t.step_func(function() { |
| 5 | 12 video.oncanplaythrough = null; |
| 6 <p>Test a delay in playing the movie results in a canPlay event.</p> | 13 assert_equals(video.currentTime, 0); |
| 7 | 14 video.currentTime = video.duration - 0.2; |
| 8 <script src=media-file.js></script> | |
| 9 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | |
| 10 (Please avoid writing new tests using video-test.js) --> | |
| 11 <script src=video-test.js></script> | |
| 12 <script> | |
| 13 waitForEventOnce('canplaythrough', | |
| 14 function () { | |
| 15 waitForEventAndEnd('ended'); | |
| 16 | |
| 17 testExpected("video.currentTime", 0); | |
| 18 run("video.currentTime = video.duration - 0.2"); | |
| 19 }); | 15 }); |
| 20 | 16 |
| 21 waitForEvent('seeked', | 17 video.onseeked = t.step_func(function () { |
| 22 function () { | |
| 23 setTimeout(function() { | 18 setTimeout(function() { |
| 24 run("video.play()"); | 19 video.play(); |
| 25 }, 400); | 20 }, 400); |
| 26 }); | 21 }); |
| 27 | 22 |
| 23 video.onended = t.step_func_done(); |
| 28 video.src = findMediaFile("video", "content/test"); | 24 video.src = findMediaFile("video", "content/test"); |
| 29 </script> | 25 }); |
| 30 | 26 </script> |
| 31 </body> | |
| 32 </html> | |
| OLD | NEW |