Title: [124713] trunk
Revision
124713
Author
[email protected]
Date
2012-08-04 20:23:50 -0700 (Sat, 04 Aug 2012)

Log Message

HTMLMediaElement may fire the seeked event before currentTime reaches the seek time
https://bugs.webkit.org/show_bug.cgi?id=92881

Reviewed by Eric Carlson.

Source/WebCore:

Testing provided by media/video-seek-past-end-paused.html, hopefully demonstrating lack of redness on all ports/bots this time.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaPlayerTimeChanged): don't finishSeek() until the media player is no longer seeking.

LayoutTests:

This is mostly a re-land of r114005, alongside a fix for HTMLMediaElement.

* media/video-seek-past-end-paused-expected.txt:
* media/video-seek-past-end-paused.html:
* platform/chromium/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (124712 => 124713)


--- trunk/LayoutTests/ChangeLog	2012-08-05 02:30:53 UTC (rev 124712)
+++ trunk/LayoutTests/ChangeLog	2012-08-05 03:23:50 UTC (rev 124713)
@@ -1,3 +1,16 @@
+2012-08-04  Ami Fischman  <[email protected]>
+
+        HTMLMediaElement may fire the seeked event before currentTime reaches the seek time
+        https://bugs.webkit.org/show_bug.cgi?id=92881
+
+        Reviewed by Eric Carlson.
+
+        This is mostly a re-land of r114005, alongside a fix for HTMLMediaElement.
+
+        * media/video-seek-past-end-paused-expected.txt:
+        * media/video-seek-past-end-paused.html:
+        * platform/chromium/TestExpectations:
+
 2012-08-04  Ryosuke Niwa  <[email protected]>
 
         Another test fix after r124708.

Modified: trunk/LayoutTests/media/video-seek-past-end-paused-expected.txt (124712 => 124713)


--- trunk/LayoutTests/media/video-seek-past-end-paused-expected.txt	2012-08-05 02:30:53 UTC (rev 124712)
+++ trunk/LayoutTests/media/video-seek-past-end-paused-expected.txt	2012-08-05 03:23:50 UTC (rev 124713)
@@ -1,7 +1,5 @@
-Test that seeking paused video past it's duration time sets currentTime to duration and leaves video paused.
+Test that seeking a paused video past its end sets currentTime to duration and leaves the video paused.
 
-RUN(video.load())
-
 EVENT(canplaythrough)
 EXPECTED (video.paused == 'true') OK
 EXPECTED (video.ended == 'false') OK
@@ -10,6 +8,9 @@
 EXPECTED (video.paused == 'false') OK
 EXPECTED (mediaElement.currentTime > '0') OK
 
+EXPECTED (video.paused == 'true') OK
+
+EXPECTED (video.paused == 'true') OK
 EXPECTED (mediaElement.currentTime == 'mediaElement.duration') OK
 EXPECTED (video.ended == 'true') OK
 

Modified: trunk/LayoutTests/media/video-seek-past-end-paused.html (124712 => 124713)


--- trunk/LayoutTests/media/video-seek-past-end-paused.html	2012-08-05 02:30:53 UTC (rev 124712)
+++ trunk/LayoutTests/media/video-seek-past-end-paused.html	2012-08-05 03:23:50 UTC (rev 124713)
@@ -1,45 +1,70 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src=""
+        <script src=""
+        <script>
+            var timeupdateEventCount = 0;
 
-<video controls></video>
-<p>Test that seeking paused video past it's duration time sets currentTime to duration and leaves video paused.</p>
-<script src=""
-<script src=""
-<script>
+            function doSetup()
+            {
+                findMediaElement();
+                waitForEvent('canplaythrough', canPlayThrough);
+                video.src = "" 'content/test');
+            }
+            window.addEventListener('load', doSetup, false);
 
-    waitForEvent('canplaythrough', function () { 
-        testExpected("video.paused", true);
-        testExpected("video.ended", false);
-        run("video.play()");
-        setTimeout(timeCheck1, 200);
-    });
+            function canPlayThrough()
+            {
+                testExpected("video.paused", true);
+                testExpected("video.ended", false);
+                video.addEventListener('timeupdate', timeUpdate);
+                run("video.play()");
+            }
+  
+            function timeUpdate()
+            {
+                ++timeupdateEventCount;
 
-    function timeCheck1() 
-    {
-        consoleWrite("");
+                // Wait 2 timeupdate events so we are sure the media engine is
+                // playing the media.
+                if (timeupdateEventCount == 2) {
+                    consoleWrite("");
+                    video.removeEventListener('timeupdate', timeUpdate);
+                    // Make sure time is advancing.
+                    testExpected("video.paused", false);
+                    testExpected("mediaElement.currentTime", 0, '>');
+                    video.addEventListener('pause', paused);
+                    video.pause();
+                }
+            }
 
-        // make sure time is advancing, seek past end
-        testExpected("video.paused", false);
-        testExpected("mediaElement.currentTime", 0, '>');
-        video.currentTime = 500;
-        setTimeout(timeCheck2, 200);
-    }
+            function paused() {
+                consoleWrite("");
+                testExpected("video.paused", true);
+                video.addEventListener('seeked', seeked);
+                // Seek past end.
+                video.currentTime = 500;
+            };
 
