| Index: LayoutTests/webaudio/offlineaudiocontext-detached-no-crash.html
|
| diff --git a/LayoutTests/webaudio/scriptprocessornode-detached-no-crash.html b/LayoutTests/webaudio/offlineaudiocontext-detached-no-crash.html
|
| similarity index 54%
|
| copy from LayoutTests/webaudio/scriptprocessornode-detached-no-crash.html
|
| copy to LayoutTests/webaudio/offlineaudiocontext-detached-no-crash.html
|
| index 9ab6745d7d42b5d0f9052e8bc66e56bd1fd6aae9..378de48ed496fbb1b6bf5fd27234c36a756403b2 100644
|
| --- a/LayoutTests/webaudio/scriptprocessornode-detached-no-crash.html
|
| +++ b/LayoutTests/webaudio/offlineaudiocontext-detached-no-crash.html
|
| @@ -7,44 +7,51 @@
|
| </head>
|
| <body>
|
| <script>
|
| -description("Tests that ScriptProcessorNode event dispatch doesn't fail when detached from document.");
|
| +description("Tests document-detached use of OfflineAudioContext, pass if no crash.");
|
|
|
| window.jsTestIsAsync = true;
|
|
|
| -var sampleRate = 44100.0;
|
| -var renderLengthInFrames = 512;
|
| -var bufferSize = 512;
|
| +function errorCallback(error)
|
| +{
|
| + testPassed("OfflineAudioContext.startRendering() on a closed context threw an exception.");
|
| + finishJSTest();
|
| +}
|
| +
|
| +function successCallback()
|
| +{
|
| + testFailed("OfflineAudioContext.startRendering() on a closed context did not throw an exception.");
|
| + finishJSTest();
|
| +}
|
| +
|
| var context;
|
| function runTest()
|
| {
|
| - var node;
|
| + context.startRendering().then(successCallback, errorCallback);
|
| +}
|
|
|
| - try {
|
| - node = context.createScriptProcessor(bufferSize, 0, 1);
|
| - testPassed("Successfully created ScriptProcessorNode.");
|
| - } catch (e) {
|
| - testFailed("Failed to create ScriptProcessorNode.");
|
| - }
|
| +function createOfflineContext()
|
| +{
|
| + var sampleRate = 44100.0;
|
| + var renderLengthInFrames = 512;
|
| + var bufferSize = 512;
|
|
|
| + context = new w.OfflineAudioContext(1, renderLengthInFrames, sampleRate);
|
| + var node = context.createScriptProcessor(bufferSize, 0, 1);
|
| var source = context.createBufferSource();
|
| source.buffer = createImpulseBuffer(context, bufferSize);
|
| -
|
| node.onaudioprocess = function(e) { };
|
| source.connect(node);
|
| node.connect(context.destination);
|
| source.start(0);
|
| -
|
| - context.startRendering();
|
| }
|
|
|
| var w;
|
| function processMessage(event) {
|
| if (event.data == "opened") {
|
| - context = new w.OfflineAudioContext(1, renderLengthInFrames, sampleRate);
|
| + createOfflineContext();
|
| w.close();
|
| } else if (event.data == "closed") {
|
| - runTest();
|
| - finishJSTest();
|
| + setTimeout(runTest, 100);
|
| }
|
| }
|
|
|
|
|