blob: b6caff9c985efde17b72ce8388a59e90702452c0 [file] [log] [blame]
<!DOCTYPE html>
<title>Verify that autoplaying Web Audio from a cross origin iframe is blocked by the autoplay policy</title>
<script src='../resources/testharness.js'></script>
<script src='../resources/testharnessreport.js'></script>
<body></body>
<script>
async_test(t => {
// Setup the flags before the test is run.
internals.settings.setAutoplayPolicy('document-user-activation-required');
internals.runtimeFlags.autoplayIgnoresWebAudioEnabled = false;
window.addEventListener('message', t.step_func(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>