tor-browser

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

seek-to-currentTime.html (1293B)


      1 <!doctype html>
      2 <title>seek to currentTime</title>
      3 <meta name="timeout" content="long">
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script src="/common/media.js"></script>
      7 <div id=log></div>
      8 <script>
      9 async_test(function(t) {
     10  var v = document.createElement('video');
     11  v.src = getVideoURI('/media/movie_5');
     12  v.onloadedmetadata = t.step_func(function() {
     13    assert_greater_than(v.readyState, v.HAVE_NOTHING, 'readyState');
     14    assert_greater_than(v.seekable.length, 0, 'seekable ranges');
     15    assert_false(v.seeking, 'seeking before setting currentTime');
     16    v.currentTime = v.currentTime;
     17    assert_true(v.seeking, 'seeking after setting currentTime');
     18    var events = [];
     19    v.onseeking = v.ontimeupdate = v.onseeked = t.step_func(function(e) {
     20      events.push(e.type);
     21      // v.seeking can be true or false in the seeking event, see
     22      // https://www.w3.org/Bugs/Public/show_bug.cgi?id=24774
     23      if (e.type != 'seeking') {
     24        assert_equals(v.seeking, false, 'seeking in ' + e.type + ' event');
     25      }
     26      if (e.type == 'seeked') {
     27        assert_array_equals(events, ['seeking', 'timeupdate', 'seeked'],
     28                            'fired events');
     29        t.done();
     30      }
     31    });
     32  });
     33 });
     34 </script>