tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_bug883173.html (1249B)


      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.
     16 */
     17 function runTest() {
     18  let trackElement = document.getElementById("default");
     19  is(trackElement.readyState, 2, "Track::ReadyState should be set to LOADED.");
     20 
     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.");
     24 
     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]}`);
     30  }
     31 
     32  SimpleTest.finish();
     33 }
     34 
     35 SimpleTest.waitForExplicitFinish();
     36 onload = runTest;
     37 </script>
     38 </body>
     39 </html>