Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/media/media-play-promise.html |
| diff --git a/third_party/WebKit/LayoutTests/media/media-play-promise.html b/third_party/WebKit/LayoutTests/media/media-play-promise.html |
| index 317a4c027fd2630db8696fc2c48fd434c680722f..06590b9b6b4d0f39839571b4167810c2e8d898dc 100644 |
| --- a/third_party/WebKit/LayoutTests/media/media-play-promise.html |
| +++ b/third_party/WebKit/LayoutTests/media/media-play-promise.html |
| @@ -220,7 +220,55 @@ var tests = [ |
| audio.oncanplaythrough = t.step_func(function() { |
| audio.play(); |
| }); |
| - } |
| + }, |
| + |
| + // Test that running the load algorithm will not drop all the promises about |
| + // to be resolved. |
| + function loadAlgorithmDoesNotCancelTasks(t, audio) { |
| + audio.src = findMediaFile('audio', 'content/test'); |
| + audio.addEventListener('canplaythrough', t.step_func(function() { |
| + // The play() promise will be queued to be resolved. |
| + playExpectingResolvedPromise(t, audio); |
| + audio.src = findMediaFile('audio', 'content/test'); |
| + assert_true(audio.paused); |
| + })); |
| + }, |
| + |
| + // Test that when the load algorithm is run, if it does not pause the |
| + // playback, it will leave the promise pending, allowing it to be resolved. |
| + function loadAlgorithmKeepPromisesPendingWhenNotPausing(t, audio) { |
| + playExpectingResolvedPromise(t, audio); |
| + setTimeout(_ => audio.src = findMediaFile('audio', 'content/test'), 0); |
| + assert_false(audio.paused); |
|
foolip
2016/08/03 16:31:51
Ahem, I neglected to read the tests the first time
mlamouri (slow - plz ping)
2016/08/04 11:16:16
Done.
|
| + }, |
| + |
| + // Test that when the load algorithm is run, if it does not pause the |
| + // playback, it will leave the promise pending, allowing it to be resolved |
| + // (version with preload='none'). |
| + // TODO(mlamouri): there is a bug in Blink where the media element ends up |
| + // in a broken state, see https://crbug.com/633591 |
| + // function loadAlgorithmKeepPromisesPendingWhenNotPausingAndPreloadNone(t, audio) { |
| + // audio.preload = 'none'; |
| + // playExpectingRejectedPromise(t, audio, 'AbortError'); |
| + // setTimeout(_ => audio.src = findMediaFile('audio', 'content/test'), 0); |
| + // }, |
| + |
| + // Test that when the load algorithm is run, if it does pause the playback, |
| + // it will reject the pending promises. |
| + function loadAlgorithmRejectPromisesWhenPausing(t, audio) { |
| + playExpectingRejectedPromise(t, audio, 'AbortError'); |
| + audio.src = findMediaFile('audio', 'content/test'); |
| + assert_true(audio.paused); |
| + }, |
| + |
| + // Test that when the load algorithm is run, if it does pause the playback, |
| + // it will reject the pending promises (version with preload='none'). |
| + function loadAlgorithmRejectPromisesWhenPausingAndPreloadNone(t, audio) { |
| + audio.preload = 'none'; |
| + playExpectingRejectedPromise(t, audio, 'AbortError'); |
| + audio.src = findMediaFile('audio', 'content/test'); |
| + assert_true(audio.paused); |
| + }, |
| ]; |
| tests.forEach(function(test) { |
| @@ -278,4 +326,4 @@ function playWithUserGesture(t, audio) { |
| eventSender.mouseDown(); |
| eventSender.mouseUp(); |
| } |
| -</script> |
| +</script> |