| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>Test event dispatches and attribute changes for seek to middle.</title> | 2 <title>Test event dispatches and attribute changes for seek to middle.</title> |
| 3 <script src="../resources/testharness.js"></script> | 3 <script src="../resources/testharness.js"></script> |
| 4 <script src="../resources/testharnessreport.js"></script> | 4 <script src="../resources/testharnessreport.js"></script> |
| 5 <script src="../../media-resources/media-file.js"></script> | 5 <script src="../../media-resources/media-file.js"></script> |
| 6 <video></video> | 6 <video></video> |
| 7 <script> | 7 <script> |
| 8 async_test(function(t) { | 8 async_test(function(t) { |
| 9 var video = document.querySelector("video"); | 9 var video = document.querySelector("video"); |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 })).then(t.step_func(function() { | 29 })).then(t.step_func(function() { |
| 30 testCommonAttributes(false); | 30 testCommonAttributes(false); |
| 31 return watcher.wait_for("seeked"); | 31 return watcher.wait_for("seeked"); |
| 32 })).then(t.step_func_done(function() { | 32 })).then(t.step_func_done(function() { |
| 33 testCommonAttributes(false); | 33 testCommonAttributes(false); |
| 34 })); | 34 })); |
| 35 | 35 |
| 36 function testCommonAttributes(seekingExpected) { | 36 function testCommonAttributes(seekingExpected) { |
| 37 assert_equals(video.seeking, seekingExpected); | 37 assert_equals(video.seeking, seekingExpected); |
| 38 assert_false(video.ended); | 38 assert_false(video.ended); |
| 39 assert_equals(video.currentTime, video.duration / 2); | 39 if (seekingExpected) { |
| 40 assert_equals(video.currentTime, video.duration / 2); |
| 41 } else { |
| 42 // If seek has completed, the currentTime may have advanced slightly |
| 43 // beyond the initial seek point since the video is not paused. |
| 44 assert_greater_than_equal(video.currentTime, video.duration / 2); |
| 45 } |
| 40 assert_false(video.paused); | 46 assert_false(video.paused); |
| 41 } | 47 } |
| 42 | 48 |
| 43 video.src = findMediaFile("video", "resources/test"); | 49 video.src = findMediaFile("video", "resources/test"); |
| 44 video.play(); | 50 video.play(); |
| 45 }); | 51 }); |
| 46 </script> | 52 </script> |
| OLD | NEW |