| <!DOCTYPE html> |
| <title>Test event dispatches and attribute changes for seek to duration.</title> |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| <script src="../../media-resources/media-file.js"></script> |
| <video></video> |
| <script> |
| async_test(function(t) { |
| var video = document.querySelector("video"); |
| |
| var watcher = new EventWatcher(t, video, ["durationchange", "loadedmetadata", |
| "loadeddata", "seeking", "timeupdate", "seeked", "pause", "ended"]); |
| |
| watcher.wait_for(["durationchange", "loadedmetadata", "loadeddata"]).then(t.step_func(function() { |
| // Seek to the duration of the media. |
| assert_less_than(video.currentTime, video.duration); |
| assert_false(video.ended) |
| assert_false(video.paused); |
| //Starting seek to duration by setting video.currentTime to video.duration. |
| video.currentTime = video.duration; |
| testCommonAttributes(true); |
| return watcher.wait_for("seeking"); |
| })).then(t.step_func(function() { |
| testCommonAttributes(true); |
| assert_false(video.paused); |
| return watcher.wait_for("timeupdate"); |
| })).then(t.step_func(function() { |
| testCommonAttributes(false); |
| return watcher.wait_for("seeked"); |
| })).then(t.step_func(function() { |
| testCommonAttributes(false); |
| return watcher.wait_for("timeupdate"); |
| })).then(t.step_func(function() { |
| testCommonAttributes(false); |
| return watcher.wait_for("pause"); |
| })).then(t.step_func(function() { |
| assert_true(video.paused); |
| testCommonAttributes(false); |
| return watcher.wait_for("ended"); |
| })).then(t.step_func_done(function() { |
| testCommonAttributes(false); |
| assert_true(video.paused); |
| })); |
| |
| function testCommonAttributes(seekingExpected) { |
| assert_equals(video.seeking, seekingExpected); |
| assert_true(video.ended); |
| assert_equals(video.currentTime, video.duration); |
| } |
| |
| video.src = findMediaFile("video", "resources/test");; |
| video.play(); |
| }); |
| </script> |