[email protected] | 2da6ffa | 2013-10-01 00:31:35 | [diff] [blame] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
[email protected] | f846f5a | 2014-03-25 17:33:11 | [diff] [blame] | 4 | <script src="resources/compatibility.js"></script> |
[email protected] | 2da6ffa | 2013-10-01 00:31:35 | [diff] [blame] | 5 | <script src="resources/audio-testing.js"></script> |
[email protected] | efb08634 | 2013-11-05 00:56:21 | [diff] [blame] | 6 | <script src="../resources/js-test.js"></script> |
[email protected] | 2da6ffa | 2013-10-01 00:31:35 | [diff] [blame] | 7 | <script src="resources/biquad-testing.js"></script> |
| 8 | </head> |
| 9 | |
| 10 | <body> |
| 11 | |
| 12 | <div id="description"></div> |
| 13 | <div id="console"></div> |
| 14 | <script> |
| 15 | description("Tests DOM exception messages"); |
| 16 | |
| 17 | var context; |
| 18 | var otherContext; |
| 19 | var node; |
| 20 | var node2; |
| 21 | var mode; |
[email protected] | 1d4178a | 2014-09-26 21:37:44 | [diff] [blame] | 22 | var panner; |
[email protected] | 7baad898 | 2014-09-29 22:11:48 | [diff] [blame] | 23 | var script; |
[email protected] | 2da6ffa | 2013-10-01 00:31:35 | [diff] [blame] | 24 | |
[email protected] | c026bfd2 | 2015-01-16 00:24:26 | [diff] [blame] | 25 | function shouldThrowAndBeUnchanged(attr, value) { |
| 26 | shouldThrow(attr + " = " + value); |
| 27 | shouldNotBe(attr, value); |
| 28 | } |
| 29 | |
[email protected] | 2da6ffa | 2013-10-01 00:31:35 | [diff] [blame] | 30 | function runTest() { |
| 31 | if (window.testRunner) { |
| 32 | testRunner.dumpAsText(); |
| 33 | } |
[email protected] | b702bbb | 2014-12-05 04:53:16 | [diff] [blame] | 34 | |
[email protected] | f846f5a | 2014-03-25 17:33:11 | [diff] [blame] | 35 | context = new AudioContext(); |
| 36 | otherContext = new AudioContext(); |
[email protected] | 2da6ffa | 2013-10-01 00:31:35 | [diff] [blame] | 37 | |
[email protected] | 154cd08 | 2013-10-04 19:40:08 | [diff] [blame] | 38 | // Test creation of various objects |
[email protected] | 2da6ffa | 2013-10-01 00:31:35 | [diff] [blame] | 39 | |
[email protected] | 154cd08 | 2013-10-04 19:40:08 | [diff] [blame] | 40 | // Invalid number of channels: NotSupportedError |
[email protected] | 2da6ffa | 2013-10-01 00:31:35 | [diff] [blame] | 41 | shouldThrow("context.createBuffer(99, 1, context.sampleRate)"); |
[email protected] | ace011c | 2014-05-08 22:10:03 | [diff] [blame] | 42 | shouldThrow("context.createBuffer(0, 1, context.sampleRate)"); |
[email protected] | 154cd08 | 2013-10-04 19:40:08 | [diff] [blame] | 43 | // Invalid sample rate: NotSupportedError |
[email protected] | 2da6ffa | 2013-10-01 00:31:35 | [diff] [blame] | 44 | shouldThrow("context.createBuffer(1, 1, 1)"); |
| 45 | shouldThrow("context.createBuffer(1, 1, 1e6)"); |
[email protected] | c867899 | 2014-03-25 23:51:18 | [diff] [blame] | 46 | // Check valid values from crbug.com/344375 |
| 47 | shouldNotThrow("context.createBuffer(1, 1, 3000)"); |
| 48 | shouldNotThrow("context.createBuffer(1, 1, 192000)"); |
[email protected] | 154cd08 | 2013-10-04 19:40:08 | [diff] [blame] | 49 | // Invalid number of frames: NotSupportedError |
| 50 | shouldThrow("context.createBuffer(1, 0, context.sampleRate)"); |
[email protected] | c5f32c5a8 | 2014-04-14 18:19:12 | [diff] [blame] | 51 | // 2-arg createBuffer not allowed. |
[email protected] | 2da6ffa | 2013-10-01 00:31:35 | [diff] [blame] | 52 | shouldThrow("context.createBuffer(new ArrayBuffer(100), true)"); |
[email protected] | 154cd08 | 2013-10-04 19:40:08 | [diff] [blame] | 53 | // Invalid ArrayBuffer (unspecified error) |
[email protected] | 2da6ffa | 2013-10-01 00:31:35 | [diff] [blame] | 54 | shouldThrow("context.decodeAudioData(null, function() {}, function () {})"); |
[email protected] | 154cd08 | 2013-10-04 19:40:08 | [diff] [blame] | 55 | // Invalid sources (unspecified error) |
[email protected] | 2da6ffa | 2013-10-01 00:31:35 | [diff] [blame] | 56 | shouldThrow("context.createMediaElementSource(null)"); |
| 57 | shouldThrow("context.createMediaStreamSource(null)"); |
[email protected] | 154cd08 | 2013-10-04 19:40:08 | [diff] [blame] | 58 | // Invalid buffer size: IndexSizeError |
[email protected] | 2da6ffa | 2013-10-01 00:31:35 | [diff] [blame] | 59 | shouldThrow("context.createScriptProcessor(1, 1, 1)"); |
[email protected] | 154cd08 | 2013-10-04 19:40:08 | [diff] [blame] | 60 | // Invalid number of inputs and outputs: IndexSizeError |
[email protected] | 2da6ffa | 2013-10-01 00:31:35 | [diff] [blame] | 61 | shouldThrow("context.createScriptProcessor(4096, 100, 1)"); |
| 62 | shouldThrow("context.createScriptProcessor(4096, 1, 100)"); |
[email protected] | ad2e0e3 | 2013-10-04 05:16:20 | [diff] [blame] | 63 | shouldNotThrow("context.createScriptProcessor()"); |
| 64 | shouldNotThrow("context.createScriptProcessor(0)"); |
| 65 | |
[email protected] | 154cd08 | 2013-10-04 19:40:08 | [diff] [blame] | 66 | // Invalid number of channels: IndexSizeError |
[email protected] | 2da6ffa | 2013-10-01 00:31:35 | [diff] [blame] | 67 | shouldThrow("context.createChannelSplitter(0)"); |
| 68 | shouldThrow("context.createChannelSplitter(99)"); |
| 69 | shouldThrow("context.createChannelMerger(0)"); |
| 70 | shouldThrow("context.createChannelMerger(99)"); |
[email protected] | 154cd08 | 2013-10-04 19:40:08 | [diff] [blame] | 71 | // Invalid real/imag arrays: IndexSizeError |
[email protected] | 2da6ffa | 2013-10-01 00:31:35 | [diff] [blame] | 72 | shouldThrow("context.createPeriodicWave(null, null)"); |
| 73 | shouldThrow("context.createPeriodicWave(new Float32Array(10), null)"); |
[email protected] | 154cd08 | 2013-10-04 19:40:08 | [diff] [blame] | 74 | shouldThrow("context.createPeriodicWave(new Float32Array(4100), new Float32Array(4100))"); |
| 75 | // Real and imaginary arrays must have the same size: IndexSizeError |
[email protected] | 2da6ffa | 2013-10-01 00:31:35 | [diff] [blame] | 76 | shouldThrow("context.createPeriodicWave(new Float32Array(10), new Float32Array(7))"); |
[email protected] | b702bbb | 2014-12-05 04:53:16 | [diff] [blame] | 77 | |
[email protected] | 2da6ffa | 2013-10-01 00:31:35 | [diff] [blame] | 78 | |
| 79 | // Analysers |
| 80 | node = context.createAnalyser(); |
[email protected] | 154cd08 | 2013-10-04 19:40:08 | [diff] [blame] | 81 | // Invalid fftSize: IndexSizeError |
[email protected] | c026bfd2 | 2015-01-16 00:24:26 | [diff] [blame] | 82 | shouldThrowAndBeUnchanged("node.fftSize", "42"); |
| 83 | shouldThrowAndBeUnchanged("node.fftSize", "16"); |
[email protected] | 9a535ba | 2015-01-13 20:56:19 | [diff] [blame] | 84 | shouldNotThrow("node.fftSize = 32768"); |
[email protected] | c026bfd2 | 2015-01-16 00:24:26 | [diff] [blame] | 85 | shouldThrowAndBeUnchanged("node.fftSize", "65536"); |
[email protected] | 2da6ffa | 2013-10-01 00:31:35 | [diff] [blame] | 86 | |
[email protected] | c026bfd2 | 2015-01-16 00:24:26 | [diff] [blame] | 87 | shouldThrowAndBeUnchanged("node.minDecibels", "-10"); |
| 88 | shouldThrowAndBeUnchanged("node.maxDecibels", "-150"); |
| 89 | shouldThrowAndBeUnchanged("node.minDecibels", "-30"); |
| 90 | shouldThrowAndBeUnchanged("node.maxDecibels", "-100"); |
| 91 | |
| 92 | shouldThrowAndBeUnchanged("node.smoothingTimeConstant", "-0.1"); |
| 93 | shouldThrowAndBeUnchanged("node.smoothingTimeConstant", "1.5"); |
[email protected] | db30267b | 2013-10-03 18:43:26 | [diff] [blame] | 94 | |
[email protected] | 2da6ffa | 2013-10-01 00:31:35 | [diff] [blame] | 95 | // AudioBuffers |
| 96 | node = context.createBuffer(1,1, context.sampleRate); |
[email protected] | 154cd08 | 2013-10-04 19:40:08 | [diff] [blame] | 97 | // Invalid channel index: IndexSizeError |
[email protected] | 2da6ffa | 2013-10-01 00:31:35 | [diff] [blame] | 98 | shouldThrow("node.getChannelData(2)"); |
| 99 | |
| 100 | // AudioNode connections |
| 101 | node = context.createGain(); |
| 102 | node2 = context.createGain(); |
[email protected] | 154cd08 | 2013-10-04 19:40:08 | [diff] [blame] | 103 | // Invalid destination node (unspecified error) |
[email protected] | 2da6ffa | 2013-10-01 00:31:35 | [diff] [blame] | 104 | shouldThrow("node.connect(null, 0, 0)"); |
[email protected] | 154cd08 | 2013-10-04 19:40:08 | [diff] [blame] | 105 | // Invalid input or output index: IndexSizeError |
[email protected] | 2da6ffa | 2013-10-01 00:31:35 | [diff] [blame] | 106 | shouldThrow("node.connect(context.destination, 100, 0)"); |
| 107 | shouldThrow("node.connect(context.destination, 0, 100)"); |
| 108 | shouldThrow("node.connect(node2.gain, 100)"); |
| 109 | shouldThrow("node.disconnect(99)"); |
[email protected] | 154cd08 | 2013-10-04 19:40:08 | [diff] [blame] | 110 | // Can't connect to a different context (unspecified error) |
[email protected] | 2da6ffa | 2013-10-01 00:31:35 | [diff] [blame] | 111 | shouldThrow("node.connect(otherContext.destination)"); |
| 112 | |
[email protected] | 154cd08 | 2013-10-04 19:40:08 | [diff] [blame] | 113 | // Invalid channel count: NotSupportedError |
[email protected] | c026bfd2 | 2015-01-16 00:24:26 | [diff] [blame] | 114 | shouldThrowAndBeUnchanged("node.channelCount", "99"); |
[email protected] | 154cd08 | 2013-10-04 19:40:08 | [diff] [blame] | 115 | // Invalid mode or interpretation (unspecified error) |
[email protected] | e152e8ed | 2014-05-14 16:20:33 | [diff] [blame] | 116 | currentMode = node.channelCountMode; |
| 117 | currentInterpretation = node.channelInterpretation; |
| 118 | shouldNotThrow("node.channelCountMode = 'fancy'"); |
| 119 | if (node.channelCountMode == currentMode) |
| 120 | testPassed("Invalid channelCountMode value did not change mode"); |
| 121 | else |
[email protected] | b702bbb | 2014-12-05 04:53:16 | [diff] [blame] | 122 | testFailed("node.channelCountMode incorrectly changed to invalid value " + node.channelCountMode); |
[email protected] | e152e8ed | 2014-05-14 16:20:33 | [diff] [blame] | 123 | shouldNotThrow("node.channelInterpretation = mode"); |
| 124 | if (node.channelInterpretation == currentInterpretation) |
| 125 | testPassed("Invalid channelInterpration value did not change mode"); |
| 126 | else |
[email protected] | b702bbb | 2014-12-05 04:53:16 | [diff] [blame] | 127 | testFailed("node.channelInterpretation incorrectly changed to invalid value " + node.channelInterpreation); |
[email protected] | 2da6ffa | 2013-10-01 00:31:35 | [diff] [blame] | 128 | |
[email protected] | b702bbb | 2014-12-05 04:53:16 | [diff] [blame] | 129 | // Destination node channel count: should throw IndexSizeError on invalid |
| 130 | // channel count. shouldNotThrow() method cannot be used because the error |
| 131 | // message includes the number of channels, which can change depending on |
| 132 | // the actual attached hardware. |
| 133 | try { |
| 134 | eval("context.destination.channelCount = 99"); |
| 135 | } catch (e) { |
| 136 | if (e.message === "Failed to set the 'channelCount' property on 'AudioNode': The channel count provided (99) is outside the range [1, " + context.destination.maxChannelCount + "]." && e.name === "IndexSizeError") |
| 137 | testPassed("context.destination.channelCount = 99 threw IndexSizeError exception on invalid channel count."); |
| 138 | else |
| 139 | testFailed("context.destination.channelCount = 99 should throw IndexSizeError exception on invalid channel count."); |
| 140 | } |
[email protected] | 2da6ffa | 2013-10-01 00:31:35 | [diff] [blame] | 141 | |
| 142 | // Delay nodes are tested elsewhere, so don't duplicate that work here. |
| 143 | |
| 144 | // OfflineAudioContext |
[email protected] | 84126a36 | 2014-04-14 16:55:48 | [diff] [blame] | 145 | // Max supported channels |
| 146 | shouldNotThrow("new OfflineAudioContext(32, 100, context.sampleRate)"); |
[email protected] | 154cd08 | 2013-10-04 19:40:08 | [diff] [blame] | 147 | // Invalid number of channels (unspecified error) |
[email protected] | f846f5a | 2014-03-25 17:33:11 | [diff] [blame] | 148 | shouldThrow("new OfflineAudioContext(99, 100, context.sampleRate)"); |
[email protected] | 154cd08 | 2013-10-04 19:40:08 | [diff] [blame] | 149 | // Invalid sample rate. (unspecified error) |
[email protected] | f846f5a | 2014-03-25 17:33:11 | [diff] [blame] | 150 | shouldThrow("new OfflineAudioContext(1, 100, 1)"); |
| 151 | shouldThrow("new OfflineAudioContext(1, 100, 1e6)"); |
[email protected] | a9b939e | 2014-03-12 18:34:27 | [diff] [blame] | 152 | // Invalid frame length (crbug.com/351277) |
[email protected] | f846f5a | 2014-03-25 17:33:11 | [diff] [blame] | 153 | shouldThrow("new OfflineAudioContext(1, -88200000000000, 44100)"); |
[email protected] | 2da6ffa | 2013-10-01 00:31:35 | [diff] [blame] | 154 | |
[email protected] | 4e10d03 | 2013-10-02 21:48:00 | [diff] [blame] | 155 | // WaveShaper types |
| 156 | node = context.createWaveShaper(); |
[email protected] | e152e8ed | 2014-05-14 16:20:33 | [diff] [blame] | 157 | currentOversample = node.oversample; |
| 158 | shouldNotThrow("node.oversample = '9x'"); |
| 159 | if (node.oversample == currentOversample) |
| 160 | testPassed("Invalid oversample value did not change node.oversample"); |
| 161 | else |
| 162 | testFailed("node.oversample incorrectly changed to invalid value " + node.oversample); |
[email protected] | 837dc8c | 2015-01-13 18:00:30 | [diff] [blame] | 163 | shouldThrow("node.curve = new Float32Array(1)"); |
[email protected] | c026bfd2 | 2015-01-16 00:24:26 | [diff] [blame] | 164 | shouldBeNull("node.curve"); |
[email protected] | 837dc8c | 2015-01-13 18:00:30 | [diff] [blame] | 165 | shouldNotThrow("node.curve = new Float32Array(2)"); |
[email protected] | 6eec933d | 2015-01-21 20:55:00 | [diff] [blame^] | 166 | shouldNotThrow("node.curve = null"); |
[email protected] | ffd785f | 2013-10-29 17:19:58 | [diff] [blame] | 167 | |
| 168 | // Start/stop for AudioBufferSourceNodes |
| 169 | buffer = context.createBuffer(1,1, context.sampleRate); |
| 170 | shouldNotThrow("source = context.createBufferSource()"); |
[email protected] | eed4fa20 | 2013-10-31 02:13:29 | [diff] [blame] | 171 | shouldNotThrow("source.buffer = buffer"); |
[email protected] | 288a06a | 2014-09-26 03:53:55 | [diff] [blame] | 172 | shouldThrow("source.start(-1)"); |
| 173 | shouldThrow("source.start(Infinity)"); |
| 174 | shouldThrow("source.start(-Infinity)"); |
| 175 | shouldThrow("source.start(NaN)"); |
| 176 | shouldThrow("source.start(1, Infinity)"); |
| 177 | shouldThrow("source.start(1, -Infinity)"); |
| 178 | shouldThrow("source.start(1, NaN)"); |
| 179 | shouldThrow("source.start(1, -1)"); |
| 180 | shouldThrow("source.start(1, 1, Infinity)"); |
| 181 | shouldThrow("source.start(1, 1, -Infinity)"); |
| 182 | shouldThrow("source.start(1, 1, NaN)"); |
| 183 | shouldThrow("source.start(1, 1, -1)"); |
[email protected] | eed4fa20 | 2013-10-31 02:13:29 | [diff] [blame] | 184 | shouldNotThrow("source.start()"); |
[email protected] | 288a06a | 2014-09-26 03:53:55 | [diff] [blame] | 185 | shouldThrow("source.stop(-1)"); |
| 186 | shouldThrow("source.stop(Infinity)"); |
| 187 | shouldThrow("source.stop(-Infinity)"); |
| 188 | shouldThrow("source.stop(NaN)"); |
[email protected] | eed4fa20 | 2013-10-31 02:13:29 | [diff] [blame] | 189 | shouldNotThrow("source.stop()"); |
| 190 | |
[email protected] | 20b3e833 | 2013-11-01 00:14:05 | [diff] [blame] | 191 | // It's not clear from the spec, but I think it's valid to call start(). The spec is silent on |
| 192 | // what happens if we call stop() afterwards, so don't call it. |
[email protected] | eed4fa20 | 2013-10-31 02:13:29 | [diff] [blame] | 193 | shouldNotThrow("source = context.createBufferSource()"); |
[email protected] | ffd785f | 2013-10-29 17:19:58 | [diff] [blame] | 194 | shouldNotThrow("source.start()"); |
[email protected] | ffd785f | 2013-10-29 17:19:58 | [diff] [blame] | 195 | |
[email protected] | 20b3e833 | 2013-11-01 00:14:05 | [diff] [blame] | 196 | buffer = context.createBuffer(1,1, context.sampleRate); |
| 197 | shouldNotThrow("source = context.createBufferSource()"); |
| 198 | shouldNotThrow("source.buffer = buffer"); |
| 199 | shouldThrow("source.stop()"); |
| 200 | |
| 201 | buffer = context.createBuffer(1,1, context.sampleRate); |
| 202 | shouldNotThrow("source = context.createBufferSource()"); |
| 203 | shouldNotThrow("source.buffer = buffer"); |
| 204 | shouldNotThrow("source.start()"); |
| 205 | shouldThrow("source.start()"); |
| 206 | |
| 207 | buffer = context.createBuffer(1,1, context.sampleRate); |
| 208 | shouldNotThrow("source = context.createBufferSource()"); |
| 209 | shouldNotThrow("source.buffer = buffer"); |
| 210 | shouldNotThrow("source.start()"); |
| 211 | shouldNotThrow("source.stop()"); |
[email protected] | 20b3e833 | 2013-11-01 00:14:05 | [diff] [blame] | 212 | |
[email protected] | b702bbb | 2014-12-05 04:53:16 | [diff] [blame] | 213 | |
[email protected] | ffd785f | 2013-10-29 17:19:58 | [diff] [blame] | 214 | // Start/stop for OscillatorNodes |
| 215 | shouldNotThrow("source = context.createOscillator()"); |
[email protected] | 288a06a | 2014-09-26 03:53:55 | [diff] [blame] | 216 | shouldThrow("source.start(-1)"); |
| 217 | shouldThrow("source.start(Infinity)"); |
| 218 | shouldThrow("source.start(-Infinity)"); |
| 219 | shouldThrow("source.start(NaN)"); |
[email protected] | ffd785f | 2013-10-29 17:19:58 | [diff] [blame] | 220 | shouldNotThrow("source.start()"); |
[email protected] | 288a06a | 2014-09-26 03:53:55 | [diff] [blame] | 221 | shouldThrow("source.stop(-1)"); |
| 222 | shouldThrow("source.stop(Infinity)"); |
| 223 | shouldThrow("source.stop(-Infinity)"); |
| 224 | shouldThrow("source.stop(NaN)"); |
[email protected] | ffd785f | 2013-10-29 17:19:58 | [diff] [blame] | 225 | shouldNotThrow("source.stop()"); |
[email protected] | 20b3e833 | 2013-11-01 00:14:05 | [diff] [blame] | 226 | |
| 227 | shouldNotThrow("osc = context.createOscillator()"); |
| 228 | shouldThrow("osc.stop()"); |
| 229 | shouldNotThrow("osc1 = context.createOscillator()"); |
| 230 | shouldNotThrow("osc1.start()"); |
| 231 | shouldNotThrow("osc1.stop()"); |
[email protected] | 5ab469f | 2014-02-12 05:59:26 | [diff] [blame] | 232 | |
| 233 | // exponentialRampToValue should throw on non-positive target values. |
| 234 | node = context.createGain(); |
| 235 | node.connect(context.destination); |
| 236 | shouldThrow("node.gain.exponentialRampToValueAtTime(-1, 0.1)"); |
| 237 | shouldThrow("node.gain.exponentialRampToValueAtTime(0, 0.1)"); |
[email protected] | 77459e3 | 2014-03-19 00:04:10 | [diff] [blame] | 238 | |
| 239 | // Convolver buffer rate must match context rate. Create on offline context so we |
| 240 | // specify the context rate exactly, in case the test is run on platforms with different |
| 241 | // HW sample rates. |
[email protected] | f846f5a | 2014-03-25 17:33:11 | [diff] [blame] | 242 | shouldNotThrow("oc = new OfflineAudioContext(1, 44100, 44100)"); |
[email protected] | 77459e3 | 2014-03-19 00:04:10 | [diff] [blame] | 243 | shouldNotThrow("conv = oc.createConvolver()"); |
| 244 | shouldThrow("conv.buffer = oc.createBuffer(1, 100, 22050)"); |
[email protected] | 1d4178a | 2014-09-26 21:37:44 | [diff] [blame] | 245 | |
| 246 | // PannerNode channel count and mode |
| 247 | panner = context.createPanner(); |
| 248 | // Channel count can only be set to 1 or 2. |
| 249 | shouldNotThrow("panner.channelCount = 1"); |
| 250 | shouldNotThrow("panner.channelCount = 2"); |
[email protected] | c026bfd2 | 2015-01-16 00:24:26 | [diff] [blame] | 251 | shouldThrowAndBeUnchanged("panner.channelCount", "0"); |
| 252 | shouldThrowAndBeUnchanged("panner.channelCount", "3"); |
[email protected] | 1d4178a | 2014-09-26 21:37:44 | [diff] [blame] | 253 | // It is illegal to set the mode to 'max' |
[email protected] | c026bfd2 | 2015-01-16 00:24:26 | [diff] [blame] | 254 | shouldThrowAndBeUnchanged("panner.channelCountMode", "'max'"); |
[email protected] | 1d4178a | 2014-09-26 21:37:44 | [diff] [blame] | 255 | shouldNotThrow("panner.channelCountMode = 'explicit'"); |
| 256 | shouldNotThrow("panner.channelCountMode = 'clamped-max'"); |
| 257 | shouldNotThrow("panner.channelCountMode = 'junk'"); |
[email protected] | 7baad898 | 2014-09-29 22:11:48 | [diff] [blame] | 258 | |
| 259 | // Test channel count and mode for a ScriptProcessor. |
| 260 | shouldNotThrow("script = context.createScriptProcessor(256, 3)"); |
| 261 | // Make sure the channelCount and mode are set correctly. |
| 262 | shouldBeEqualToNumber("script.channelCount", 3); |
| 263 | shouldBeEqualToString("script.channelCountMode", "explicit"); |
| 264 | // Cannot change the channelCount or mode to anything else |
| 265 | shouldNotThrow("script.channelCount = 3"); |
[email protected] | c026bfd2 | 2015-01-16 00:24:26 | [diff] [blame] | 266 | shouldThrowAndBeUnchanged("script.channelCount", "1"); |
| 267 | |
| 268 | shouldThrowAndBeUnchanged("script.channelCount", "7"); |
[email protected] | 7baad898 | 2014-09-29 22:11:48 | [diff] [blame] | 269 | shouldNotThrow("script.channelCountMode = 'explicit'"); |
[email protected] | c026bfd2 | 2015-01-16 00:24:26 | [diff] [blame] | 270 | shouldThrowAndBeUnchanged("script.channelCountMode", "'max'"); |
| 271 | shouldThrowAndBeUnchanged("script.channelCountMode", "'clamped-max'"); |
[email protected] | 7baad898 | 2014-09-29 22:11:48 | [diff] [blame] | 272 | shouldNotThrow("script.channelCountMode = 'junk'"); |
[email protected] | 7cc3e78 | 2014-11-10 22:37:54 | [diff] [blame] | 273 | |
| 274 | // noteOn and noteOff don't exist anymore |
| 275 | shouldBeUndefined("osc.noteOn"); |
| 276 | shouldBeUndefined("osc.noteOff"); |
| 277 | shouldBeUndefined("source.noteOn"); |
| 278 | shouldBeUndefined("source.noteOff"); |
[email protected] | 2da6ffa | 2013-10-01 00:31:35 | [diff] [blame] | 279 | } |
| 280 | |
| 281 | runTest(); |
| 282 | successfullyParsed = true; |
| 283 | |
[email protected] | b702bbb | 2014-12-05 04:53:16 | [diff] [blame] | 284 | </script> |
[email protected] | 2da6ffa | 2013-10-01 00:31:35 | [diff] [blame] | 285 | </body> |
| 286 | </html> |