content/media/test/seek6.js

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     1 function test_seek6(v, seekTime, is, ok, finish) {
     3 // Test for bug identified by Chris Pearce in comment 40 on
     4 // bug 449159.
     5 var seekCount = 0;
     6 var completed = false;
     7 var interval;
     8 var sum = 0;
    10 function poll() {
    11   sum += v.currentTime;
    12 }
    14 function startTest() {
    15   if (completed)
    16     return;
    17   interval = setInterval(poll, 10);
    18   v.currentTime = Math.random() * v.duration;
    19 }
    21 function seekEnded() {
    22   if (completed)
    23     return;
    25   seekCount++;
    26   ok(true, "Seek " + seekCount);
    27   if (seekCount == 3) {
    28     clearInterval(interval);
    29     completed = true;
    30     finish();
    31   } else {
    32     v.currentTime = Math.random() * v.duration;
    33   }
    34 }
    36 v.addEventListener("loadedmetadata", startTest, false);
    37 v.addEventListener("seeked", seekEnded, false);
    39 }

mercurial