2010-02-05 Eric Carlson <eric.carlson@apple.com>

        Reviewed by Oliver Hunt.

        https://bugs.webkit.org/show_bug.cgi?id=33671
        [GTK] media/video-loop.html fails intermittently on Gtk Bots

        Rewrite test to make it less timing dependent.

        * media/video-loop-expected.txt:
        * media/video-loop.html:



git-svn-id: svn://svn.chromium.org/blink/trunk@54454 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 0d1934a4
2010-02-05 Eric Carlson <eric.carlson@apple.com>
Reviewed by Oliver Hunt.
https://bugs.webkit.org/show_bug.cgi?id=33671
[GTK] media/video-loop.html fails intermittently on Gtk Bots
Rewrite test to make it less timing dependent.
* media/video-loop-expected.txt:
* media/video-loop.html:
2010-02-05 Csaba Osztrogonác <ossy@webkit.org> 2010-02-05 Csaba Osztrogonác <ossy@webkit.org>
Rubber-stamped by Kenneth Rohde Christiansen. Rubber-stamped by Kenneth Rohde Christiansen.
......
Test looping.
++ Test setting/removing the attribute
EXPECTED (video.getAttribute('loop') == 'null') OK EXPECTED (video.getAttribute('loop') == 'null') OK
EXPECTED (video.loop == 'false') OK EXPECTED (video.loop == 'false') OK
RUN(video.loop = true) RUN(video.loop = true)
...@@ -6,21 +9,31 @@ EXPECTED (video.getAttribute('loop') != 'null') OK ...@@ -6,21 +9,31 @@ EXPECTED (video.getAttribute('loop') != 'null') OK
RUN(video.removeAttribute('loop')) RUN(video.removeAttribute('loop'))
EXPECTED (video.loop == 'false') OK EXPECTED (video.loop == 'false') OK
++ Set 'loop' to true and start playing
RUN(video.loop = true) RUN(video.loop = true)
RUN(video.src = 'content/test.mp4') RUN(video.src = 'content/test.mp4')
EVENT(play) EVENT(play)
++ seek to near the end, wait for 'seeked' event to announce loop
EXPECTED (video.paused == 'false') OK EXPECTED (video.paused == 'false') OK
RUN(video.currentTime = video.duration - 0.4) RUN(video.currentTime = video.duration - 0.4)
EVENT(playing) EVENT(seeked)
EVENT(seeked)
++ video just looped, toggle 'loop' and seek to near end
EXPECTED (video.paused == 'false') OK
EXPECTED (video.ended == 'false') OK EXPECTED (video.ended == 'false') OK
EXPECTED (mediaElement.currentTime > '0') OK EXPECTED (mediaElement.currentTime >= '0') OK
EXPECTED (mediaElement.currentTime < '5.63') OK EXPECTED (mediaElement.currentTime < 'mediaElement.duration') OK
RUN(video.loop = false) RUN(video.loop = false)
RUN(video.currentTime = video.duration - 0.3) RUN(video.currentTime = video.duration - 0.4)
EVENT(seeked)
EVENT(ended)
EXPECTED (video.ended == 'true') OK EXPECTED (video.ended == 'true') OK
EXPECTED (mediaElement.currentTime == 'mediaElement.duration') OK EXPECTED (mediaElement.currentTime == 'mediaElement.duration') OK
END OF TEST END OF TEST
<!DOCTYPE html>
<html> <html>
<head>
<video controls autoplay ></video> <script src=media-file.js></script>
<script src=video-test.js></script>
<script src=media-file.js></script>
<script src=video-test.js></script>
<script>
testExpected("video.getAttribute('loop')", null); <script>
testExpected("video.loop", false); var seekCount = 0;
run("video.loop = true"); function play()
testExpected("video.loop", true); {
testExpected("video.getAttribute('loop')", null, "!="); consoleWrite("<br>++ seek to near the end, wait for 'seeked' event to announce loop");
testExpected("video.paused", false);
run("video.removeAttribute('loop')"); waitForEvent("seeked", seeked);
testExpected("video.loop", false); run("video.currentTime = video.duration - 0.4");
consoleWrite("");
}
var respondToTimeUpdate = false; function seeked()
var firstTimeCheck = true; {
++seekCount;
waitForEvent('pause'); if (seekCount == 2) {
waitForEvent('playing'); consoleWrite("<br>++ video just looped, toggle 'loop' and seek to near end");
testExpected("video.paused", false);
testExpected("video.ended", false);
testExpected("mediaElement.currentTime", 0, '>=');
// make sure we are playing, seek to near the end so the test doesn't take too long // don't use "testExpected()" so we won't log the actual duration as the floating point result may differ with different engines
waitForEvent('play', function () { reportExpected(mediaElement.currentTime < mediaElement.duration, "mediaElement.currentTime", "<", "mediaElement.duration", mediaElement.currentTime);
testExpected("video.paused", false); run("video.loop = false");
run("video.currentTime = video.duration - 0.4"); run("video.currentTime = video.duration - 0.4");
consoleWrite("");
consoleWrite(""); }
setTimeout(timeCheck, 800); }
} );
function timeCheck() { function ended()
testExpected("video.ended", !firstTimeCheck);
if (!firstTimeCheck)
{ {
// don't use "testExpected()" so we won't log the actual duration to the testExpected("video.ended", true);
// results file, as the floating point result may differ with different engines
// don't use "testExpected()" so we won't log the actual duration as the floating point result may differ with different engines
reportExpected(mediaElement.currentTime == mediaElement.duration, "mediaElement.currentTime", "==", "mediaElement.duration", mediaElement.currentTime); reportExpected(mediaElement.currentTime == mediaElement.duration, "mediaElement.currentTime", "==", "mediaElement.duration", mediaElement.currentTime);
consoleWrite("");
endTest(); endTest();
return;
} }
testExpected("mediaElement.currentTime", 0, '>'); function start()
testExpected("mediaElement.currentTime", (video.duration - 0.4).toFixed(2), '<'); {
run("video.loop = false"); findMediaElement();
run("video.currentTime = video.duration - 0.3");
respondToTimeUpdate = true;
firstTimeCheck = false;
consoleWrite("");
setTimeout(timeCheck, 800);
}
consoleWrite("");
run("video.loop = true");
var mediaFile = findMediaFile("video", "content/test");
run("video.src = '" + mediaFile + "'");
consoleWrite("");
</script>
</head> consoleWrite("++ Test setting/removing the attribute");
testExpected("video.getAttribute('loop')", null);
testExpected("video.loop", false);
run("video.loop = true");
testExpected("video.loop", true);
testExpected("video.getAttribute('loop')", null, "!=");
run("video.removeAttribute('loop')");
testExpected("video.loop", false);
waitForEvent('pause');
waitForEvent('play', play);
waitForEvent("ended", ended);
consoleWrite("<br>++ Set 'loop' to true and start playing");
var mediaFile = findMediaFile("video", "content/test");
run("video.loop = true");
video.src = mediaFile;
consoleWrite("");
}
</script>
</head>
<body>
<video controls autoplay ></video>
<p>Test looping.</p>
<script>start()</script>
</body>
</html> </html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment