summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/embedded-content/media-elements/track/track-element/track-webvtt-timings-hour.html
blob: c03e182c79e471454c5eebb288d0267eaff38ba3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!DOCTYPE html>
<title>Cue timings and various syntax errors in timings, with 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-hour.vtt">
    <track src="resources/timings-hour-error.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 : 361200.5,
                text : "I said Bear is coming now!!!!"
            }
        ];

        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>