blob: 09670899b3b6a712f0714d03f3f4f2e5867c9d91 [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");
context = iframe.contentWindow.audioContext;
iframe.remove();
runTests();
}, "Load test iframe");
function runTests()
{
test(() => {
assert_throws('InvalidStateError', () => context.createBufferSource());
}, "createBufferSource");
test(() => {
assert_throws('InvalidStateError', () => context.createMediaElementSource(video));
}, "createMediaElementSource");
test(() => {
assert_throws('InvalidStateError', () => context.createMediaStreamDestination());
}, "createMediaStreamDestination");
test(() => {
assert_throws('InvalidStateError', () => context.createGain());
}, "createGain");
test(() => {
assert_throws('InvalidStateError', () => context.createDelay());
}, "createDelay");
test(() => {
assert_throws('InvalidStateError', () => context.createBiquadFilter());
}, "createBiquadFilter");
test(() => {
assert_throws('InvalidStateError', () => context.createWaveShaper());
}, "createWaveShapper");
test(() => {
assert_throws('InvalidStateError', () => context.createPanner());
}, "createPanner");
test(() => {
assert_throws('InvalidStateError', () => context.createConvolver());
}, "createConvolver");
test(() => {
assert_throws('InvalidStateError', () => context.createDynamicsCompressor());
}, "createDynamicsCompressor");
test(() => {
assert_throws('InvalidStateError', () => context.createAnalyser());
}, "createAnalyser");
test(() => {
assert_throws('InvalidStateError', () => context.createScriptProcessor());
}, "createScriptProcessor");
test(() => {
assert_throws('InvalidStateError', () => context.createOscillator());
}, "createOscillator");
test(() => {
assert_throws('InvalidStateError', () => 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>