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

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: update layout tests 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..57f675b323cfac946309be7382083191d64fa443
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/media/media-play-promise-expected.txt
@@ -0,0 +1,170 @@
+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.
+
+
+playBeforeCanPlay()
+RUN(mediaElement = document.createElement('audio'))
+RUN(mediaElement.src = 'content/test.wav')
+EXPECTED (mediaElement.readyState == '0') OK
+play()
+EVENT(loadedmetadata)
+EVENT(loadeddata)
+EVENT(canplay)
+EVENT(playing)
+arguments.length: 1
+Promise resolved with undefined
+
+playWhenCanPlay()
+RUN(mediaElement = document.createElement('audio'))
+RUN(mediaElement.src = 'content/test.wav')
+EVENT(canplay)
+EXPECTED (mediaElement.readyState >= '3') OK
+EXPECTED (mediaElement.paused == 'true') OK
+play()
+EVENT(playing)
+arguments.length: 1
+Promise resolved with undefined
+
+playAfterPlaybackStarted()
+RUN(mediaElement = document.createElement('audio'))
+RUN(mediaElement.src = 'content/test.wav')
+EVENT(canplaythrough)
+RUN(mediaElement.play())
+EVENT(playing)
+EXPECTED (mediaElement.readyState == '4') OK
+EXPECTED (mediaElement.paused == 'false') OK
+play()
+arguments.length: 1
+Promise resolved with undefined
+
+playRequiresUserGestureAndHasIt()
+RUN(mediaElement = document.createElement('audio'))
+RUN(mediaElement.src = 'content/test.wav')
+play()
+EVENT(playing)
+arguments.length: 1
+Promise resolved with undefined
+
+playRequiresUserGestureAndDoesNotHaveIt()
+RUN(mediaElement = document.createElement('audio'))
+RUN(mediaElement.src = 'content/test.wav')
+play()
+arguments.length: 1
+Promise failed with NotAllowedError: play() can only be initiated by a user gesture.
+
+playNotSupportedContent()
+RUN(mediaElement = document.createElement('audio'))
+RUN(mediaElement.src = 'data:,.wav')
+play()
+EVENT(error)
+EXPECTED (mediaElement.error == '[object MediaError]') OK
+EXPECTED (mediaElement.error.code == '4') OK
+arguments.length: 1
+Promise failed with NotSupportedError: Failed to load because no supported source was found.
+
+playDecodeError()
+RUN(mediaElement = document.createElement('audio'))
+RUN(mediaElement.src = 'content/test.wav')
+EVENT(loadedmetadata)
+play()
+EVENT(error)
+EXPECTED (mediaElement.error == '[object MediaError]') OK
+EXPECTED (mediaElement.error.code == '3') OK
+EVENT(playing)
+arguments.length: 1
+Promise resolved with undefined
+
+playNetworkError()
+RUN(mediaElement = document.createElement('audio'))
+RUN(mediaElement.src = 'content/test.wav')
+EVENT(loadedmetadata)
+play()
+EVENT(error)
+EXPECTED (mediaElement.error == '[object MediaError]') OK
+EXPECTED (mediaElement.error.code == '2') OK
+EVENT(playing)
+arguments.length: 1
+Promise resolved with undefined
+
+playWithErrorAlreadySet()
+RUN(mediaElement = document.createElement('audio'))
+RUN(mediaElement.src = 'data:,.wav')
+EVENT(error)
+EXPECTED (mediaElement.error == '[object MediaError]') OK
+EXPECTED (mediaElement.error.code == '4') OK
+play()
+arguments.length: 1
+Promise failed with NotSupportedError: The element has no supported sources.
+
+playSrcChangedAfterError()
+RUN(mediaElement = document.createElement('audio'))
+RUN(mediaElement.src = 'data:,.wav')
+EVENT(error)
+EXPECTED (mediaElement.error == '[object MediaError]') OK
+EXPECTED (mediaElement.error.code == '4') OK
+RUN(mediaElement.src = 'content/test.wav')
+EVENT(loadedmetadata)
+play()
+EVENT(playing)
+arguments.length: 1
+Promise resolved with undefined
+
+playRaceWithSrcChangeError()
+RUN(mediaElement = document.createElement('audio'))
+RUN(mediaElement.src = 'data:,.wav')
+EVENT(error)
+EXPECTED (mediaElement.error == '[object MediaError]') OK
+EXPECTED (mediaElement.error.code == '4') OK
+RUN(mediaElement.src = 'content/test.wav')
+EXPECTED (mediaElement.error == 'null') OK
+EXPECTED (mediaElement.readyState == '0') OK
+play()
+arguments.length: 1
+Promise failed with NotSupportedError: Failed to load because no supported source was found.
philipj_slow 2016/02/25 14:06:48 This ought to change to a resolved promise, or the
mlamouri (slow - plz ping) 2016/02/25 14:40:05 That's correct. I have no idea why I ended up not
+
+playAndPauseWhenCanPlay()
+RUN(mediaElement = document.createElement('audio'))
+RUN(mediaElement.src = 'content/test.wav')
+EVENT(canplaythrough)
+EXPECTED (mediaElement.readyState == '4') OK
+play()
+EXPECTED (mediaElement.paused == 'false') OK
+EXPECTED (mediaElement.paused == 'true') OK
+EVENT(playing)
+arguments.length: 1
+Promise resolved with undefined
+
+playAndPauseBeforeCanPlay()
+RUN(mediaElement = document.createElement('audio'))
+EXPECTED (mediaElement.readyState == '0') OK
+play()
+EXPECTED (mediaElement.paused == 'false') OK
+EXPECTED (mediaElement.paused == 'true') OK
+arguments.length: 1
+Promise failed with AbortError: The play() request was interrupted by a call to pause().
+
+loadRejectsPendingPromises()
+RUN(mediaElement = document.createElement('audio'))
+play()
+RUN(mediaElement.load())
+arguments.length: 1
+Promise failed with AbortError: The play() request was interrupted by a new load request.
+
+newSrcRejectPendingPromises()
+RUN(mediaElement = document.createElement('audio'))
+play()
+RUN(mediaElement.src = 'content/test.wav')
+arguments.length: 1
+Promise failed with AbortError: The play() request was interrupted by a new load request.
+
+testEventAndPromiseOrdering
+RUN(mediaElement = document.createElement('audio'))
+RUN(mediaElement.src = 'data:,')
+EVENT(error)
+RUN(mediaElement.volume = 0.1)
+play()
+RUN(mediaElement.volume = 0.2)
+arguments.length: 1
+Promise failed with NotSupportedError: The element has no supported sources.
+END OF TEST
+

Powered by Google App Engine
This is Rietveld 408576698