Title: [125054] trunk
- Revision
- 125054
- Author
- scher...@chromium.org
- Date
- 2012-08-08 11:18:09 -0700 (Wed, 08 Aug 2012)
Log Message
Fire suspend event whenever network state is set to NETWORK_IDLE.
https://bugs.webkit.org/show_bug.cgi?id=93052
Reviewed by Eric Carlson.
There was a regression in the Chromium port (http://crbug.com/139511) that revealed we didn't
have a layout test for suspend events. Upon further investigation it appeared we also had a bug
where we didn't fire the suspend event when a media engine reported they had completely loaded
the media.
Covered by new test http/tests/media/video-load-suspend.html.
Source/WebCore:
* html/HTMLMediaElement.cpp: Move firing of suspend event to changeNetworkStateFromLoadingToIdle
(WebCore::HTMLMediaElement::setNetworkState):
(WebCore::HTMLMediaElement::changeNetworkStateFromLoadingToIdle):
LayoutTests:
* http/tests/media/video-load-suspend-expected.txt: Added.
* http/tests/media/video-load-suspend.html: Added.
* media/event-attributes-expected.txt: Updated to include suspend event.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (125053 => 125054)
--- trunk/LayoutTests/ChangeLog 2012-08-08 18:12:36 UTC (rev 125053)
+++ trunk/LayoutTests/ChangeLog 2012-08-08 18:18:09 UTC (rev 125054)
@@ -1,3 +1,21 @@
+2012-08-08 Andrew Scherkus <scher...@chromium.org>
+
+ Fire suspend event whenever network state is set to NETWORK_IDLE.
+ https://bugs.webkit.org/show_bug.cgi?id=93052
+
+ Reviewed by Eric Carlson.
+
+ There was a regression in the Chromium port (http://crbug.com/139511) that revealed we didn't
+ have a layout test for suspend events. Upon further investigation it appeared we also had a bug
+ where we didn't fire the suspend event when a media engine reported they had completely loaded
+ the media.
+
+ Covered by new test http/tests/media/video-load-suspend.html.
+
+ * http/tests/media/video-load-suspend-expected.txt: Added.
+ * http/tests/media/video-load-suspend.html: Added.
+ * media/event-attributes-expected.txt: Updated to include suspend event.
+
2012-08-08 Tom Sepez <tse...@chromium.org>
Video element image loader must persist after element detach.
Added: trunk/LayoutTests/http/tests/media/video-load-suspend-expected.txt (0 => 125054)
--- trunk/LayoutTests/http/tests/media/video-load-suspend-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/media/video-load-suspend-expected.txt 2012-08-08 18:18:09 UTC (rev 125054)
@@ -0,0 +1,8 @@
+Test that the load eventually suspends and returns to NETWORK_IDLE.
+
+RUN(video.src = ""
+EVENT(loadstart)
+EVENT(suspend)
+EXPECTED (video.networkState == '1') OK
+END OF TEST
+
Added: trunk/LayoutTests/http/tests/media/video-load-suspend.html (0 => 125054)
--- trunk/LayoutTests/http/tests/media/video-load-suspend.html (rev 0)
+++ trunk/LayoutTests/http/tests/media/video-load-suspend.html 2012-08-08 18:18:09 UTC (rev 125054)
@@ -0,0 +1,31 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+ var file = findMediaFile("video", "http://127.0.0.1:8000/resources/test");
+
+ function init()
+ {
+ findMediaElement();
+ run("video.src = ""
+ waitForEvent('loadstart', onLoadStart);
+ }
+
+ function onLoadStart()
+ {
+ waitForEvent('suspend', onSuspend);
+ }
+
+ function onSuspend()
+ {
+ testExpected("video.networkState", HTMLMediaElement.NETWORK_IDLE, "==");
+ endTest();
+ }
+</script>
+</head>
+<body _onload_="init()">
+ <p>Test that the load eventually suspends and returns to NETWORK_IDLE.</p>
+ <video></video>
+</body>
+</html>
Modified: trunk/LayoutTests/media/event-attributes-expected.txt (125053 => 125054)
--- trunk/LayoutTests/media/event-attributes-expected.txt 2012-08-08 18:12:36 UTC (rev 125053)
+++ trunk/LayoutTests/media/event-attributes-expected.txt 2012-08-08 18:18:09 UTC (rev 125054)
@@ -1,4 +1,5 @@
EVENT(loadstart)
+EVENT(suspend)
EVENT(durationchange)
EVENT(loadedmetadata)
EVENT(loadeddata)
Modified: trunk/Source/WebCore/ChangeLog (125053 => 125054)
--- trunk/Source/WebCore/ChangeLog 2012-08-08 18:12:36 UTC (rev 125053)
+++ trunk/Source/WebCore/ChangeLog 2012-08-08 18:18:09 UTC (rev 125054)
@@ -1,3 +1,21 @@
+2012-08-08 Andrew Scherkus <scher...@chromium.org>
+
+ Fire suspend event whenever network state is set to NETWORK_IDLE.
+ https://bugs.webkit.org/show_bug.cgi?id=93052
+
+ Reviewed by Eric Carlson.
+
+ There was a regression in the Chromium port (http://crbug.com/139511) that revealed we didn't
+ have a layout test for suspend events. Upon further investigation it appeared we also had a bug
+ where we didn't fire the suspend event when a media engine reported they had completely loaded
+ the media.
+
+ Covered by new test http/tests/media/video-load-suspend.html.
+
+ * html/HTMLMediaElement.cpp: Move firing of suspend event to changeNetworkStateFromLoadingToIdle
+ (WebCore::HTMLMediaElement::setNetworkState):
+ (WebCore::HTMLMediaElement::changeNetworkStateFromLoadingToIdle):
+
2012-08-08 Tom Sepez <tse...@chromium.org>
Video element image loader must persist after element detach.
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (125053 => 125054)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2012-08-08 18:12:36 UTC (rev 125053)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2012-08-08 18:18:09 UTC (rev 125054)
@@ -1581,7 +1581,6 @@
if (state == MediaPlayer::Idle) {
if (m_networkState > NETWORK_IDLE) {
changeNetworkStateFromLoadingToIdle();
- scheduleEvent(eventNames().suspendEvent);
setShouldDelayLoadEvent(false);
} else {
m_networkState = NETWORK_IDLE;
@@ -1613,6 +1612,7 @@
// Schedule one last progress event so we guarantee that at least one is fired
// for files that load very quickly.
scheduleEvent(eventNames().progressEvent);
+ scheduleEvent(eventNames().suspendEvent);
m_networkState = NETWORK_IDLE;
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes