summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/media/video-seeking.html
blob: ff2afddd57a810b3318b3ed34866ca9d96bb12ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<video controls></video>
<p>Test that seeking attribute is true immediately after a seek,
 goes back to false when seeking completes, and that a 'seeked' event
 is fired for each seek
 </p>
<script src=media-file.js></script>
<!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956
     (Please avoid writing new tests using video-test.js) -->
<script src=video-test.js></script>
<script>

    var seekedCount = 0;

    function seeked()
    {
        ++seekedCount;
        consoleWrite("");

        testExpected("video.seeking", false);
        testExpected("video.currentTime", seekedCount * 0.5);

        if (seekedCount == 3) {
            endTest();
            return;
        }

        run("video.currentTime = " + (seekedCount + 1) * 0.5);
        testExpected("video.seeking", true);

        consoleWrite("");

     }

    function canplaythrough()
    {
        if (seekedCount > 0)
            return;

        run("video.currentTime = 0.5");
        consoleWrite("");
    }

    waitForEvent('waiting' );
    waitForEvent('seeked', seeked );
    waitForEventOnce('canplaythrough', canplaythrough);

    video.src = findMediaFile("video", "content/test");
</script>