| 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/audio-testing.js"></script> | 5 <script src="resources/audio-testing.js"></script> |
| 5 <script src="../resources/js-test.js"></script> | 6 <script src="../resources/js-test.js"></script> |
| 6 <script src="resources/biquad-testing.js"></script> | 7 <script src="resources/biquad-testing.js"></script> |
| 7 </head> | 8 </head> |
| 8 | 9 |
| 9 <body> | 10 <body> |
| 10 | 11 |
| 11 <div id="description"></div> | 12 <div id="description"></div> |
| 12 <div id="console"></div> | 13 <div id="console"></div> |
| 13 <script> | 14 <script> |
| 14 description("Tests DOM exception messages"); | 15 description("Tests DOM exception messages"); |
| 15 | 16 |
| 16 var context; | 17 var context; |
| 17 var otherContext; | 18 var otherContext; |
| 18 var node; | 19 var node; |
| 19 var node2; | 20 var node2; |
| 20 var mode; | 21 var mode; |
| 21 | 22 |
| 22 function runTest() { | 23 function runTest() { |
| 23 if (window.testRunner) { | 24 if (window.testRunner) { |
| 24 testRunner.dumpAsText(); | 25 testRunner.dumpAsText(); |
| 25 } | 26 } |
| 26 | 27 |
| 27 context = new webkitAudioContext(); | 28 context = new AudioContext(); |
| 28 otherContext = new webkitAudioContext(); | 29 otherContext = new AudioContext(); |
| 29 | 30 |
| 30 // Test creation of various objects | 31 // Test creation of various objects |
| 31 | 32 |
| 32 // Invalid number of channels: NotSupportedError | 33 // Invalid number of channels: NotSupportedError |
| 33 shouldThrow("context.createBuffer(99, 1, context.sampleRate)"); | 34 shouldThrow("context.createBuffer(99, 1, context.sampleRate)"); |
| 34 // Invalid sample rate: NotSupportedError | 35 // Invalid sample rate: NotSupportedError |
| 35 shouldThrow("context.createBuffer(1, 1, 1)"); | 36 shouldThrow("context.createBuffer(1, 1, 1)"); |
| 36 shouldThrow("context.createBuffer(1, 1, 1e6)"); | 37 shouldThrow("context.createBuffer(1, 1, 1e6)"); |
| 37 // Invalid number of frames: NotSupportedError | 38 // Invalid number of frames: NotSupportedError |
| 38 shouldThrow("context.createBuffer(1, 0, context.sampleRate)"); | 39 shouldThrow("context.createBuffer(1, 0, context.sampleRate)"); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 shouldThrow("node.channelCountMode = mode"); | 102 shouldThrow("node.channelCountMode = mode"); |
| 102 shouldThrow("node.channelInterpretation = mode"); | 103 shouldThrow("node.channelInterpretation = mode"); |
| 103 | 104 |
| 104 // Destination: IndexSizeError | 105 // Destination: IndexSizeError |
| 105 shouldThrow("context.destination.channelCount = 99"); | 106 shouldThrow("context.destination.channelCount = 99"); |
| 106 | 107 |
| 107 // Delay nodes are tested elsewhere, so don't duplicate that work here. | 108 // Delay nodes are tested elsewhere, so don't duplicate that work here. |
| 108 | 109 |
| 109 // OfflineAudioContext | 110 // OfflineAudioContext |
| 110 // Invalid number of channels (unspecified error) | 111 // Invalid number of channels (unspecified error) |
| 111 shouldThrow("new webkitOfflineAudioContext(99, 100, context.sampleRate)"); | 112 shouldThrow("new OfflineAudioContext(99, 100, context.sampleRate)"); |
| 112 // Invalid sample rate. (unspecified error) | 113 // Invalid sample rate. (unspecified error) |
| 113 shouldThrow("new webkitOfflineAudioContext(1, 100, 1)"); | 114 shouldThrow("new OfflineAudioContext(1, 100, 1)"); |
| 114 shouldThrow("new webkitOfflineAudioContext(1, 100, 1e6)"); | 115 shouldThrow("new OfflineAudioContext(1, 100, 1e6)"); |
| 115 // Invalid frame length (crbug.com/351277) | 116 // Invalid frame length (crbug.com/351277) |
| 116 shouldThrow("new webkitOfflineAudioContext(1, -88200000000000, 44100)"); | 117 shouldThrow("new OfflineAudioContext(1, -88200000000000, 44100)"); |
| 117 | 118 |
| 118 // WaveShaper types | 119 // WaveShaper types |
| 119 node = context.createWaveShaper(); | 120 node = context.createWaveShaper(); |
| 120 shouldThrow("node.oversample = '9x'"); | 121 shouldThrow("node.oversample = '9x'"); |
| 121 | 122 |
| 122 // Start/stop for AudioBufferSourceNodes | 123 // Start/stop for AudioBufferSourceNodes |
| 123 buffer = context.createBuffer(1,1, context.sampleRate); | 124 buffer = context.createBuffer(1,1, context.sampleRate); |
| 124 shouldNotThrow("source = context.createBufferSource()"); | 125 shouldNotThrow("source = context.createBufferSource()"); |
| 125 shouldNotThrow("source.buffer = buffer"); | 126 shouldNotThrow("source.buffer = buffer"); |
| 126 shouldNotThrow("source.start()"); | 127 shouldNotThrow("source.start()"); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 163 |
| 163 // exponentialRampToValue should throw on non-positive target values. | 164 // exponentialRampToValue should throw on non-positive target values. |
| 164 node = context.createGain(); | 165 node = context.createGain(); |
| 165 node.connect(context.destination); | 166 node.connect(context.destination); |
| 166 shouldThrow("node.gain.exponentialRampToValueAtTime(-1, 0.1)"); | 167 shouldThrow("node.gain.exponentialRampToValueAtTime(-1, 0.1)"); |
| 167 shouldThrow("node.gain.exponentialRampToValueAtTime(0, 0.1)"); | 168 shouldThrow("node.gain.exponentialRampToValueAtTime(0, 0.1)"); |
| 168 | 169 |
| 169 // Convolver buffer rate must match context rate. Create on offline context
so we | 170 // Convolver buffer rate must match context rate. Create on offline context
so we |
| 170 // specify the context rate exactly, in case the test is run on platforms wi
th different | 171 // specify the context rate exactly, in case the test is run on platforms wi
th different |
| 171 // HW sample rates. | 172 // HW sample rates. |
| 172 shouldNotThrow("oc = new webkitOfflineAudioContext(1, 44100, 44100)"); | 173 shouldNotThrow("oc = new OfflineAudioContext(1, 44100, 44100)"); |
| 173 shouldNotThrow("conv = oc.createConvolver()"); | 174 shouldNotThrow("conv = oc.createConvolver()"); |
| 174 shouldThrow("conv.buffer = oc.createBuffer(1, 100, 22050)"); | 175 shouldThrow("conv.buffer = oc.createBuffer(1, 100, 22050)"); |
| 175 } | 176 } |
| 176 | 177 |
| 177 runTest(); | 178 runTest(); |
| 178 successfullyParsed = true; | 179 successfullyParsed = true; |
| 179 | 180 |
| 180 </script> | 181 </script> |
| 181 </body> | 182 </body> |
| 182 </html> | 183 </html> |
| OLD | NEW |