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

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

Issue 2314903002: Web Audio: when media playback requires a user gesture, apply rule to cross origin iframes. (Closed)
Patch Set: apply changes from TPAC discussion Created 4 years, 3 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/http/tests/webaudio/autoplay-crossorigin.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/webaudio/autoplay-crossorigin.html b/third_party/WebKit/LayoutTests/http/tests/webaudio/autoplay-crossorigin.html
new file mode 100644
index 0000000000000000000000000000000000000000..8e83b203a300703972027fa6e520786fb558ec44
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/webaudio/autoplay-crossorigin.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<title>Verify that autoplaying Web Audio from a cross origin iframe is blocked by mediaPlaybackRequiresUserGesture</title>
+<script src='../resources/testharness.js'></script>
+<script src='../resources/testharnessreport.js'></script>
+<body></body>
+<script>
+async_test(t => {
+ if ('internals' in window)
+ window.internals.settings.setMediaPlaybackRequiresUserGesture(true);
+
+ window.addEventListener('message', e => {
+ switch (e.data.msg) {
+ case 'initialState':
+ case 'initialOfflineState':
+ case 'afterResume':
+ case 'afterOscillator':
+ case 'stateOtherContextAfterClick':
+ case 'stateOtherContextAfterSecondClick':
+ assert_equals(e.data.value, 'suspended', e.data.msg);
+ break;
+ case 'stateAfterClick':
+ case 'stateCreatedAfterClick':
+ assert_equals(e.data.value, 'running', e.data.msg);
+ break;
+ case 'done':
+ t.done();
+ break;
+ default:
+ assert_unreached();
+ }
+ });
+
+ var f = document.createElement('iframe');
+ f.src = 'http://localhost:8000/webaudio/resources/autoplay-crossorigin-iframe.html';
+ document.body.appendChild(f);
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698