tor-browser

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

track-webvtt-timestamp.html (1751B)


      1 <!DOCTYPE html>
      2 <title>Cues with &lt;timestamps&gt; tags</title>
      3 <script src="track-helpers.js"></script>
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script>
      7 check_cues_from_track("resources/timestamp.vtt", function(track) {
      8    assert_equals(track.cues.length, 3);
      9 
     10    // TODO(srirama.m): Timestamps are handled as ProcessingInstructions,
     11    // but because ProcessingInstructions are used in XML and not HTML,
     12    // they are ignored here. This should later be tested with oncuechange events.
     13 
     14    var children = [ { type: "text", value: "This cue is painted on." } ];
     15    assert_cue_fragment_as_textcontent(track.cues[0], children);
     16 
     17    children = [ { type: "text", value: "I said Bear is coming!!!!" } ];
     18    assert_cue_fragment_as_textcontent(track.cues[1], children);
     19 
     20    children = [ { type: "text", value: "I said Bear is coming now!!!!" } ];
     21    assert_cue_fragment_as_textcontent(track.cues[2], children);
     22 });
     23 
     24 check_cues_from_track("resources/timestamp-bad.vtt", function(track) {
     25    assert_equals(track.cues.length, 3);
     26 
     27    var children = [ { type: "text", value: "This cue is painted on.\nBut since the last two timestamps are out of order, they are ignored." } ];
     28    assert_cue_fragment_as_textcontent(track.cues[0], children);
     29 
     30    children = [ { type: "text", value: "I said Bear is coming!!!!\nAll of these timestamps are before the start of the cue, so get ignored." } ];
     31    assert_cue_fragment_as_textcontent(track.cues[1], children);
     32 
     33    children = [ { type: "text", value: "I said Bear is coming now!!!!\nAll of these timestamps are after the end of the cue, so get ignored." } ];
     34    assert_cue_fragment_as_textcontent(track.cues[2], children);
     35 });
     36 </script>