Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Simplify http/tests/media/video-play-stall.html
https://bugs.webkit.org/show_bug.cgi?id=140630 Reviewed by Brent Fulgham. Source/WebCore: Test: http/tests/media/video-play-waiting.html * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: (WebCore::MediaPlayerPrivateAVFoundation::play): Add more logging. (WebCore::MediaPlayerPrivateAVFoundation::updateStates): MediaPlayerAVPlayerItemStatusPlaybackBufferEmpty always maps to HaveCurrentData. (WebCore::MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification): Don't log FunctionType, doing so it needlessly verbose. (WebCore::MediaPlayerPrivateAVFoundation::dispatchNotification): Ditto. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]): Log KVO property values and notification state. LayoutTests: * http/tests/media/video-play-stall-expected.txt: * http/tests/media/video-play-stall.html: * http/tests/media/video-play-waiting-expected.txt: Added. * http/tests/media/video-play-waiting.html: Added. * media/content/long-test.mp4: Added. New media file with 30 second duration. * media/content/long-test.ogv: Ditto. * platform/mac/TestExpectations: Remove video-play-stall.html from the skip list. Mark video-play-waiting.html as flakey as it sometimes times out. Canonical link: https://commits.webkit.org/158951@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@179220 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
1 parent
9ee590c
commit 6c33957
Showing
11 changed files
with
155 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
Test that stalled, timeupdate and waiting events are sent when media load stalls in the middle. | ||
|
||
RUN(video.play()) | ||
Test that a stalled event is sent when media loading stalls. | ||
|
||
EVENT(durationchange) | ||
EVENT(loadedmetadata) | ||
EVENT(loadeddata) | ||
EVENT(canplay) | ||
EVENT(timeupdate) | ||
EVENT(waiting) | ||
RUN(video.play()) | ||
EVENT(stalled) | ||
EXPECTED (video.currentTime != '0') OK | ||
EXPECTED (video.playbackRate === '1') OK | ||
EXPECTED (video.paused === 'false') OK | ||
END OF TEST | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,45 @@ | ||
<video></video> | ||
<p>Test that stalled, timeupdate and waiting events are sent when media load stalls in the middle.</p> | ||
<script src=../../media-resources/media-file.js></script> | ||
<script src=../../media-resources/video-test.js></script> | ||
<script> | ||
|
||
var timeupdateCount = 0; | ||
var waitingCount = 0; | ||
|
||
waitForEvent('durationchange'); | ||
waitForEvent('loadedmetadata'); | ||
waitForEvent('loadeddata'); | ||
waitForEvent('canplaythrough'); | ||
waitForEvent('canplay', function () { | ||
|
||
mediaElement.addEventListener('timeupdate', function () { | ||
// timeupdate events are fired as playback progresses so only verify that at least one | ||
// event is fired | ||
++timeupdateCount; | ||
if (timeupdateCount == 1) | ||
consoleWrite("EVENT(timeupdate)"); | ||
} ); | ||
|
||
waitForEvent('waiting', function () { | ||
++waitingCount; | ||
if (waitingCount > 1) | ||
failTest("too many 'waiting' events fired."); | ||
|
||
waitForEvent('timeupdate'); | ||
} ); | ||
|
||
waitForEventAndEnd('stalled'); | ||
} ); | ||
|
||
// Find a supported media file. | ||
var mediaFile = findMediaFile("video", "content/test"); | ||
var mimeType = mimeTypeForFile(mediaFile); | ||
|
||
video.src = "http://127.0.0.1:8000/resources/load-and-stall.cgi?name=../../../media/" + mediaFile + "&mimeType=" + mimeType + "&stallAt=100000&stallFor=6"; | ||
run("video.play()"); | ||
</script> | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>'stalled' event test</title> | ||
<script src=../../media-resources/media-file.js></script> | ||
<script src=../../media-resources/video-test.js></script> | ||
<script> | ||
|
||
var playCount = 0; | ||
|
||
function start() | ||
{ | ||
findMediaElement(); | ||
waitForEvent('durationchange'); | ||
waitForEvent('loadedmetadata'); | ||
waitForEvent('loadeddata'); | ||
|
||
mediaElement.addEventListener('canplay', function () { | ||
// 'stalled' takes three seconds to fire, so 'canplay' may fire more than once | ||
// depending on how the engine parses incoming media data. | ||
if (++playCount > 1) | ||
return; | ||
consoleWrite("EVENT(canplay)"); | ||
run("video.play()"); | ||
} ); | ||
|
||
waitForEvent('stalled', function () { | ||
testExpected("video.currentTime", 0, "!="); | ||
testExpected("video.playbackRate", 1, "==="); | ||
testExpected("video.paused", false, "==="); | ||
endTest(); | ||
} ); | ||
|
||
var mediaFile = findMediaFile("video", "../../../../media/content/long-test"); | ||
var mimeType = mimeTypeForFile(mediaFile); | ||
video.src = "http://127.0.0.1:8000/media/resources/serve-video.php?name=" + mediaFile + "&type=" + mimeType + "&stallOffset=100000&stallDuration=60&chunkSize=1024"; | ||
} | ||
|
||
</script> | ||
</head> | ||
<body onload="start()"> | ||
<video controls></video> | ||
<p>Test that a stalled event is sent when media loading stalls.</p> | ||
</body> | ||
</html> |
12 changes: 12 additions & 0 deletions
12
LayoutTests/http/tests/media/video-play-waiting-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
Test that a waiting event is sent when media loading stalls after having sent 'canplay'. | ||
|
||
EVENT(durationchange) | ||
EVENT(loadedmetadata) | ||
EVENT(loadeddata) | ||
EVENT(canplay) | ||
RUN(video.play()) | ||
EVENT(timeupdate) | ||
EVENT(waiting) | ||
END OF TEST | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<video controls></video> | ||
<p>Test that a waiting event is sent when media loading stalls after having sent 'canplay'.</p> | ||
<script src=../../media-resources/media-file.js></script> | ||
<script src=../../media-resources/video-test.js></script> | ||
<script> | ||
|
||
var timeupdateCount = 0; | ||
|
||
waitForEvent('durationchange'); | ||
waitForEvent('loadedmetadata'); | ||
waitForEvent('loadeddata'); | ||
waitForEventAndEnd('waiting'); | ||
|
||
waitForEvent('canplay', function () { | ||
run("video.play()"); | ||
} ); | ||
|
||
mediaElement.addEventListener('timeupdate', function () { | ||
// 'timeupdate' events are also fired as playback progresses so only verify that at least one | ||
// event is fired. | ||
if (++timeupdateCount == 1) | ||
consoleWrite("EVENT(timeupdate)"); | ||
} ); | ||
|
||
// Find a supported media file. | ||
var mediaFile = findMediaFile("video", "../../../../media/content/long-test"); | ||
var mimeType = mimeTypeForFile(mediaFile); | ||
|
||
video.src = "http://127.0.0.1:8000/media/resources/serve-video.php?name=" + mediaFile + "&type=" + mimeType + "&stallOffset=100000&stallDuration=60&chunkSize=1024"; | ||
</script> |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters