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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/media/autoplay-crossorigin.html

Issue 2496593002: Adding an experimental flag to block autoplay with sound in cross-origin iframes (Closed)
Patch Set: nits Created 4 years 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/http/tests/media/autoplay-crossorigin.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/autoplay-crossorigin.html b/third_party/WebKit/LayoutTests/http/tests/media/autoplay-crossorigin.html
new file mode 100644
index 0000000000000000000000000000000000000000..7ff81ef17d23d6d6657e22b02523884109fe2d53
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/media/autoplay-crossorigin.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<title>Verify that autoplaying HTMLMediaElement with sound from a cross origin iframe is blocked by crossOriginMediaPlaybackRequiresUserGesture</title>
+<script src='../resources/testharness.js'></script>
+<script src='../resources/testharnessreport.js'></script>
+<body></body>
+<script>
+async_test(t => {
+ window.addEventListener('message', t.step_func(e => {
+ if (e.data.videoId != 'video-muted')
+ return;
+ assert_equals('play', e.data.msg);
+ t.done();
+ }));
+}, "test that muted video in cross-origin iframe should autoplay");
+
+async_test(t => {
+ window.addEventListener('message', t.step_func(e => {
+ if (e.data.videoId != 'video')
+ return;
+ assert_equals('canplay', e.data.msg);
+ assert_true(e.data.isPaused);
+ assert_greater_than_equal(e.data.readyState, HTMLMediaElement.HAVE_ENOUGH_DATA);
+ t.done();
+ }));
+}, "test that muted video in cross-origin iframe should autoplay");
+
+var f = document.createElement('iframe');
+f.src = 'http://localhost:8000/media/resources/autoplay-crossorigin-iframe.html';
+f.width=10000;
+f.height=10000;
+document.body.appendChild(f);
+</script>

Powered by Google App Engine
This is Rietveld 408576698