blob: 8271244f8b2b1779288105cd8978e7df7064d289 [file] [log] [blame]
<!DOCTYPE html>
<title>Load a video with an infinite duration. Start playback and ensure video.currentTime is less than video.buffered.end(0) upon first timeupdate.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="media-file.js"></script>
<video></video>
<script>
async_test(function(t) {
var video = document.querySelector("video");
video.ontimeupdate = t.step_func_done(function() {
video.ontimeupdate = null;
video.pause();
assert_equals(video.duration, Infinity);
assert_greater_than_equal(video.buffered.start(0), 0);
// 10 seconds chosen arbitrarily as it's larger than the duration, but
// small enough to test for overflow of arithmetic performed on the
// infinite duration.
assert_less_than(video.buffered.end(0), 10);
assert_less_than_equal(video.currentTime, video.buffered.end(0));
});
video.onloadeddata = t.step_func(function() {
video.onloadeddata = null;
assert_equals(video.buffered.length, 1);
assert_greater_than_equal(video.buffered.start(0), 0);
assert_not_equals(video.buffered.end(0), Infinity);
assert_equals(video.currentTime, 0);
assert_equals(video.duration, Infinity);
video.play();
});
video.src = "resources/test-live.webm";
});
</script>