tor-browser

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

test_seek-10.html (1653B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <title>Media test: seek tests</title>
      5  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      6  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
      7  <script type="text/javascript" src="manifest.js"></script>
      8  <script type="text/javascript" src="seek_support.js"></script>
      9 </head>
     10 <body>
     11 <pre id="test">
     12 <script class="testbody" type="text/javascript">
     13 
     14 // The data being used in these tests is specified in manifest.js.
     15 // The functions to build the test array and to run a specific test are in
     16 //      seek_support.js.
     17 
     18 const SEEK_TEST_NUMBER = 10;
     19 
     20 function test_seek10(v, seekTime, is, ok, finish) {
     21 
     22 // Test bug 523335 - ensure that if we close a stream while seeking, we
     23 // don't hang during shutdown. This test won't "fail" per se if it's regressed,
     24 // it will instead start to cause random hangs in the mochitest harness on
     25 // shutdown.
     26 
     27 function startTest() {
     28  // Must be duration*0.9 rather than seekTime, else we don't hit that problem.
     29  // This is probably due to the seek bisection finishing too quickly, before
     30  // we can close the stream.
     31  v.currentTime = v.duration * 0.9;
     32 }
     33 
     34 function done() {
     35  ok(true, "We don't acutally test anything...");
     36  finish();
     37 }
     38 
     39 function seeking() {
     40  ok(v.currentTime >= seekTime - 0.1, "Video currentTime should be around " + seekTime + ": " + v.currentTime);
     41  v.onerror = done;
     42  v.src = "not a valid video file.";
     43  v.load(); // Cause the existing stream to close.
     44 }
     45 
     46 v.addEventListener("loadeddata", startTest);
     47 v.addEventListener("seeking", seeking);
     48 
     49 }
     50 
     51 manager.runTests(createTestArray(), startTest);
     52 
     53 </script>
     54 </pre>
     55 </body>
     56 </html>