4 <title>Test for Bug
883173 - TextTrackCue(List) Sorting
</title>
5 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
6 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css"/>
9 <video id=
"v" src=
"seek.webm" preload=
"metadata">
10 <track src=
"bug883173.vtt" kind=
"subtitles" id=
"default" default
>
12 <script type=
"text/javascript">
14 * This test is used to ensure that the cues in the cue list should be sorted by
15 * cues' start time and end time, not the present order in the file.
18 let trackElement
= document
.getElementById("default");
19 is(trackElement
.readyState
, 2, "Track::ReadyState should be set to LOADED.");
21 let expected
= [[1, 3], [1, 2], [2, 4], [2, 3], [3, 4]];
22 let cueList
= trackElement
.track
.cues
;
23 is(cueList
.length
, expected
.length
, "Cue list length should be 5.");
25 for (let i
= 0; i
< expected
.length
; i
++) {
26 is(cueList
[i
].startTime
, expected
[i
][0],
27 `Cue's start time should be ${expected[i][0]}`);
28 is(cueList
[i
].endTime
, expected
[i
][1],
29 `Cue's end time should be ${expected[i][1]}`);
35 SimpleTest
.waitForExplicitFinish();