<!DOCTYPE html>
<title>Test that cues are rendered and removed.</title>
<script src="../media-controls.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<video>
<track src="captions-webvtt/captions-gaps.vtt" kind="captions" default>
</video>
<script>
async_test(function(t) {
var video = document.querySelector("video");
var testTrack = document.querySelector("track");
video.src = "../content/counting.ogv";
var seekTimeIndex = 0;
var info = [
0.5, "",
1.5, "Lorem ipsum dolor sit amet,",
2.5, "",
3.3, "consectetuer adipiscing elit,",
0.6, "",
5.9, "sed diam nonummy nibh euismod tincidunt",
4.4, "",
7.9, "ut laoreet dolore magna aliquam erat volutpat."
];
video.onseeked = t.step_func(function() {
var time = info[seekTimeIndex];
assert_equals(video.currentTime, time);
var cueText = info[++seekTimeIndex];
++seekTimeIndex;
assert_equals(video.currentTime.toFixed(1), time.toFixed(1));
if (cueText.length) {
assert_equals(testTrack.track.activeCues[0].text, cueText);
assert_equals(textTrackDisplayElement(video).innerText, cueText);
} else {
assert_equals(testTrack.track.activeCues.length, 0);
}
if (seekTimeIndex >= info.length)
t.done();
video.currentTime = info[seekTimeIndex];
});
video.currentTime = info[0];
});
</script>