4 <script src=
"resources/compatibility.js"></script>
5 <script src=
"resources/audio-testing.js"></script>
6 <script src=
"../resources/js-test.js"></script>
10 description("Tests document-detached use of AudioContext, pass if no crash.");
12 window
.jsTestIsAsync
= true;
14 var sampleRate
= 44100.0;
15 var renderLengthInFrames
= 512;
22 node
= context
.createScriptProcessor(bufferSize
, 0, 1);
23 var source
= context
.createBufferSource();
24 source
.buffer
= createImpulseBuffer(context
, bufferSize
);
25 node
.onaudioprocess = function(e
) { };
27 node
.connect(context
.destination
);
30 context
.startRendering();
32 // The context has been stopped and detached; nothing to test.
38 function processMessage(event
) {
39 if (event
.data
== "opened") {
40 context
= new w
.OfflineAudioContext(1, renderLengthInFrames
, sampleRate
);
42 } else if (event
.data
== "closed") {
48 if (window
.testRunner
) {
49 testRunner
.dumpAsText();
50 testRunner
.waitUntilDone();
51 testRunner
.setCanOpenWindows();
54 w
= window
.open('../resources/window-postmessage-open-close.html');
55 window
.addEventListener("message", processMessage
, false);