Bug 1943761 - Add class alignment to the mozsearch analysis file. r=asuth
[gecko.git] / dom / media / webvtt / test / mochitest / test_bug883173.html
blob6e95f4e3cab543ffdc59a449b40627c70650c07c
1 <!DOCTYPE HTML>
2 <html>
3 <head>
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"/>
7 </head>
8 <body>
9 <video id="v" src="seek.webm" preload="metadata">
10 <track src="bug883173.vtt" kind="subtitles" id="default" default>
11 </video>
12 <script type="text/javascript">
13 /**
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.
17 function runTest() {
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]}`);
32 SimpleTest.finish();
35 SimpleTest.waitForExplicitFinish();
36 onload = runTest;
37 </script>
38 </body>
39 </html>