Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Unified Diff: third_party/WebKit/LayoutTests/media/media-play-promise-expected.txt

Issue 1576283003: Have HTMLMediaElement::play() return a Promise. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: hiroshige comments Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/media/media-play-promise-expected.txt
diff --git a/third_party/WebKit/LayoutTests/media/media-play-promise-expected.txt b/third_party/WebKit/LayoutTests/media/media-play-promise-expected.txt
new file mode 100644
index 0000000000000000000000000000000000000000..8dfa6058a4bae999c2720593dd787559bd337b7d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/media/media-play-promise-expected.txt
@@ -0,0 +1,126 @@
+CONSOLE WARNING: Failed to execute 'play' on 'HTMLMediaElement': API can only be initiated by a user gesture.
+Test the play() behaviour with regards to the returned promise for media elements.
+
+
+playLoading()
+RUN(mediaElement = document.createElement('audio'))
+RUN(mediaElement.src = 'content/test.wav')
+EVENT(playing)
+Promise Resolved
+
+playLoaded()
+RUN(mediaElement = document.createElement('audio'))
+RUN(mediaElement.src = 'content/test.wav')
+EVENT(canplaythrough)
+EXPECTED (4 == '4') OK
+EXPECTED (true == 'true') OK
+EVENT(playing)
+Promise Resolved
+
+playRequiresUserGestureAndHasIt()
+RUN(mediaElement = document.createElement('audio'))
+RUN(mediaElement.src = 'content/test.wav')
+EVENT(playing)
+Promise Resolved
+
+playRequiresUserGestureAndDoesNotHaveIt()
+RUN(mediaElement = document.createElement('audio'))
+RUN(mediaElement.src = 'content/test.wav')
+Promise Failed with NotAllowedError
+
+playNotSupportedContent()
+RUN(mediaElement = document.createElement('audio'))
+RUN(mediaElement.src = 'content/garbage.wav')
+EVENT(error)
+EXPECTED (mediaElement.error == '[object MediaError]') OK
+EXPECTED (mediaElement.error.code == '4') OK
+Promise Failed with NotSupportedError
+
+playDecodeError()
+RUN(mediaElement = document.createElement('audio'))
+RUN(mediaElement.src = 'content/test.wav')
+EVENT(loadedmetadata)
+EVENT(error)
+EXPECTED (mediaElement.error == '[object MediaError]') OK
+EXPECTED (mediaElement.error.code == '3') OK
+EVENT(playing)
+Promise Resolved
+
+playNetworkError()
+RUN(mediaElement = document.createElement('audio'))
+RUN(mediaElement.src = 'content/test.wav')
+EVENT(loadedmetadata)
+EVENT(error)
+EXPECTED (mediaElement.error == '[object MediaError]') OK
+EXPECTED (mediaElement.error.code == '2') OK
+EVENT(playing)
+Promise Resolved
+
+playWithErrorAlreadySet()
+RUN(mediaElement = document.createElement('audio'))
+RUN(mediaElement.src = 'content/garbage.wav')
+RUN(mediaElement.load())
+EVENT(error)
+EXPECTED (mediaElement.error == '[object MediaError]') OK
+EXPECTED (mediaElement.error.code == '4') OK
+Promise Failed with NotSupportedError
+
+playSrcChangedAfterError()
+RUN(mediaElement = document.createElement('audio'))
+RUN(mediaElement.src = 'content/garbage.wav')
+RUN(mediaElement.load())
+EVENT(error)
+EXPECTED (mediaElement.error == '[object MediaError]') OK
+EXPECTED (mediaElement.error.code == '4') OK
+RUN(mediaElement.src = 'content/test.wav')
+EVENT(loadedmetadata)
+EVENT(playing)
+Promise Resolved
+
+playRaceWithSrcChangeError()
+RUN(mediaElement = document.createElement('audio'))
+RUN(mediaElement.src = 'content/garbage.wav')
+RUN(mediaElement.load())
+EVENT(error)
+EXPECTED (mediaElement.error == '[object MediaError]') OK
+EXPECTED (mediaElement.error.code == '4') OK
+RUN(mediaElement.src = 'content/test.wav')
+Promise Failed with NotSupportedError
+
+playFollowedByPauseWhenLoaded()
+RUN(mediaElement = document.createElement('audio'))
+RUN(mediaElement.src = 'content/test.wav')
+RUN(mediaElement.load())
+EVENT(canplaythrough)
+EXPECTED (mediaElement.readyState == '4') OK
+EXPECTED (mediaElement.paused == 'false') OK
+EXPECTED (mediaElement.paused == 'true') OK
+EVENT(playing)
+Promise Resolved
+
+playFollowedByPauseWhenLoaded()
+RUN(mediaElement = document.createElement('audio'))
+RUN(mediaElement.src = 'content/test.wav')
+EXPECTED (mediaElement.readyState == '0') OK
+EXPECTED (mediaElement.paused == 'false') OK
+EXPECTED (mediaElement.paused == 'true') OK
+Promise Failed with AbortError
+
+loadRejectPendingPromises()
+RUN(mediaElement = document.createElement('audio'))
+RUN(mediaElement.load())
+Promise Failed with AbortError
+
+newSrcRejectPendingPromises()
+RUN(mediaElement = document.createElement('audio'))
+RUN(mediaElement.src = 'content/test.wav')
+Promise Failed with AbortError
+
+testEventAndPromiseOrdering
+RUN(mediaElement = document.createElement('audio'))
+RUN(mediaElement.src = 'content/test.wav')
+EVENT(playing)
+Should be after the play() promise is resolved
+Promise Resolved
+END OF TEST
+

Powered by Google App Engine
This is Rietveld 408576698