content/media/test/seek3.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 function test_seek3(v, seekTime, is, ok, finish) {
     3 // Test seeking works if current time is set but video is not played.
     4 var startPassed = false;
     5 var completed = false;
     6 var gotTimeupdate = false;
     8 function startTest() {
     9   if (completed)
    10     return;
    12   v.currentTime=seekTime;
    13 }
    15 function timeupdate() {
    16   gotTimeupdate = true;
    17   v.removeEventListener("timeupdate", timeupdate, false);
    18 }
    20 function seekStarted() {
    21   if (completed)
    22     return;
    24   ok(v.currentTime >= seekTime - 0.1, "Video currentTime should be around " + seekTime + ": " + v.currentTime);
    25   v.addEventListener("timeupdate", timeupdate, false);
    26   startPassed = true;
    27 }
    29 function seekEnded() {
    30   if (completed)
    31     return;
    33   var t = v.currentTime;
    34   ok(Math.abs(t - seekTime) <= 0.1, "Video currentTime should be around " + seekTime + ": " + t);
    35   ok(gotTimeupdate, "Should have got timeupdate between seeking and seekended");
    36   completed = true;
    37   finish();
    38 }
    40 v.addEventListener("loadedmetadata", startTest, false);
    41 v.addEventListener("seeking", seekStarted, false);
    42 v.addEventListener("seeked", seekEnded, false);
    44 }

mercurial