content/media/test/seek13.js

Fri, 16 Jan 2015 04:50:19 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 04:50:19 +0100
branch
TOR_BUG_9701
changeset 13
44a2da4a2ab2
permissions
-rw-r--r--

Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32

     1 function test_seek13(v, seekTime, is, ok, finish) {
     2 var completed = false;
     4 function startTest() {
     5   if (completed)
     6     return;
     7   ok(!v.seeking, "seeking should default to false");
     8   v.currentTime = v.duration;
     9   is(v.currentTime, v.duration, "currentTime must report seek target immediately");
    10   is(v.seeking, true, "seeking flag on start should be true");
    11 }
    13 function seekStarted() {
    14   if (completed)
    15     return;
    16   //is(v.currentTime, v.duration, "seeking: currentTime must be duration");
    17   ok(Math.abs(v.currentTime - v.duration) < 0.01,
    18      "seeking: currentTime (" + v.currentTime + ") must be duration (" + v.duration + ")");
    19 }
    21 function seekEnded() {
    22   if (completed)
    23     return;
    24   //is(v.currentTime, v.duration, "seeked: currentTime must be duration");
    25   ok(Math.abs(v.currentTime - v.duration) < 0.01,
    26      "seeked: currentTime (" + v.currentTime + ") must be duration (" + v.duration + ")");
    27   is(v.seeking, false, "seeking flag on end should be false");
    28 }
    30 function playbackEnded() {
    31   if (completed)
    32     return;
    33   completed = true;
    34   //is(v.currentTime, v.duration, "ended: currentTime must be duration");
    35   ok(Math.abs(v.currentTime - v.duration) < 0.01,
    36      "ended: currentTime (" + v.currentTime + ") must be duration (" + v.duration + ")");
    37   is(v.seeking, false, "seeking flag on end should be false");
    38   is(v.ended, true, "ended must be true");
    39   finish();
    40 }
    42 v.addEventListener("loadedmetadata", startTest, false);
    43 v.addEventListener("seeking", seekStarted, false);
    44 v.addEventListener("seeked", seekEnded, false);
    45 v.addEventListener("ended", playbackEnded, false);
    46 }

mercurial