blob: 20e5e6ec0928081048d92c3884bcada9e4346da9 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<video id="video"></video>
<script>
function with_iframe(url) {
return new Promise(function(resolve) {
var frame = document.createElement('iframe');
frame.className = 'test-iframe';
frame.src = url;
frame.onload = function() { resolve(frame); };
document.body.appendChild(frame);
});
}
var context;
promise_test(async () => {
const iframe = await with_iframe("resources/audiocontext-stopped-iframe.html");
domExceptionConstructor = iframe.contentWindow.DOMException;
context = iframe.contentWindow.audioContext;
iframe.remove();
runTests();
}, "Load test iframe");
function runTests()
{
test(() => {
assert_throws_dom('InvalidStateError', domExceptionConstructor, () => context.createBufferSource());
}, "createBufferSource");
test(() => {
assert_throws_dom('InvalidStateError', domExceptionConstructor, () => context.createMediaElementSource(video));
}, "createMediaElementSource");
test(() => {
assert_throws_dom('InvalidStateError', domExceptionConstructor, () => context.createMediaStreamDestination());
}, "createMediaStreamDestination");
test(() => {
assert_throws_dom('InvalidStateError', domExceptionConstructor, () => context.createGain());
}, "createGain");
test(() => {
assert_throws_dom('InvalidStateError', domExceptionConstructor, () => context.createDelay());
}, "createDelay");
test(() => {
assert_throws_dom('InvalidStateError', domExceptionConstructor, () => context.createBiquadFilter());
}, "createBiquadFilter");
test(() => {
assert_throws_dom('InvalidStateError', domExceptionConstructor, () => context.createWaveShaper());
}, "createWaveShapper");
test(() => {
assert_throws_dom('InvalidStateError', domExceptionConstructor, () => context.createPanner());
}, "createPanner");
test(() => {
assert_throws_dom('InvalidStateError', domExceptionConstructor, () => context.createConvolver());
}, "createConvolver");
test(() => {
assert_throws_dom('InvalidStateError', domExceptionConstructor, () => context.createDynamicsCompressor());
}, "createDynamicsCompressor");
test(() => {
assert_throws_dom('InvalidStateError', domExceptionConstructor, () => context.createAnalyser());
}, "createAnalyser");
test(() => {
assert_throws_dom('InvalidStateError', domExceptionConstructor, () => context.createScriptProcessor());
}, "createScriptProcessor");
test(() => {
assert_throws_dom('InvalidStateError', domExceptionConstructor, () => context.createOscillator());
}, "createOscillator");
test(() => {
assert_throws_dom('InvalidStateError', domExceptionConstructor, () => context.createPeriodicWave(new Float32Array(1), new Float32Array(1)));
}, "createPeriodicWave");
promise_test((test) => {
return promise_rejects(test, 'InvalidStateError', context.suspend());
}, "suspend");
promise_test((test) => {
return promise_rejects(test, 'InvalidStateError', context.resume());
}, "resume");
promise_test((test) => {
return promise_rejects(test, 'InvalidStateError', context.close());
}, "close");
}
</script>
</body>
</html>