| 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/testharness.js"></script> | 4 <script src="../../resources/testharness.js"></script> |
| 5 <script src="../../resources/testharnessreport.js"></script> | 5 <script src="../../resources/testharnessreport.js"></script> |
| 6 <script src="../resources/audit-util.js"></script> | 6 <script src="../resources/audit-util.js"></script> |
| 7 <script src="../resources/audit.js"></script> | 7 <script src="../resources/audit.js"></script> |
| 8 </head> | 8 </head> |
| 9 | 9 |
| 10 <body> | 10 <body> |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 // For these timeConstant values for setTargetAtTime an error must be | 30 // For these timeConstant values for setTargetAtTime an error must be |
| 31 // thrown because they are | 31 // thrown because they are |
| 32 // invalid. | 32 // invalid. |
| 33 let timeConstantValues = [-1, Infinity, -Infinity, NaN]; | 33 let timeConstantValues = [-1, Infinity, -Infinity, NaN]; |
| 34 | 34 |
| 35 // Just an array for use by setValueCurveAtTime. The length and contents | 35 // Just an array for use by setValueCurveAtTime. The length and contents |
| 36 // of the array are not | 36 // of the array are not |
| 37 // important. | 37 // important. |
| 38 let curve = new Float32Array(10); | 38 let curve = new Float32Array(10); |
| 39 | 39 |
| 40 audit.define('test', function(task, should) { | 40 audit.define( |
| 41 task.describe( | 41 { |
| 42 'Test exceptional arguments for AudioParam timeline events'); | 42 label: 'test', |
| 43 let context = new AudioContext(); | 43 description: |
| 44 let gain = context.createGain(); | 44 'Test exceptional arguments for AudioParam timeline events' |
| 45 }, |
| 46 function(task, should) { |
| 47 let context = new AudioContext(); |
| 48 let gain = context.createGain(); |
| 45 | 49 |
| 46 // Test the value parameter | 50 // Test the value parameter |
| 47 for (value of targetValues) { | 51 for (value of targetValues) { |
| 48 let testMethods = [ | 52 let testMethods = [ |
| 49 {name: 'setValueAtTime', arg: [value, 1]}, | 53 {name: 'setValueAtTime', arg: [value, 1]}, |
| 50 {name: 'linearRampToValueAtTime', arg: [value, 1]}, | 54 {name: 'linearRampToValueAtTime', arg: [value, 1]}, |
| 51 {name: 'exponentialRampToValueAtTime', arg: [value, 1]}, | 55 {name: 'exponentialRampToValueAtTime', arg: [value, 1]}, |
| 52 {name: 'setTargetAtTime', arg: [value, 1, 1]} | 56 {name: 'setTargetAtTime', arg: [value, 1, 1]} |
| 53 ]; | 57 ]; |
| 54 | 58 |
| 55 for (method of testMethods) { | 59 for (method of testMethods) { |
| 56 let message = 'gain.gain.' + method.name + '(' + method.arg + ')'; | 60 let message = |
| 57 should( | 61 'gain.gain.' + method.name + '(' + method.arg + ')'; |
| 58 () => gain.gain[method.name].apply(gain.gain, method.arg), | 62 should( |
| 59 message) | 63 () => gain.gain[method.name].apply(gain.gain, method.arg), |
| 60 .throw(); | 64 message) |
| 61 } | 65 .throw(); |
| 62 } | 66 } |
| 67 } |
| 63 | 68 |
| 64 // Test the time parameter | 69 // Test the time parameter |
| 65 for (startTime of timeValues) { | 70 for (startTime of timeValues) { |
| 66 let testMethods = [ | 71 let testMethods = [ |
| 67 {name: 'setValueAtTime', arg: [1, startTime]}, | 72 {name: 'setValueAtTime', arg: [1, startTime]}, |
| 68 {name: 'linearRampToValueAtTime', arg: [1, startTime]}, | 73 {name: 'linearRampToValueAtTime', arg: [1, startTime]}, |
| 69 {name: 'exponentialRampToValueAtTime', arg: [1, startTime]}, | 74 {name: 'exponentialRampToValueAtTime', arg: [1, startTime]}, |
| 70 {name: 'setTargetAtTime', arg: [1, startTime, 1]} | 75 {name: 'setTargetAtTime', arg: [1, startTime, 1]} |
| 71 ]; | 76 ]; |
| 72 | 77 |
| 73 for (method of testMethods) { | 78 for (method of testMethods) { |
| 74 let message = 'gain.gain.' + method.name + '(' + method.arg + ')'; | 79 let message = |
| 75 should( | 80 'gain.gain.' + method.name + '(' + method.arg + ')'; |
| 76 () => gain.gain[method.name].apply(gain.gain, method.arg), | 81 should( |
| 77 message) | 82 () => gain.gain[method.name].apply(gain.gain, method.arg), |
| 78 .throw(); | 83 message) |
| 79 } | 84 .throw(); |
| 80 } | 85 } |
| 86 } |
| 81 | 87 |
| 82 // Test time constant | 88 // Test time constant |
| 83 for (value of timeConstantValues) { | 89 for (value of timeConstantValues) { |
| 84 should( | 90 should( |
| 85 () => gain.gain.setTargetAtTime(1, 1, value), | 91 () => gain.gain.setTargetAtTime(1, 1, value), |
| 86 'gain.gain.setTargetAtTime(1, 1, ' + value + ')') | 92 'gain.gain.setTargetAtTime(1, 1, ' + value + ')') |
| 87 .throw(); | 93 .throw(); |
| 88 } | 94 } |
| 89 | 95 |
| 90 // Test startTime and duration for setValueCurveAtTime | 96 // Test startTime and duration for setValueCurveAtTime |
| 91 for (startTime of timeValues) { | 97 for (startTime of timeValues) { |
| 92 should( | 98 should( |
| 93 () => gain.gain.setValueCurveAtTime(curve, startTime, 1), | 99 () => gain.gain.setValueCurveAtTime(curve, startTime, 1), |
| 94 'gain.gain.setValueCurveAtTime(curve, ' + startTime + ', 1)') | 100 'gain.gain.setValueCurveAtTime(curve, ' + startTime + ', 1)') |
| 95 .throw(); | 101 .throw(); |
| 96 } | 102 } |
| 97 for (duration of durationValues) { | 103 for (duration of durationValues) { |
| 98 should( | 104 should( |
| 99 () => gain.gain.setValueCurveAtTime(curve, 1, duration), | 105 () => gain.gain.setValueCurveAtTime(curve, 1, duration), |
| 100 'gain.gain.setValueCurveAtTime(curve, 1, ' + duration + ')') | 106 'gain.gain.setValueCurveAtTime(curve, 1, ' + duration + ')') |
| 101 .throw(); | 107 .throw(); |
| 102 } | 108 } |
| 103 | 109 |
| 104 task.done(); | 110 task.done(); |
| 105 }); | 111 }); |
| 106 | 112 |
| 107 audit.run(); | 113 audit.run(); |
| 108 </script> | 114 </script> |
| 109 </body> | 115 </body> |
| 110 </html> | 116 </html> |
| OLD | NEW |