OLD | NEW |
| (Empty) |
1 <!DOCTYPE HTML> | |
2 <html> | |
3 <head> | |
4 <script src="../resources/js-test.js"></script> | |
5 <script src="resources/compatibility.js"></script> | |
6 <script src="resources/audit-util.js"></script> | |
7 <script src="resources/audio-testing.js"></script> | |
8 </head> | |
9 <body> | |
10 <script> | |
11 description("Tests document-detached use of AudioContext, pass if no crash."); | |
12 | |
13 window.jsTestIsAsync = true; | |
14 | |
15 var sampleRate = 44100.0; | |
16 var renderLengthInFrames = 512; | |
17 var bufferSize = 512; | |
18 var context; | |
19 var node; | |
20 function runTest() | |
21 { | |
22 try { | |
23 node = context.createScriptProcessor(bufferSize, 0, 1); | |
24 var source = context.createBufferSource(); | |
25 source.buffer = createImpulseBuffer(context, bufferSize); | |
26 node.onaudioprocess = function(e) { }; | |
27 source.connect(node); | |
28 node.connect(context.destination); | |
29 source.start(0); | |
30 | |
31 context.startRendering(); | |
32 } catch (e) { | |
33 // The context has been stopped and detached; nothing to test. | |
34 return; | |
35 } | |
36 } | |
37 | |
38 var w; | |
39 function processMessage(event) { | |
40 if (event.data == "opened") { | |
41 context = new w.OfflineAudioContext(1, renderLengthInFrames, sampleRate)
; | |
42 w.close(); | |
43 } else if (event.data == "closed") { | |
44 runTest(); | |
45 finishJSTest(); | |
46 } | |
47 } | |
48 | |
49 if (window.testRunner) { | |
50 testRunner.dumpAsText(); | |
51 testRunner.waitUntilDone(); | |
52 testRunner.setCanOpenWindows(); | |
53 } | |
54 | |
55 w = window.open('../resources/window-postmessage-open-close.html'); | |
56 window.addEventListener("message", processMessage, false); | |
57 </script> | |
58 </body> | |
59 </html> | |
OLD | NEW |