Index: LayoutTests/media/video-double-seek-currentTime.html |
diff --git a/LayoutTests/media/video-double-seek-currentTime.html b/LayoutTests/media/video-double-seek-currentTime.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..028352db94b4b8fcfd2404135340de0f07daebf3 |
--- /dev/null |
+++ b/LayoutTests/media/video-double-seek-currentTime.html |
@@ -0,0 +1,82 @@ |
+<!DOCTYPE html> |
+<html> |
+ <head> |
+ <script src=media-file.js></script> |
+ <script src=video-test.js></script> |
+ <script> |
+ var seekCount = 0; |
+ var expectedSeek = 0; |
+ var video; |
+ |
+ function seeking(e) |
+ { |
+ consoleWrite("seeking " + e.target.currentTime.toFixed(2)); |
+ |
+ doNextSeek(e.target); |
+ } |
+ |
+ function seeked(e) |
+ { |
+ consoleWrite("seeked " + e.target.currentTime.toFixed(2)); |
+ |
+ video = e.target; |
+ var now = e.target.currentTime.toFixed(2); |
+ var expected = expectedSeek.toFixed(2); |
+ if (now != expected) { |
+ failTest("Expected " + expectedSeek + " got " + now); |
+ return; |
+ } |
+ endTest(); |
+ } |
+ |
+ function doNextSeek(video) |
+ { |
+ consoleWrite("doNextSeek() " + seekCount); |
+ |
+ var newSeekPoint = -1; |
+ switch (seekCount) { |
+ case 0: |
+ newSeekPoint = 1; |
+ break; |
+ case 1: |
+ newSeekPoint = 1.5; |
+ break; |
+ case 2: |
+ newSeekPoint = 1.5; |
+ break; |
+ }; |
+ |
+ if (newSeekPoint >= 0) { |
+ consoleWrite('doNextSeek() seeking to ' + newSeekPoint.toFixed(2)); |
+ expectedSeek = newSeekPoint; |
+ video.currentTime = newSeekPoint; |
+ } |
+ seekCount++; |
+ } |
+ |
+ function loadedmetadata(e) |
+ { |
+ consoleWrite("loadedmetadata()"); |
+ doNextSeek(e.target); |
+ } |
+ |
+ function onWindowLoad(e) |
+ { |
+ video = document.getElementById('video'); |
+ |
+ video.src = findMediaFile("video", "content/test"); |
+ video.addEventListener('seeking', seeking); |
+ video.addEventListener('seeked', seeked); |
+ video.addEventListener('loadedmetadata', loadedmetadata); |
+ video.load(); |
+ } |
+ |
+ window.addEventListener('load', onWindowLoad, false); |
+ </script> |
+ </head> |
+ <body> |
+ <video controls id="video"></video> |
+ <p>Test currentTime values when setting from seeking event.</p> |
+ <br/> |
+ </body> |
+</html> |