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

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

Issue 2020753002: Throw exception if curve is too short for setValueCurveAtTime (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 <title>Test Exceptions from setValueCurveAtTime</title> 4 <title>Test Exceptions from setValueCurveAtTime</title>
5 <script src="../resources/js-test.js"></script> 5 <script src="../resources/js-test.js"></script>
6 <script src="resources/compatibility.js"></script> 6 <script src="resources/compatibility.js"></script>
7 <script src="resources/audio-testing.js"></script> 7 <script src="resources/audio-testing.js"></script>
8 </head> 8 </head>
9 9
10 <body> 10 <body>
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 236
237 var prefix = "setValueCurve with adjoining automation functions"; 237 var prefix = "setValueCurve with adjoining automation functions";
238 if (success) 238 if (success)
239 testPassed(prefix + " allowed as expected.\n"); 239 testPassed(prefix + " allowed as expected.\n");
240 else 240 else
241 testFailed(prefix + " unexpectedly signaled errors.\n"); 241 testFailed(prefix + " unexpectedly signaled errors.\n");
242 242
243 done(); 243 done();
244 }); 244 });
245 245
246 audit.defineTask("curve lengths", function (done) {
247 var success = true;
248 var context = new OfflineAudioContext(1, testDurationFrames, sampleRate) ;
249 var g = context.createGain();
250 var time = 0;
251
252 // Check for invalid curve lengths
253 success = Should("setValueCurveAtTime([], " + time + ", 0.01)", function () {
254 g.gain.setValueCurveAtTime(Float32Array.from([]), time, 0.01);
255 }).throw("InvalidStateError") && success;
256
257 success = Should("setValueCurveAtTime([1], " + time + ", 0.01)", functio n () {
258 g.gain.setValueCurveAtTime(Float32Array.from([1]), time, 0.01);
259 }).throw("InvalidStateError") && success;
260
261 success = Should("setValueCurveAtTime([1,2], " + time + ", 0.01)", funct ion () {
262 g.gain.setValueCurveAtTime(Float32Array.from([1,2]), time, 0.01);
263 }).notThrow() && success;
264
265 if (success)
266 testPassed("Exceptions for curve length correctly handled.\n");
267 else
268 testFailed("Exceptions for curve length not correctly handled.\n");
269
270 done();
271 });
272
246 audit.defineTask("finish", function (done) { 273 audit.defineTask("finish", function (done) {
247 finishJSTest(); 274 finishJSTest();
248 done(); 275 done();
249 }); 276 });
250 277
251 audit.runTasks(); 278 audit.runTasks();
252 successfullyParsed = true; 279 successfullyParsed = true;
253 </script> 280 </script>
254 </body> 281 </body>
255 </html> 282 </html>
256 283
257 284
258 285
259 286
260 287
261 288
262 289
263 290
264 291
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698