1
0
Fork 0
firefox/testing/web-platform/tests/webaudio/the-audio-api/the-audiocontext-interface/audiocontext-state-change-after-close.http.window.js
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

28 lines
1.1 KiB
JavaScript

'use strict';
promise_test(async t => {
let audioContext = new AudioContext();
await new Promise((resolve) => (audioContext.onstatechange = resolve));
await audioContext.close();
return promise_rejects_dom(
t, 'InvalidStateError', audioContext.close(),
'A closed AudioContext should reject calls to close');
}, 'Call close on a closed AudioContext');
promise_test(async t => {
let audioContext = new AudioContext();
await new Promise((resolve) => (audioContext.onstatechange = resolve));
await audioContext.close();
return promise_rejects_dom(
t, 'InvalidStateError', audioContext.resume(),
'A closed AudioContext should reject calls to resume');
}, 'Call resume on a closed AudioContext');
promise_test(async t => {
let audioContext = new AudioContext();
await new Promise((resolve) => (audioContext.onstatechange = resolve));
await audioContext.close();
return promise_rejects_dom(
t, 'InvalidStateError', audioContext.suspend(),
'A closed AudioContext should reject calls to suspend');
}, 'Call suspend on a closed AudioContext');