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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/dom-exceptions.html

Issue 1493753003: Drop [LegacyInterfaceTypeChecking] for the Web Audio API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update tests Created 5 years 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 PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="resources/compatibility.js"></script> 4 <script src="resources/compatibility.js"></script>
5 <script src="resources/audio-testing.js"></script> 5 <script src="resources/audio-testing.js"></script>
6 <script src="../resources/js-test.js"></script> 6 <script src="../resources/js-test.js"></script>
7 <script src="resources/biquad-testing.js"></script> 7 <script src="resources/biquad-testing.js"></script>
8 </head> 8 </head>
9 9
10 <body> 10 <body>
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 shouldThrowAndBeUnchanged("node.fftSize", "65536"); 88 shouldThrowAndBeUnchanged("node.fftSize", "65536");
89 89
90 shouldThrowAndBeUnchanged("node.minDecibels", "-10"); 90 shouldThrowAndBeUnchanged("node.minDecibels", "-10");
91 shouldThrowAndBeUnchanged("node.maxDecibels", "-150"); 91 shouldThrowAndBeUnchanged("node.maxDecibels", "-150");
92 shouldThrowAndBeUnchanged("node.minDecibels", "-30"); 92 shouldThrowAndBeUnchanged("node.minDecibels", "-30");
93 shouldThrowAndBeUnchanged("node.maxDecibels", "-100"); 93 shouldThrowAndBeUnchanged("node.maxDecibels", "-100");
94 94
95 shouldThrowAndBeUnchanged("node.smoothingTimeConstant", "-0.1"); 95 shouldThrowAndBeUnchanged("node.smoothingTimeConstant", "-0.1");
96 shouldThrowAndBeUnchanged("node.smoothingTimeConstant", "1.5"); 96 shouldThrowAndBeUnchanged("node.smoothingTimeConstant", "1.5");
97 97
98 shouldThrow("node.getFloatFrequencyData(null)");
99 shouldThrow("node.getByteFrequencyData(null)");
100 shouldThrow("node.getFloatTimeDomainData(null)");
101 shouldThrow("node.getByteTimeDomainData(null)");
102
98 // AudioBuffers 103 // AudioBuffers
99 node = context.createBuffer(1,1, context.sampleRate); 104 node = context.createBuffer(1,1, context.sampleRate);
100 // Invalid channel index: IndexSizeError 105 // Invalid channel index: IndexSizeError
101 shouldThrow("node.getChannelData(2)"); 106 shouldThrow("node.getChannelData(2)");
102 107
103 // AudioNode connections 108 // AudioNode connections
104 node = context.createGain(); 109 node = context.createGain();
105 node2 = context.createGain(); 110 node2 = context.createGain();
106 // Invalid destination node (unspecified error) 111 // Invalid destination node (unspecified error)
107 shouldThrow("node.connect(null, 0, 0)"); 112 shouldThrow("node.connect(null, 0, 0)");
(...skipping 27 matching lines...) Expand all
135 // the actual attached hardware. 140 // the actual attached hardware.
136 try { 141 try {
137 eval("context.destination.channelCount = 99"); 142 eval("context.destination.channelCount = 99");
138 } catch (e) { 143 } catch (e) {
139 if (e.message === "Failed to set the 'channelCount' property on 'AudioNo de': The channel count provided (99) is outside the range [1, " + context.destin ation.maxChannelCount + "]." && e.name === "IndexSizeError") 144 if (e.message === "Failed to set the 'channelCount' property on 'AudioNo de': The channel count provided (99) is outside the range [1, " + context.destin ation.maxChannelCount + "]." && e.name === "IndexSizeError")
140 testPassed("context.destination.channelCount = 99 threw IndexSizeErr or exception on invalid channel count."); 145 testPassed("context.destination.channelCount = 99 threw IndexSizeErr or exception on invalid channel count.");
141 else 146 else
142 testFailed("context.destination.channelCount = 99 should throw Index SizeError exception on invalid channel count."); 147 testFailed("context.destination.channelCount = 99 should throw Index SizeError exception on invalid channel count.");
143 } 148 }
144 149
150 // AudioParams
151 param = context.createGain().gain;
152 shouldThrow("param.setValueCurveAtTime(null, 0, 0)");
153
154 // BiquadFilterNode
155 node = context.createBiquadFilter();
156 shouldNotThrow("node.getFrequencyResponse(new Float32Array(1), new Float32Ar ray(1), new Float32Array(1))");
157 shouldThrow("node.getFrequencyResponse(null, new Float32Array(1), new Float3 2Array(1))");
158 shouldThrow("node.getFrequencyResponse(new Float32Array(1), null, new Float3 2Array(1))");
159 shouldThrow("node.getFrequencyResponse(new Float32Array(1), new Float32Array (1), null)");
160
145 // Delay nodes are tested elsewhere, so don't duplicate that work here. 161 // Delay nodes are tested elsewhere, so don't duplicate that work here.
146 162
147 // OfflineAudioContext 163 // OfflineAudioContext
148 // Max supported channels 164 // Max supported channels
149 shouldNotThrow("new OfflineAudioContext(32, 100, context.sampleRate)"); 165 shouldNotThrow("new OfflineAudioContext(32, 100, context.sampleRate)");
150 // Invalid number of channels (unspecified error) 166 // Invalid number of channels (unspecified error)
151 shouldThrow("new OfflineAudioContext(99, 100, context.sampleRate)"); 167 shouldThrow("new OfflineAudioContext(99, 100, context.sampleRate)");
152 // Invalid sample rate. (unspecified error) 168 // Invalid sample rate. (unspecified error)
153 shouldThrow("new OfflineAudioContext(1, 100, 1)"); 169 shouldThrow("new OfflineAudioContext(1, 100, 1)");
154 shouldThrow("new OfflineAudioContext(1, 100, 1e6)"); 170 shouldThrow("new OfflineAudioContext(1, 100, 1e6)");
155 // Invalid frame length (crbug.com/351277) 171 // Invalid frame length (crbug.com/351277)
156 shouldThrow("new OfflineAudioContext(1, -88200000000000, 44100)"); 172 shouldThrow("new OfflineAudioContext(1, -88200000000000, 44100)");
157 173
158 // WaveShaper types 174 // WaveShaper types
159 node = context.createWaveShaper(); 175 node = context.createWaveShaper();
160 currentOversample = node.oversample; 176 currentOversample = node.oversample;
161 shouldNotThrow("node.oversample = '9x'"); 177 shouldNotThrow("node.oversample = '9x'");
162 if (node.oversample == currentOversample) 178 if (node.oversample == currentOversample)
163 testPassed("Invalid oversample value did not change node.oversample"); 179 testPassed("Invalid oversample value did not change node.oversample");
164 else 180 else
165 testFailed("node.oversample incorrectly changed to invalid value " + node. oversample); 181 testFailed("node.oversample incorrectly changed to invalid value " + node. oversample);
182 shouldThrow("node.curve = {}");
166 shouldThrow("node.curve = new Float32Array(1)"); 183 shouldThrow("node.curve = new Float32Array(1)");
167 shouldBeNull("node.curve"); 184 shouldBeNull("node.curve");
168 shouldNotThrow("node.curve = new Float32Array(2)"); 185 shouldNotThrow("node.curve = new Float32Array(2)");
169 shouldNotThrow("node.curve = null"); 186 shouldNotThrow("node.curve = null");
170 187
171 // Start/stop for AudioBufferSourceNodes 188 // Start/stop for AudioBufferSourceNodes
172 buffer = context.createBuffer(1,1, context.sampleRate); 189 buffer = context.createBuffer(1,1, context.sampleRate);
173 shouldNotThrow("source = context.createBufferSource()"); 190 shouldNotThrow("source = context.createBufferSource()");
174 shouldNotThrow("source.buffer = buffer"); 191 shouldNotThrow("source.buffer = buffer");
175 shouldThrow("source.buffer = context.createBuffer(1, 10, context.sampleRate) "); 192 shouldThrow("source.buffer = context.createBuffer(1, 10, context.sampleRate) ");
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 shouldThrow("source.stop(-Infinity)"); 256 shouldThrow("source.stop(-Infinity)");
240 shouldThrow("source.stop(NaN)"); 257 shouldThrow("source.stop(NaN)");
241 shouldNotThrow("source.stop()"); 258 shouldNotThrow("source.stop()");
242 259
243 shouldNotThrow("osc = context.createOscillator()"); 260 shouldNotThrow("osc = context.createOscillator()");
244 shouldThrow("osc.stop()"); 261 shouldThrow("osc.stop()");
245 shouldNotThrow("osc1 = context.createOscillator()"); 262 shouldNotThrow("osc1 = context.createOscillator()");
246 shouldNotThrow("osc1.start()"); 263 shouldNotThrow("osc1.start()");
247 shouldNotThrow("osc1.stop()"); 264 shouldNotThrow("osc1.stop()");
248 265
266 shouldThrow("osc.setPeriodicWave(null)");
267
249 // exponentialRampToValue should throw on non-positive target values. 268 // exponentialRampToValue should throw on non-positive target values.
250 node = context.createGain(); 269 node = context.createGain();
251 node.connect(context.destination); 270 node.connect(context.destination);
252 shouldThrow("node.gain.exponentialRampToValueAtTime(-1, 0.1)"); 271 shouldThrow("node.gain.exponentialRampToValueAtTime(-1, 0.1)");
253 shouldThrow("node.gain.exponentialRampToValueAtTime(0, 0.1)"); 272 shouldThrow("node.gain.exponentialRampToValueAtTime(0, 0.1)");
254 // See crbug.com/459391. 273 // See crbug.com/459391.
255 // Math.pow(2, -149) = 1.401298464324817e-45 is the double-float value of th e 274 // Math.pow(2, -149) = 1.401298464324817e-45 is the double-float value of th e
256 // least positive single float number. We do it this way to make sure no rou nd-off or conversion 275 // least positive single float number. We do it this way to make sure no rou nd-off or conversion
257 // errors happen when reading 1.401298464324817e-45. 276 // errors happen when reading 1.401298464324817e-45.
258 shouldNotThrow("node.gain.exponentialRampToValueAtTime(Math.pow(2, -149), 0. 1)"); 277 shouldNotThrow("node.gain.exponentialRampToValueAtTime(Math.pow(2, -149), 0. 1)");
259 // Math.pow(2, -150) = 7.006492321624085d-46 is the largest double float val ue such that 278 // Math.pow(2, -150) = 7.006492321624085d-46 is the largest double float val ue such that
260 // conversion to a float produces 0. Any larger value would produce a non-z ero value when 279 // conversion to a float produces 0. Any larger value would produce a non-z ero value when
261 // converted to a single float. 280 // converted to a single float.
262 shouldThrow("node.gain.exponentialRampToValueAtTime(Math.pow(2, -150), 0.1)" ); 281 shouldThrow("node.gain.exponentialRampToValueAtTime(Math.pow(2, -150), 0.1)" );
263 282
264 // Convolver buffer rate must match context rate. Create on offline context so we 283 // Convolver buffer rate must match context rate. Create on offline context so we
265 // specify the context rate exactly, in case the test is run on platforms wi th different 284 // specify the context rate exactly, in case the test is run on platforms wi th different
266 // HW sample rates. 285 // HW sample rates.
267 shouldNotThrow("oc = new OfflineAudioContext(1, 44100, 44100)"); 286 shouldNotThrow("oc = new OfflineAudioContext(1, 44100, 44100)");
268 shouldNotThrow("conv = oc.createConvolver()"); 287 shouldNotThrow("conv = oc.createConvolver()");
288 shouldThrow("conv.buffer = {}");
269 shouldThrow("conv.buffer = oc.createBuffer(1, 100, 22050)"); 289 shouldThrow("conv.buffer = oc.createBuffer(1, 100, 22050)");
270 // conv.buffer should be unchanged (null) because the above failed. 290 // conv.buffer should be unchanged (null) because the above failed.
271 shouldBeNull("conv.buffer"); 291 shouldBeNull("conv.buffer");
272 292
273 // PannerNode channel count and mode 293 // PannerNode channel count and mode
274 panner = context.createPanner(); 294 panner = context.createPanner();
275 // Channel count can only be set to 1 or 2. 295 // Channel count can only be set to 1 or 2.
276 shouldNotThrow("panner.channelCount = 1"); 296 shouldNotThrow("panner.channelCount = 1");
277 shouldNotThrow("panner.channelCount = 2"); 297 shouldNotThrow("panner.channelCount = 2");
278 shouldThrowAndBeUnchanged("panner.channelCount", "0"); 298 shouldThrowAndBeUnchanged("panner.channelCount", "0");
279 shouldThrowAndBeUnchanged("panner.channelCount", "3"); 299 shouldThrowAndBeUnchanged("panner.channelCount", "3");
280 // It is illegal to set the mode to 'max' 300 // It is illegal to set the mode to 'max'
281 shouldThrowAndBeUnchanged("panner.channelCountMode", "'max'"); 301 shouldThrowAndBeUnchanged("panner.channelCountMode", "'max'");
282 shouldNotThrow("panner.channelCountMode = 'explicit'"); 302 shouldNotThrow("panner.channelCountMode = 'explicit'");
(...skipping 21 matching lines...) Expand all
304 shouldBeUndefined("source.noteOn"); 324 shouldBeUndefined("source.noteOn");
305 shouldBeUndefined("source.noteOff"); 325 shouldBeUndefined("source.noteOff");
306 } 326 }
307 327
308 runTest(); 328 runTest();
309 successfullyParsed = true; 329 successfullyParsed = true;
310 330
311 </script> 331 </script>
312 </body> 332 </body>
313 </html> 333 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698