Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / webaudio / audioparam-exceptional-values.html
blob535faf7df76b74a2ed4f43ac810151bb3bbb90e9
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <script src="resources/compatibility.js"></script>
5 <script src="../resources/js-test.js"></script>
6 </head>
8 <body>
9 <script>
10 description("Test exceptional arguments for AudioParam timeline events");
12 var context;
13 var gain;
15 // For these values, AudioParam methods should throw an error because they are invalid; only
16 // finite values are allowed.
17 var targetValues = [Infinity, -Infinity, NaN];
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 time-like parameter.
21 var timeValues = [-1, Infinity, -Infinity, NaN];
23 // For these duration values, AudioParam methods should throw an error because they are
24 // invalid. Only finite values are allowed for any duration parameter.
25 var durationValues = [-1, Infinity, -Infinity, NaN, 0];
27 // Just an array for use by setValueCurveAtTime. The length and contents of the array are not
28 // important.
29 var curve = new Float32Array(10);
31 function runTest() {
32 if (window.testRunner) {
33 testRunner.dumpAsText();
34 testRunner.waitUntilDone();
36 window.jsTestIsAsync = true;
38 context = new AudioContext();
39 gain = context.createGain();
41 // Test the value parameter
42 for (value of targetValues) {
43 shouldThrow("gain.gain.setValueAtTime(" + value + ", 1)");
44 shouldThrow("gain.gain.linearRampToValueAtTime(" + value + ", 1)");
45 shouldThrow("gain.gain.exponentialRampToValueAtTime(" + value + ", 1)");
46 shouldThrow("gain.gain.setTargetAtTime(" + value + ", 1, 1)");
49 // Test the time parameter
50 for (startTime of timeValues) {
51 shouldThrow("gain.gain.setValueAtTime(1, " + startTime + ")");
52 shouldThrow("gain.gain.linearRampToValueAtTime(1, " + startTime + ")");
53 shouldThrow("gain.gain.exponentialRampToValueAtTime(1, " + startTime + ")");
54 shouldThrow("gain.gain.setTargetAtTime(1, " + startTime + ", 1)");
57 // Test time constant
58 for (value of targetValues) {
59 shouldThrow("gain.gain.setTargetAtTime(1, 1, " + value + ")");
62 // Test startTime and duration for setValueCurveAtTime
63 for (startTime of timeValues) {
64 shouldThrow("gain.gain.setValueCurveAtTime(curve, " + startTime + ", 1)");
66 for (duration of durationValues) {
67 shouldThrow("gain.gain.setValueCurveAtTime(curve, 1, " + duration + ")");
70 finishJSTest();
73 runTest();
74 successfullyParsed = true;
75 </script>
76 </body>
77 </html>