<!DOCTYPE html>
<title>Test that seeking video with "loop" past it's end rewinds to the beginning and continues playback.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<video loop></video>
<script>
async_test(function(t) {
var timeupdateEventCount = 0;
var video = document.querySelector("video");
video.oncanplaythrough = t.step_func(function () {
video.oncanplaythrough = null;
assert_true(video.paused);
video.play();
assert_false(video.paused);
});
video.ontimeupdate = t.step_func(function() {
++timeupdateEventCount;
// wait 2 timeupdate events so we are sure the media engine is
// playing the media.
if (timeupdateEventCount == 2) {
assert_false(video.paused);
// make sure time is advancing and seek past end
assert_greater_than(video.currentTime, 0);
video.currentTime = 500;
} else if (timeupdateEventCount == 10) {
// Wait some more timeupdate events so we can check the
// media engine performed the seek.
assert_false(video.paused);
assert_greater_than(video.currentTime, 0);
t.done();
}
});
video.src = "content/test.ogv";
});
</script>