| Index: third_party/WebKit/ManualTests/webaudio/scriptprocessornode-premature-gc.html
|
| diff --git a/third_party/WebKit/ManualTests/webaudio/scriptprocessornode-premature-gc.html b/third_party/WebKit/ManualTests/webaudio/scriptprocessornode-premature-gc.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..dcb4f15fb73a4909e852833b97904a47a7401064
|
| --- /dev/null
|
| +++ b/third_party/WebKit/ManualTests/webaudio/scriptprocessornode-premature-gc.html
|
| @@ -0,0 +1,80 @@
|
| +<!doctype html>
|
| +<html>
|
| + <head>
|
| + <title>Test premature GC on ScriptProcessorNode</title>
|
| + <style type="text/css">
|
| + body {
|
| + margin: 2em;
|
| + }
|
| + .manual-test-ui {
|
| + font-family: Arial;
|
| + padding: 1em;
|
| + border: 1px solid #999;
|
| + }
|
| + .manual-test-ui button {
|
| + padding: 1em;
|
| + font-size: 1em;
|
| + }
|
| + #eError {
|
| + font-family: Arial;
|
| + margin: 0.75em;
|
| + color: red;
|
| + }
|
| + </style>
|
| + </head>
|
| +
|
| + <body>
|
| + <h1>Test Premature GC on ScriptProcessorNode</h1>
|
| +
|
| + <p><strong>NOTE: This test requires HTTP server and getUserMedia (i.e. live
|
| + audio input).</strong></p>
|
| +
|
| + <p>ScriptProcessorNode's the node reference should not get garbage collected
|
| + even when it is out of scope as long as <code>onaudioprocess</code>
|
| + handler is active.</p>
|
| +
|
| + <p>This test must be performed manually, because 1) ScriptProcessorNode is
|
| + not compatible with OfflineAudioContext, thus 2)
|
| + <code>onaudioprocess</code> is being fired asynchronously.</p>
|
| +
|
| + <p>As soon as this page loads, you should see the counter number increases
|
| + without stopping. Without the fix, the counter does not increase at all.
|
| + This test can be flaky, so it should be attempted repeatedly to see fail.
|
| + </p>
|
| +
|
| + <p>CRBUG issue: <a href="https://bugs.chromium.org/p/chromium/issues/detail?id=360378" target="_blank">
|
| + 360378</a></p>
|
| +
|
| + <div class="manual-test-ui">
|
| + <p><code>onaudioprocess</code> called: <span id="eHandlerCounter">0</span></p>
|
| + </div>
|
| +
|
| + <script type="text/javascript">
|
| + var eHandlerCounter = document.querySelector('#eHandlerCounter');
|
| + var counter = 0;
|
| +
|
| + function handleGUMStream (stream) {
|
| + var context = new AudioContext();
|
| + var streamSource = context.createMediaStreamSource(stream);
|
| + var scriptNode = context.createScriptProcessor(4096, 1, 1);
|
| +
|
| + scriptNode.onaudioprocess = function (event) {
|
| + var input = event.inputBuffer.getChannelData(0);
|
| + var output = event.outputBuffer.getChannelData(0);
|
| + output.set(input);
|
| + eHandlerCounter.textContent = counter++;
|
| + };
|
| +
|
| + streamSource.connect(scriptNode).connect(context.destination);
|
| + }
|
| +
|
| + function streamFailed (error) {
|
| + eHandlerCounter.textContent = 'Input Stream Error. (' + error + ')';
|
| + }
|
| +
|
| + navigator.webkitGetUserMedia({
|
| + audio: true
|
| + }, handleGUMStream, streamFailed);
|
| + </script>
|
| + </body>
|
| +</html>
|
|
|