| Differences between
and this patch
- LayoutTests/ChangeLog +12 lines
Lines 1-3 LayoutTests/ChangeLog_sec1
1
2010-08-19  Eric Carlson  <eric.carlson@apple.com>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        https://bugs.webkit.org/show_bug.cgi?id=33671
6
        [GTK] media/video-loop.html fails intermittently on Gtk Bots
7
8
        Rewrite test to make it less timing dependent.
9
10
        * media/video-loop-expected.txt:
11
        * media/video-loop.html:
12
1
2010-08-17  Ilya Tikhonovsky  <loislo@chromium.org>
13
2010-08-17  Ilya Tikhonovsky  <loislo@chromium.org>
2
14
3
        Reviewed by Yury Semikhatsky.
15
        Reviewed by Yury Semikhatsky.
- LayoutTests/media/video-loop-expected.txt -5 / +41 lines
Lines 1-3 LayoutTests/media/video-loop-expected.txt_sec1
1
Test looping by:
2
3
Play to end with 'loop' set to true.
4
When 'seeked' event fires, verify that time has jumped back and movie is playing.
5
Set 'loop' to false and play again.
6
Verify that 'ended' event fires.
7
++ Test setting/removing the attribute.
1
EXPECTED (video.getAttribute('loop') == 'null') OK
8
EXPECTED (video.getAttribute('loop') == 'null') OK
2
EXPECTED (video.loop == 'false') OK
9
EXPECTED (video.loop == 'false') OK
3
RUN(video.loop = true)
10
RUN(video.loop = true)
Lines 6-26 EXPECTED (video.getAttribute('loop') != LayoutTests/media/video-loop-expected.txt_sec2
6
RUN(video.removeAttribute('loop'))
13
RUN(video.removeAttribute('loop'))
7
EXPECTED (video.loop == 'false') OK
14
EXPECTED (video.loop == 'false') OK
8
15
16
++ Set 'loop' to true and begin playing.
9
RUN(video.loop = true)
17
RUN(video.loop = true)
10
RUN(video.src = 'content/test.mp4')
11
18
12
EVENT(play)
19
EVENT(play)
20
21
++ seek to near the end, wait for 'seeked' event to announce loop.
13
EXPECTED (video.paused == 'false') OK
22
EXPECTED (video.paused == 'false') OK
23
RUN(video.pause())
14
RUN(video.currentTime = video.duration - 0.4)
24
RUN(video.currentTime = video.duration - 0.4)
15
25
16
EVENT(playing)
26
EVENT(pause)
27
EVENT(seeked)
28
29
++ first seek completed, beginning playback.
30
EXPECTED (video.paused == 'true') OK
31
EXPECTED (video.ended == 'false') OK
32
RUN(video.play())
33
34
EVENT(play)
35
EVENT(seeked)
36
37
++ second seek completed because video looped, toggle 'loop' and seek to near end again.
38
EXPECTED (video.paused == 'false') OK
17
EXPECTED (video.ended == 'false') OK
39
EXPECTED (video.ended == 'false') OK
18
EXPECTED (mediaElement.currentTime > '0') OK
40
RUN(video.pause())
19
EXPECTED (mediaElement.currentTime < '5.63') OK
41
EXPECTED (mediaElement.currentTime >= '0') OK
42
EXPECTED (mediaElement.currentTime < 'mediaElement.duration') OK
20
RUN(video.loop = false)
43
RUN(video.loop = false)
21
RUN(video.currentTime = video.duration - 0.3)
44
RUN(video.currentTime = video.duration - 0.4)
45
46
EVENT(pause)
47
EVENT(seeked)
48
49
++ third seek completed, beginning playback for the last time.
50
EXPECTED (video.paused == 'true') OK
51
EXPECTED (video.ended == 'false') OK
52
RUN(video.play())
22
53
54
EVENT(play)
55
EVENT(ended)
56
57
++ played to end and stopped.
23
EXPECTED (video.ended == 'true') OK
58
EXPECTED (video.ended == 'true') OK
24
EXPECTED (mediaElement.currentTime == 'mediaElement.duration') OK
59
EXPECTED (mediaElement.currentTime == 'mediaElement.duration') OK
60
25
END OF TEST
61
END OF TEST
26
62
- LayoutTests/media/video-loop.html -54 / +105 lines
Lines 1-66 LayoutTests/media/video-loop.html_sec1
1
<!DOCTYPE html>
1
<html>
2
<html>
2
3
    <head>
3
    <video controls autoplay ></video>
4
        <script src=media-file.js></script>
4
5
        <script src=video-test.js></script>
5
    <script src=media-file.js></script>
6
    
6
    <script src=video-test.js></script>
7
        <script>
7
8
            var seekCount = 0;
8
    <script>
9
            var playCount = 0;
9
    
10
    
10
        testExpected("video.getAttribute('loop')", null);
11
            function play()
11
        testExpected("video.loop", false);
12
            {
12
    
13
                if (++playCount > 1)
13
        run("video.loop = true");
14
                    return;
14
        testExpected("video.loop", true);
15
15
        testExpected("video.getAttribute('loop')", null, "!=");
16
                consoleWrite("<br><em>++ seek to near the end, wait for 'seeked' event to announce loop.</em>");
17
                testExpected("video.paused", false);
18
                
19
                // Pause playback so the movie can't possibly loop before the seeked event fires
20
                run("video.pause()");
21
                waitForEvent("seeked", seeked);
22
                run("video.currentTime = video.duration - 0.4");
23
                consoleWrite("");
24
            }
16
    
25
    
17
        run("video.removeAttribute('loop')");
26
            function seeked()
18
        testExpected("video.loop", false);
27
            {
28
                switch (++seekCount)
29
                {
30
                    case 1:
31
                        consoleWrite("<br><em>++ first seek completed, beginning playback.</em>");
32
                        testExpected("video.paused", true);
33
                        testExpected("video.ended", false);
34
                        run("video.play()");
35
                        consoleWrite("");
36
                        break;
37
                    case 2:
38
                        consoleWrite("<br><em>++ second seek completed because video looped, toggle 'loop' and seek to near end again.</em>");
39
                        testExpected("video.paused", false);
40
                        testExpected("video.ended", false);
41
                        run("video.pause()");
42
43
                        testExpected("mediaElement.currentTime", 0, '>=');
44
    
45
                        // don't use "testExpected()" so we won't log the actual duration as the floating point result may differ with different engines
46
                        reportExpected(mediaElement.currentTime < mediaElement.duration, "mediaElement.currentTime", "<", "mediaElement.duration", mediaElement.currentTime);
47
                        run("video.loop = false");
48
                        run("video.currentTime = video.duration - 0.4");
49
                        consoleWrite("");
50
                        break;
51
                    case 3:
52
                        consoleWrite("<br><em>++ third seek completed, beginning playback for the last time.</em>");
53
                        testExpected("video.paused", true);
54
                        testExpected("video.ended", false);
55
                        run("video.play()");
56
                        consoleWrite("");
57
                        break;
58
                    default:
59
                        failTest("Video should have only seeked three times.");
60
                        break;
61
                        
62
                }
63
            }
19
    
64
    
20
        var respondToTimeUpdate = false;
65
            function ended() 
21
        var firstTimeCheck = true;
22
23
        waitForEvent('pause');
24
        waitForEvent('playing');
25
26
        // make sure we are playing, seek to near the end so the test doesn't take too long
27
        waitForEvent('play', function () { 
28
            testExpected("video.paused", false);
29
            run("video.currentTime = video.duration - 0.4");
30
            
31
            consoleWrite("");
32
            setTimeout(timeCheck, 800);
33
        } );
34
    
35
        function timeCheck() { 
36
            testExpected("video.ended", !firstTimeCheck);
37
            if (!firstTimeCheck)
38
            {
66
            {
39
                // don't use "testExpected()" so we won't log the actual duration to the
67
                consoleWrite("<br><em>++ played to end and stopped.</em>");
40
                //  results file, as the floating point result may differ with different engines
68
                testExpected("video.ended", true);
69
70
                // don't use "testExpected()" so we won't log the actual duration as the floating point result may differ with different engines
41
                reportExpected(mediaElement.currentTime == mediaElement.duration, "mediaElement.currentTime", "==", "mediaElement.duration", mediaElement.currentTime);
71
                reportExpected(mediaElement.currentTime == mediaElement.duration, "mediaElement.currentTime", "==", "mediaElement.duration", mediaElement.currentTime);
72
73
                consoleWrite("");
42
                endTest();
74
                endTest();
43
                return;
44
            }
75
            }
45
    
76
    
46
            testExpected("mediaElement.currentTime", 0, '>');
77
            function start()
47
            testExpected("mediaElement.currentTime", (video.duration - 0.4).toFixed(2), '<');
78
            {
48
            run("video.loop = false");
79
                findMediaElement();
49
            run("video.currentTime = video.duration - 0.3");
50
            respondToTimeUpdate = true;
51
            firstTimeCheck = false;
52
    
53
            consoleWrite("");
54
            setTimeout(timeCheck, 800);
55
        }
56
    
57
        consoleWrite("");
58
        run("video.loop = true");
59
        var mediaFile = findMediaFile("video", "content/test");
60
        run("video.src = '" + mediaFile + "'");
61
        consoleWrite("");
62
    </script>
63
80
64
    </head>
81
                consoleWrite("<em>++ Test setting/removing the attribute.</em>");
82
                testExpected("video.getAttribute('loop')", null);
83
                testExpected("video.loop", false);
84
            
85
                run("video.loop = true");
86
                testExpected("video.loop", true);
87
                testExpected("video.getAttribute('loop')", null, "!=");
88
            
89
                run("video.removeAttribute('loop')");
90
                testExpected("video.loop", false);
91
            
92
                waitForEvent('pause');
93
                waitForEvent('play', play);
94
                waitForEvent("ended", ended);
95
96
                consoleWrite("<br><em>++ Set 'loop' to true and begin playing.</em>");
97
                var mediaFile = findMediaFile("video", "content/test");
98
                run("video.loop = true");
99
                video.src = mediaFile;
100
                consoleWrite("");
101
            }
102
        </script>
65
103
104
    </head>
105
    <body>
106
        <video controls autoplay ></video>
107
        <p><b>Test looping by:</b>
108
        <ol>
109
            <li>Play to end with 'loop' set to true.</li>
110
            <li>When 'seeked' event fires, verify that time has jumped back and movie is playing.</li>
111
            <li>Set 'loop' to false and play again.</li>
112
            <li>Verify that 'ended' event fires.</li>
113
        </ol>
114
        </p>
115
        <script>start()</script>
116
    </body>
66
</html>
117
</html>

Return to Bug 33671