OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| 2 <html> |
| 3 <head> |
| 4 <link rel="stylesheet" href="../fast/js/resources/js-test-style.css"/> |
| 5 <script src="resources/audio-testing.js"></script> |
| 6 <script src="../fast/js/resources/js-test-pre.js"></script> |
| 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; |
| 22 |
| 23 function runTest() { |
| 24 if (window.testRunner) { |
| 25 testRunner.dumpAsText(); |
| 26 } |
| 27 |
| 28 context = new webkitAudioContext(); |
| 29 otherContext = new webkitAudioContext(); |
| 30 |
| 31 // Test createion of various objects |
| 32 |
| 33 // Invalid number of channels |
| 34 shouldThrow("context.createBuffer(99, 1, context.sampleRate)"); |
| 35 // Invalid sample rate |
| 36 shouldThrow("context.createBuffer(1, 1, 1)"); |
| 37 shouldThrow("context.createBuffer(1, 1, 1e6)"); |
| 38 // Invalid ArrayBuffer |
| 39 shouldThrow("context.createBuffer(new ArrayBuffer(100), true)"); |
| 40 // Invalid ArrayBuffer |
| 41 shouldThrow("context.decodeAudioData(null, function() {}, function () {})"); |
| 42 // Invalid sources |
| 43 shouldThrow("context.createMediaElementSource(null)"); |
| 44 shouldThrow("context.createMediaStreamSource(null)"); |
| 45 // Invalid buffer size |
| 46 shouldThrow("context.createScriptProcessor(1, 1, 1)"); |
| 47 // Invalid number of inputs and outputs |
| 48 shouldThrow("context.createScriptProcessor(4096, 100, 1)"); |
| 49 shouldThrow("context.createScriptProcessor(4096, 1, 100)"); |
| 50 // Invalid number of channels |
| 51 shouldThrow("context.createChannelSplitter(0)"); |
| 52 shouldThrow("context.createChannelSplitter(99)"); |
| 53 shouldThrow("context.createChannelMerger(0)"); |
| 54 shouldThrow("context.createChannelMerger(99)"); |
| 55 // Invalid real/imag arrays |
| 56 shouldThrow("context.createPeriodicWave(null, null)"); |
| 57 shouldThrow("context.createPeriodicWave(new Float32Array(10), null)"); |
| 58 // Real and imaginary arrays must have the same size |
| 59 shouldThrow("context.createPeriodicWave(new Float32Array(10), new Float32Arr
ay(7))"); |
| 60 |
| 61 // Analysers |
| 62 node = context.createAnalyser(); |
| 63 // Invalid fftSize |
| 64 shouldThrow("node.fftSize = 42"); |
| 65 |
| 66 // AudioBuffers |
| 67 node = context.createBuffer(1,1, context.sampleRate); |
| 68 // Invalid channel index |
| 69 shouldThrow("node.getChannelData(2)"); |
| 70 |
| 71 // AudioNode connections |
| 72 node = context.createGain(); |
| 73 node2 = context.createGain(); |
| 74 // Invalid destination node |
| 75 shouldThrow("node.connect(null, 0, 0)"); |
| 76 // Invalid input or output index |
| 77 shouldThrow("node.connect(context.destination, 100, 0)"); |
| 78 shouldThrow("node.connect(context.destination, 0, 100)"); |
| 79 shouldThrow("node.connect(node2.gain, 100)"); |
| 80 shouldThrow("node.disconnect(99)"); |
| 81 // Can't connect to a different context |
| 82 shouldThrow("node.connect(otherContext.destination)"); |
| 83 |
| 84 // Invalid channel count |
| 85 shouldThrow("node.channelCount = 99"); |
| 86 // Invalid mode or interpretation |
| 87 mode = "fancy"; |
| 88 shouldThrow("node.channelCountMode = mode"); |
| 89 shouldThrow("node.channelInterpretation = mode"); |
| 90 |
| 91 // Destination |
| 92 shouldThrow("context.destination.channelCount = 99"); |
| 93 |
| 94 // Delay nodes are tested elsewhere, so don't duplicate that work here. |
| 95 |
| 96 // OfflineAudioContext |
| 97 // Invalid number of channels |
| 98 shouldThrow("new webkitOfflineAudioContext(99, 100, context.sampleRate)"); |
| 99 // Invalid sample rate. |
| 100 shouldThrow("new webkitOfflineAudioContext(1, 100, 1)"); |
| 101 shouldThrow("new webkitOfflineAudioContext(1, 100, 1e6)"); |
| 102 |
| 103 } |
| 104 |
| 105 runTest(); |
| 106 successfullyParsed = true; |
| 107 |
| 108 </script> |
| 109 <script src="../fast/js/resources/js-test-post.js"></script> |
| 110 </body> |
| 111 </html> |
OLD | NEW |