OLD | NEW |
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 | 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. | 24 // invalid. Only finite values are allowed for any duration parameter. |
25 var durationValues = [-1, Infinity, -Infinity, NaN, 0]; | 25 var durationValues = [-1, Infinity, -Infinity, NaN, 0]; |
26 | 26 |
| 27 // For these timeConstant values for setTargetAtTime an error must be thro
wn because they are |
| 28 // invalid. |
| 29 var timeConstantValues = [-1, 0, Infinity, -Infinity, NaN]; |
| 30 |
27 // Just an array for use by setValueCurveAtTime. The length and contents o
f the array are not | 31 // Just an array for use by setValueCurveAtTime. The length and contents o
f the array are not |
28 // important. | 32 // important. |
29 var curve = new Float32Array(10); | 33 var curve = new Float32Array(10); |
30 | 34 |
31 function runTest() { | 35 function runTest() { |
32 if (window.testRunner) { | 36 if (window.testRunner) { |
33 testRunner.dumpAsText(); | 37 testRunner.dumpAsText(); |
34 testRunner.waitUntilDone(); | 38 testRunner.waitUntilDone(); |
35 } | 39 } |
36 window.jsTestIsAsync = true; | 40 window.jsTestIsAsync = true; |
(...skipping 11 matching lines...) Expand all Loading... |
48 | 52 |
49 // Test the time parameter | 53 // Test the time parameter |
50 for (startTime of timeValues) { | 54 for (startTime of timeValues) { |
51 shouldThrow("gain.gain.setValueAtTime(1, " + startTime + ")"); | 55 shouldThrow("gain.gain.setValueAtTime(1, " + startTime + ")"); |
52 shouldThrow("gain.gain.linearRampToValueAtTime(1, " + startTime + ")")
; | 56 shouldThrow("gain.gain.linearRampToValueAtTime(1, " + startTime + ")")
; |
53 shouldThrow("gain.gain.exponentialRampToValueAtTime(1, " + startTime +
")"); | 57 shouldThrow("gain.gain.exponentialRampToValueAtTime(1, " + startTime +
")"); |
54 shouldThrow("gain.gain.setTargetAtTime(1, " + startTime + ", 1)"); | 58 shouldThrow("gain.gain.setTargetAtTime(1, " + startTime + ", 1)"); |
55 } | 59 } |
56 | 60 |
57 // Test time constant | 61 // Test time constant |
58 for (value of targetValues) { | 62 for (value of timeConstantValues) { |
59 shouldThrow("gain.gain.setTargetAtTime(1, 1, " + value + ")"); | 63 shouldThrow("gain.gain.setTargetAtTime(1, 1, " + value + ")"); |
60 } | 64 } |
61 | 65 |
62 // Test startTime and duration for setValueCurveAtTime | 66 // Test startTime and duration for setValueCurveAtTime |
63 for (startTime of timeValues) { | 67 for (startTime of timeValues) { |
64 shouldThrow("gain.gain.setValueCurveAtTime(curve, " + startTime + ", 1
)"); | 68 shouldThrow("gain.gain.setValueCurveAtTime(curve, " + startTime + ", 1
)"); |
65 } | 69 } |
66 for (duration of durationValues) { | 70 for (duration of durationValues) { |
67 shouldThrow("gain.gain.setValueCurveAtTime(curve, 1, " + duration + ")
"); | 71 shouldThrow("gain.gain.setValueCurveAtTime(curve, 1, " + duration + ")
"); |
68 } | 72 } |
69 | 73 |
70 finishJSTest(); | 74 finishJSTest(); |
71 } | 75 } |
72 | 76 |
73 runTest(); | 77 runTest(); |
74 successfullyParsed = true; | 78 successfullyParsed = true; |
75 </script> | 79 </script> |
76 </body> | 80 </body> |
77 </html> | 81 </html> |
OLD | NEW |