summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/media/video-timeupdate-during-playback.html
blob: 225aa0f39ae818a3ad09367e0eceeaa948302d1c (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
49
50
51
52
53
54
55
56
<html>
<body>
    
    <video controls></video>

    <p>
    Test 'timeupdate' events are posted while playing but not while paused.
    </p>
    <script src=media-file.js></script>
    <script src=video-test.js></script>
    <script>
        setSrcByTagName("video", findMediaFile("video", "content/test"));
    
        var timeupdateEventCount = 0;
        var countWhilePlaying = 0;

        function someTimeLater()
        {
            if (countWhilePlaying != timeupdateEventCount)
                failTest("'timeupdate' events posted after pausing");
            endTest();
        }

        function pause()
        {
            countWhilePlaying = timeupdateEventCount;
            setTimeout(someTimeLater, 400) ;
            consoleWrite("");
        }
        
        function playing()
        {
            setTimeout(function () { run("video.pause()"); }, 500) ;
            consoleWrite("");
        }

        mediaElement.addEventListener("timeupdate", function () { ++timeupdateEventCount; });

        waitForEvent('error');
        waitForEvent("loadstart");
        waitForEvent("waiting");
        waitForEvent("ratechange");
        waitForEvent("durationchange");
        waitForEvent("loadedmetadata");
        waitForEvent("loadeddata");
        waitForEvent("canplay");
        waitForEvent("pause", pause);
        waitForEvent("play");
        waitForEvent("playing", playing);

        run("video.play()");
        consoleWrite("");
    </script>

</body>
</html>