audiocontext-state-change-after-close.http.window.js (1097B)
1 'use strict'; 2 3 promise_test(async t => { 4 let audioContext = new AudioContext(); 5 await new Promise((resolve) => (audioContext.onstatechange = resolve)); 6 await audioContext.close(); 7 return promise_rejects_dom( 8 t, 'InvalidStateError', audioContext.close(), 9 'A closed AudioContext should reject calls to close'); 10 }, 'Call close on a closed AudioContext'); 11 12 promise_test(async t => { 13 let audioContext = new AudioContext(); 14 await new Promise((resolve) => (audioContext.onstatechange = resolve)); 15 await audioContext.close(); 16 return promise_rejects_dom( 17 t, 'InvalidStateError', audioContext.resume(), 18 'A closed AudioContext should reject calls to resume'); 19 }, 'Call resume on a closed AudioContext'); 20 21 promise_test(async t => { 22 let audioContext = new AudioContext(); 23 await new Promise((resolve) => (audioContext.onstatechange = resolve)); 24 await audioContext.close(); 25 return promise_rejects_dom( 26 t, 'InvalidStateError', audioContext.suspend(), 27 'A closed AudioContext should reject calls to suspend'); 28 }, 'Call suspend on a closed AudioContext');