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

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: move click simulation to top frame 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/webaudio/resources/autoplay-crossorigin-iframe.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..138b2fab153bcb9208b2bc1f03edf917b35c9d21
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/webaudio/autoplay-crossorigin.html
@@ -0,0 +1,49 @@
+<!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 'clickme':
+ if (!('eventSender' in window))
+ return;
+
+ var boundingRect = document.querySelector('iframe').getBoundingClientRect();
+ var x = boundingRect.left + boundingRect.width / 2;
+ var y = boundingRect.top + boundingRect.height / 2;
+
+ eventSender.mouseMoveTo(x, y);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ break;
+ 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>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/webaudio/resources/autoplay-crossorigin-iframe.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698