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