Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(420)

Side by Side Diff: LayoutTests/webaudio/javascriptaudionode.html

Issue 14028011: Made AudioNode an EventTarget (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../fast/js/resources/js-test-pre.js"></script> 4 <script src="../fast/js/resources/js-test-pre.js"></script>
5 <script type="text/javascript" src="resources/audio-testing.js"></script> 5 <script type="text/javascript" src="resources/audio-testing.js"></script>
6 </head> 6 </head>
7 7
8 <body> 8 <body>
9 9
10 <div id="description"></div> 10 <div id="description"></div>
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 function doBufferSizeTest(size) { 69 function doBufferSizeTest(size) {
70 try { 70 try {
71 var jsnode = context.createScriptProcessor(size, 1, 1); 71 var jsnode = context.createScriptProcessor(size, 1, 1);
72 testPassed("Successfully created ScriptProcessorNode with bufferSize = " + size + "."); 72 testPassed("Successfully created ScriptProcessorNode with bufferSize = " + size + ".");
73 } catch(e) { 73 } catch(e) {
74 testFailed("Failed to create ScriptProcessorNode with bufferSize = " + s ize + "."); 74 testFailed("Failed to create ScriptProcessorNode with bufferSize = " + s ize + ".");
75 } 75 }
76 } 76 }
77 77
78 function performGCTest() {
79 // now test that ScriptProcessorNodes are not garbage collected
80 // if they are unreachable but connected to a running audio context.
81 var context = new webkitOfflineAudioContext(2, renderLengthInFrames, sampleR ate);
82
83 window.audioprocessWasCalled = false;
84
85 context.oncomplete = function () {
86 shouldBeTrue('audioprocessWasCalled');
87 finishJSTest();
88 };
89
90 // add the scriptprocessor and callback in a nested function to be sure they 'll
91 // be unreachable.
92 (function() {
93 var jsnode = context.createScriptProcessor(bufferSize, 0, 1);
94 jsnode.onaudioprocess = function() {
95 audioprocessWasCalled = true;
96 };
97 jsnode.connect(context.destination);
98 })();
99 gc();
100 context.startRendering();
101 }
102
78 function runTest() { 103 function runTest() {
79 if (window.testRunner) { 104 if (window.testRunner) {
80 testRunner.dumpAsText(); 105 testRunner.dumpAsText();
81 testRunner.waitUntilDone(); 106 testRunner.waitUntilDone();
82 } 107 }
83 108
84 window.jsTestIsAsync = true; 109 window.jsTestIsAsync = true;
85 110
86 // Create offline audio context. 111 // Create offline audio context.
87 context = new webkitOfflineAudioContext(2, renderLengthInFrames, sampleRate) ; 112 context = new webkitOfflineAudioContext(2, renderLengthInFrames, sampleRate) ;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 var bufferSource = context.createBufferSource(); 166 var bufferSource = context.createBufferSource();
142 bufferSource.buffer = sourceBuffer; 167 bufferSource.buffer = sourceBuffer;
143 168
144 var jsnode = context.createScriptProcessor(bufferSize, 2, outputChannels); 169 var jsnode = context.createScriptProcessor(bufferSize, 2, outputChannels);
145 170
146 bufferSource.connect(jsnode); 171 bufferSource.connect(jsnode);
147 jsnode.connect(context.destination); 172 jsnode.connect(context.destination);
148 jsnode.onaudioprocess = processAudioData; 173 jsnode.onaudioprocess = processAudioData;
149 174
150 bufferSource.noteOn(0); 175 bufferSource.noteOn(0);
151 context.oncomplete = finishJSTest; 176 context.oncomplete = performGCTest;
152 context.startRendering(); 177 context.startRendering();
178
153 } 179 }
154 180
155 runTest(); 181 runTest();
156 182
157 </script> 183 </script>
158 184
159 <script src="../fast/js/resources/js-test-post.js"></script> 185 <script src="../fast/js/resources/js-test-post.js"></script>
160 </body> 186 </body>
161 </html> 187 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698