Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/semantics/embedded-content/media-elements/track/track-element/track-webvtt-timings-no-hours.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>Cue timings and various syntax errors in timings, without hours</title>
<script src="track-helpers.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<video>
<track src="resources/timings-no-hour.vtt">
<track src="resources/timings-no-hour-errors.vtt">
</video>
<script>
async_test(function(t) {
var video = document.querySelector("video");
var trackElements = document.querySelectorAll("track");
for (var i = 0; i < video.textTracks.length; i++)
trackElements[i].onload = t.step_func(trackLoaded);
enableAllTextTracks(video.textTracks);
var numberOfTracksLoaded = 0;
function trackLoaded() {
numberOfTracksLoaded++;
if (numberOfTracksLoaded != 2)
return;
testTrack0();
testTrack1();
t.done();
}
function testTrack0() {
var expected = [
{
id : "1",
startTime : 0,
endTime : 30.5,
text : "Bear is Coming!!!!!"
},
{
id : "2",
startTime : 31,
endTime : 60.5,
text : "I said Bear is coming!!!!"
},
{
id : "3",
startTime : 61,
endTime : 120.5,
text : "I said Bear is coming now!!!!"
},
{
id : "4",
startTime : 121,
endTime : 180.5,
text : "tab separators"
}
];
assert_cues_equal(video.textTracks[0].cues, expected);
}
function testTrack1() {
// Test that all the cues are ignored.
assert_cues_equal(video.textTracks[1].cues, []);
}
});
</script>