Index: LayoutTests/media/video-loop.html |
diff --git a/LayoutTests/media/video-loop.html b/LayoutTests/media/video-loop.html |
index 4e44416754b58ee0508ab8abe7788dd0ffd2da00..73ed2f9bb8966ae92a9b7232491f8c303f031f2f 100644 |
--- a/LayoutTests/media/video-loop.html |
+++ b/LayoutTests/media/video-loop.html |
@@ -3,11 +3,11 @@ |
<head> |
<script src=media-file.js></script> |
<script src=video-test.js></script> |
- |
+ |
<script> |
var seekCount = 0; |
var playCount = 0; |
- |
+ |
function play() |
{ |
if (video.readyState < HTMLMediaElement.HAVE_METADATA) { |
@@ -27,7 +27,7 @@ |
run("video.currentTime = video.duration - 0.4"); |
consoleWrite(""); |
} |
- |
+ |
function seeked() |
{ |
switch (++seekCount) |
@@ -46,39 +46,58 @@ |
run("video.pause()"); |
testExpected("mediaElement.currentTime", 0, '>='); |
- |
- // 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); |
+ |
+ // 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 - 0.4, "mediaElement.currentTime", "<", "mediaElement.duration", mediaElement.currentTime); |
run("video.loop = false"); |
run("video.currentTime = video.duration - 0.4"); |
consoleWrite(""); |
break; |
case 3: |
- consoleWrite("<br><em>++ third seek completed, beginning playback for the last time.</em>"); |
+ consoleWrite("<br><em>++ third seek completed, unset 'loop' and let play to the end.</em>"); |
testExpected("video.paused", true); |
testExpected("video.ended", false); |
run("video.play()"); |
consoleWrite(""); |
break; |
+ case 4: |
+ consoleWrite("<br><em>++ fourth seek completed.</em>"); |
+ // 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); |
+ testExpected("video.loop", true); |
+ testExpected("video.paused", false); |
+ testExpected("video.ended", false); |
+ consoleWrite("<br><em>++ Pausing now that test is over to prevent additional unwanted looping.</em>"); |
+ run("video.pause()"); |
+ consoleWrite(""); |
+ endTest(); |
default: |
- failTest("Video should have only seeked three times."); |
+ failTest("Video should have only seeked four times."); |
break; |
} |
} |
- |
+ |
function ended() |
{ |
consoleWrite("<br><em>++ played to end and stopped.</em>"); |
testExpected("video.ended", true); |
- // don't use "testExpected()" so we won't log the actual duration 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); |
+ // Testing edge case where we set 'loop' after playback ends. Verifies fix for crbug.com/364442 |
+ consoleWrite("<br><em>++ with ended == true, set 'loop' attribute. This will cause ended == false; looping video cannot be 'ended', only paused.</em>"); |
+ testExpected("video.loop", false); |
+ testExpected("video.paused", true); |
+ run("video.loop = true"); |
+ testExpected("video.loop", true); |
+ testExpected("video.ended", false); |
+ testExpected("video.paused", true); |
+ run("video.play()"); |
consoleWrite(""); |
- endTest(); |
} |
- |
+ |
function start() |
{ |
findMediaElement(); |
@@ -115,6 +134,8 @@ |
<li>When 'seeked' event fires, verify that time has jumped back and movie is playing.</li> |
<li>Set 'loop' to false and play again.</li> |
<li>Verify that 'ended' event fires.</li> |
+ <li>Set 'loop' to true now that video is ended. Call play again.</li> |
+ <li>Verify 'seeked' event fires, verify that time has jumped back and movie is playing.</li> |
</ol> |
</p> |
<script>start()</script> |