Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/media/autoplay-muted.html |
| diff --git a/third_party/WebKit/LayoutTests/media/autoplay-muted.html b/third_party/WebKit/LayoutTests/media/autoplay-muted.html |
| index e0b5926b5d75ddd2587fc0b5ba9caa570f8af721..2de88e10382cf8471b7711599dbd5f349cf0e3bf 100644 |
| --- a/third_party/WebKit/LayoutTests/media/autoplay-muted.html |
| +++ b/third_party/WebKit/LayoutTests/media/autoplay-muted.html |
| @@ -17,13 +17,21 @@ |
| window.internals.runtimeFlags.autoplayMutedVideosEnabled = true; |
| testRunner.setAutoplayAllowed(true); |
| - function createMutedVideoElement() { |
| - var e = document.createElement('video'); |
| - e.src = findMediaFile('video', 'content/test'); |
| + function createMutedMediaElement(type) { |
| + var e = document.createElement(type); |
| + e.src = findMediaFile(type, 'content/test'); |
| e.muted = true; |
| return e; |
| } |
| + function createMutedVideoElement() { |
| + return createMutedMediaElement('video'); |
| + } |
| + |
| + function createMutedAudioElement() { |
| + return createMutedMediaElement('audio'); |
| + } |
| + |
| async_test(function(t) { |
| var e = createMutedVideoElement(); |
| e.autoplay = true; |
| @@ -40,6 +48,26 @@ |
| return createMutedVideoElement().play(); |
| }, "Test that play() on a muted video succeeds without gesture."); |
| + promise_test(function (t) { |
| + return promise_rejects( |
| + t, |
| + new DOMException( |
| + 'play() can only be initiated by a user gesture.', |
| + 'NotAllowedError'), |
| + createMutedAudioElement().play()); |
| + }, "Test that play() on a muted audio without gesture will reject."); |
| + |
| + async_test(function (t) { |
| + var e = createMutedAudioElement(); |
| + e.autoplay = true; |
| + e.onplay = t.unreached_func(); |
| + e.oncanplaythrough = t.step_func(function() { |
| + setTimeout(t.step_func_done(function() { |
| + assert_true(e.paused); |
| + }), 100); |
|
mlamouri (slow - plz ping)
2016/06/15 20:29:12
You should avoid setTimeout() with other values th
whywhat
2016/06/16 12:39:46
Done.
|
| + }); |
| + }, "Test that autoplay on a muted audio without gesture has no effect."); |
| + |
| promise_test(function(t) { |
| var e = createMutedVideoElement(); |
| return e.play().then(t.step_func_done(function() { |