-    function timeCheck2() 
-    {
-        consoleWrite("");
+            function seeked()
+            {
+                consoleWrite("");
 
-        // don't use "testExpected()" so we won't log the actual duration to the
-        //  results file, as the floating point result may differ with different engines
-        reportExpected(mediaElement.currentTime == mediaElement.duration, "mediaElement.currentTime", "==", "mediaElement.duration", mediaElement.currentTime);
+                testExpected("video.paused", true);
+                // Don't use "testExpected()" so we won't log the actual duration to the
+                // results file, as the floating point result may differ with different engines.
+                reportExpected(mediaElement.currentTime == mediaElement.duration, "mediaElement.currentTime", "==", "mediaElement.duration", mediaElement.currentTime);
 
-        testExpected("video.ended", true);
-        consoleWrite("");
-        endTest();
-    }
-
-    var mediaFile = findMediaFile("video", "content/test");
-    disableFullTestDetailsPrinting();
-    runSilently("video.src = ''");
-    enableFullTestDetailsPrinting();
-    run("video.load()");
-    consoleWrite("");
-</script>
+                testExpected("video.ended", true);
+                consoleWrite("");
+                timeupdateEventCount = 0;
+                endTest();
+            }
+        </script>
+    </head>
+    <body>
+        <video controls></video>
+        <p>Test that seeking a paused video past its end sets currentTime to duration and leaves the video paused.</p>
+    </body>
+</html>

Modified: trunk/LayoutTests/platform/chromium/TestExpectations (124712 => 124713)


--- trunk/LayoutTests/platform/chromium/TestExpectations	2012-08-05 02:30:53 UTC (rev 124712)
+++ trunk/LayoutTests/platform/chromium/TestExpectations	2012-08-05 03:23:50 UTC (rev 124713)
@@ -3106,8 +3106,6 @@
 BUGWK19688 SKIP : fast/images/exif-orientation.html = PASS
 BUGWK19688 SKIP : fast/images/exif-orientation-css.html = PASS
 
-BUGCR122448 : media/video-seek-past-end-paused.html = PASS TEXT
-
 BUGCR122462 WIN LINUX SLOW : http/tests/inspector/inspect-element.html = TEXT
 
 BUGWK83635 : fast/canvas/2d.backingStorePixelRatio.html = TEXT TIMEOUT

Modified: trunk/Source/WebCore/ChangeLog (124712 => 124713)


--- trunk/Source/WebCore/ChangeLog	2012-08-05 02:30:53 UTC (rev 124712)
+++ trunk/Source/WebCore/ChangeLog	2012-08-05 03:23:50 UTC (rev 124713)
@@ -1,3 +1,15 @@
+2012-08-04  Ami Fischman  <[email protected]>
+
+        HTMLMediaElement may fire the seeked event before currentTime reaches the seek time
+        https://bugs.webkit.org/show_bug.cgi?id=92881
+
+        Reviewed by Eric Carlson.
+
+        Testing provided by media/video-seek-past-end-paused.html, hopefully demonstrating lack of redness on all ports/bots this time.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::mediaPlayerTimeChanged): don't finishSeek() until the media player is no longer seeking.
+
 2012-08-04  Dan Bernstein  <[email protected]>
 
         Tried to fix the Qt Windows build after r124654.

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (124712 => 124713)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2012-08-05 02:30:53 UTC (rev 124712)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2012-08-05 03:23:50 UTC (rev 124713)
@@ -3351,7 +3351,7 @@
     invalidateCachedTime();
 
     // 4.8.10.9 step 14 & 15.  Needed if no ReadyState change is associated with the seek.
-    if (m_seeking && m_readyState >= HAVE_CURRENT_DATA)
+    if (m_seeking && m_readyState >= HAVE_CURRENT_DATA && !m_player->seeking())
         finishSeek();
     
     // Always call scheduleTimeupdateEvent when the media engine reports a time discontinuity, 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to