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

Unified Diff: third_party/WebKit/LayoutTests/media/autoplay-muted.html

Issue 2065363002: [Android, Video, Autoplay] Only autoplay muted videos, ignore audio tags. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed setTimeout to 0 Created 4 years, 6 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLMediaElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..7338c01f56c619e0bd1a2522c60e028c3e69ebf1 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);
+ }), 0);
+ });
+ }, "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() {
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLMediaElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698