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

Side by Side Diff: LayoutTests/webaudio/audioparam-exceptional-values.html

Issue 927333004: Add [TypeChecking=Unrestricted] to Web Audio interfaces (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « no previous file | LayoutTests/webaudio/audioparam-exceptional-values-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/js-test.js"></script> 5 <script src="../resources/js-test.js"></script>
6 </head> 6 </head>
7 7
8 <body> 8 <body>
9 <script> 9 <script>
10 description("Test exceptional arguments for AudioParam timeline events"); 10 description("Test exceptional arguments for AudioParam timeline events");
11 11
12 var context; 12 var context;
13 var gain; 13 var gain;
14 14
15 // For these values, AudioParam methods should throw an error because they are invalid; only 15 // For these values, AudioParam methods should throw an error because they are invalid; only
16 // finite values are allowed. 16 // finite values are allowed.
17 var targetValues = [Infinity, -Infinity, NaN]; 17 var targetValues = [Infinity, -Infinity, NaN];
18 18
19 // For these time values, AudioParam methods should throw an error because they are 19 // For these time values, AudioParam methods should throw an error because they are
20 // invalid. Only finite non-negative values are allowed for any time or ti me-like parameter. 20 // invalid. Only finite non-negative values are allowed for any time or ti me-like parameter.
21 var timeValues = [-1, Infinity, -Infinity, NaN]; 21 var timeValues = [-1, Infinity, -Infinity, NaN];
22 22
23 // For these duration values, AudioParam methods should throw an error bec ause they are
24 // invalid. Only finite values are allowed for any duration parameter.
25 var durationValues = [-1, Infinity, -Infinity, NaN, 0];
26
23 // Just an array for use by setValueCurveAtTime. The length and contents o f the array are not 27 // Just an array for use by setValueCurveAtTime. The length and contents o f the array are not
24 // important. 28 // important.
25 var curve = new Float32Array(10); 29 var curve = new Float32Array(10);
26 30
27 function runTest() { 31 function runTest() {
28 if (window.testRunner) { 32 if (window.testRunner) {
29 testRunner.dumpAsText(); 33 testRunner.dumpAsText();
30 testRunner.waitUntilDone(); 34 testRunner.waitUntilDone();
31 } 35 }
32 window.jsTestIsAsync = true; 36 window.jsTestIsAsync = true;
33 37
34 context = new AudioContext(); 38 context = new AudioContext();
35 gain = context.createGain(); 39 gain = context.createGain();
36 40
37 // Test the value parameter 41 // Test the value parameter
38 for (value in targetValues) { 42 for (value of targetValues) {
39 shouldThrow("gain.gain.setValueAtTime(" + targetValues[value] + ", 1)" ); 43 shouldThrow("gain.gain.setValueAtTime(" + value + ", 1)");
40 shouldThrow("gain.gain.linearRampToValueAtTime(" + targetValues[value] + ", 1)"); 44 shouldThrow("gain.gain.linearRampToValueAtTime(" + value + ", 1)");
41 shouldThrow("gain.gain.exponentialRampToValueAtTime(" + targetValues[v alue] + ", 1)"); 45 shouldThrow("gain.gain.exponentialRampToValueAtTime(" + value + ", 1)" );
42 shouldThrow("gain.gain.setTargetAtTime(" + targetValues[value] + ", 1, 1)"); 46 shouldThrow("gain.gain.setTargetAtTime(" + value + ", 1, 1)");
43 } 47 }
44 48
45 // Test the time parameter 49 // Test the time parameter
46 for (startTime in timeValues) { 50 for (startTime of timeValues) {
47 shouldThrow("gain.gain.setValueAtTime(1, " + timeValues[startTime] + " )"); 51 shouldThrow("gain.gain.setValueAtTime(1, " + startTime + ")");
48 shouldThrow("gain.gain.linearRampToValueAtTime(1, " + timeValues[start Time] + ")"); 52 shouldThrow("gain.gain.linearRampToValueAtTime(1, " + startTime + ")") ;
49 shouldThrow("gain.gain.exponentialRampToValueAtTime(1, " + timeValues[ startTime] + ")"); 53 shouldThrow("gain.gain.exponentialRampToValueAtTime(1, " + startTime + ")");
50 shouldThrow("gain.gain.setTargetAtTime(1, " + timeValues[startTime] + ", 1)"); 54 shouldThrow("gain.gain.setTargetAtTime(1, " + startTime + ", 1)");
51 } 55 }
52 56
53 // Test time constant 57 // Test time constant
54 for (value in targetValues) { 58 for (value of targetValues) {
55 shouldThrow("gain.gain.setTargetAtTime(1, 1, " + targetValues[value] + ")"); 59 shouldThrow("gain.gain.setTargetAtTime(1, 1, " + value + ")");
56 } 60 }
57 61
58 // Test startTime and duration for setValueCurveAtTime 62 // Test startTime and duration for setValueCurveAtTime
59 for (startTime in timeValues) { 63 for (startTime of timeValues) {
60 shouldThrow("gain.gain.setValueCurveAtTime(curve, " + timeValues[start Time] + ", 1)"); 64 shouldThrow("gain.gain.setValueCurveAtTime(curve, " + startTime + ", 1 )");
61 shouldThrow("gain.gain.setValueCurveAtTime(curve, 1, " + timeValues[du ration] + ")");
62 } 65 }
63 66 for (duration of durationValues) {
64 shouldThrow("gain.gain.setValueCurveAtTime(curve, 1, 0)"); 67 shouldThrow("gain.gain.setValueCurveAtTime(curve, 1, " + duration + ") ");
68 }
65 69
66 finishJSTest(); 70 finishJSTest();
67 } 71 }
68 72
69 runTest(); 73 runTest();
70 successfullyParsed = true; 74 successfullyParsed = true;
71 </script> 75 </script>
72 </body> 76 </body>
73 </html> 77 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/webaudio/audioparam-exceptional-values-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698