| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 | 2 |
| 3 <html> | 3 <html> |
| 4 <head> | 4 <head> |
| 5 <script src="../resources/js-test.js"></script> | 5 <script src="../resources/js-test.js"></script> |
| 6 <script type="text/javascript" src="resources/audio-testing.js"></script> | 6 <script type="text/javascript" src="resources/audio-testing.js"></script> |
| 7 </head> | 7 </head> |
| 8 | 8 |
| 9 <body> | 9 <body> |
| 10 <div id="description"></div> | 10 <div id="description"></div> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 testRunner.waitUntilDone(); | 22 testRunner.waitUntilDone(); |
| 23 } | 23 } |
| 24 | 24 |
| 25 window.jsTestIsAsync = true; | 25 window.jsTestIsAsync = true; |
| 26 | 26 |
| 27 context = new webkitAudioContext(); | 27 context = new webkitAudioContext(); |
| 28 source = context.createBufferSource(); | 28 source = context.createBufferSource(); |
| 29 | 29 |
| 30 // Make sure we can't set to something which isn't an AudioBuffer. | 30 // Make sure we can't set to something which isn't an AudioBuffer. |
| 31 shouldThrow("source.buffer = 57", '"TypeError: Failed to set the \'buffer\'
property on \'AudioBufferSourceNode\': The provided value is not of type \'Audio
Buffer\'."'); | 31 shouldThrow("source.buffer = 57", '"TypeError: Failed to set the \'buffer\'
property on \'AudioBufferSourceNode\': The provided value is not of type \'Audio
Buffer\'."'); |
| 32 shouldThrow("source.buffer = null", '"TypeError: Failed to set the \'buffer\
' property on \'AudioBufferSourceNode\': buffer cannot be null"'); | |
| 33 | 32 |
| 34 // Check that mono buffer can be set. | 33 // Check that mono buffer can be set. |
| 35 try { | 34 try { |
| 35 var nullableBuffer = null; |
| 36 source.buffer = nullableBuffer; |
| 37 if (source.buffer.numberOfChannels == 1) |
| 38 testPassed("Nullable buffer can be set."); |
| 39 else |
| 40 testFailed("Nullable buffer must be mono."); |
| 41 } catch(e) { |
| 42 testFailed("Nullable buffer can not be set."); |
| 43 } |
| 44 |
| 45 // Check that mono buffer can be set. |
| 46 try { |
| 36 var monoBuffer = context.createBuffer(1, 1024, context.sampleRate); | 47 var monoBuffer = context.createBuffer(1, 1024, context.sampleRate); |
| 37 source.buffer = monoBuffer; | 48 source.buffer = monoBuffer; |
| 38 testPassed("Mono buffer can be set."); | 49 testPassed("Mono buffer can be set."); |
| 39 } catch(e) { | 50 } catch(e) { |
| 40 testFailed("Mono buffer can not be set."); | 51 testFailed("Mono buffer can not be set."); |
| 41 } | 52 } |
| 42 | 53 |
| 43 // Check that stereo buffer can be set. | 54 // Check that stereo buffer can be set. |
| 44 try { | 55 try { |
| 45 var stereoBuffer = context.createBuffer(2, 1024, context.sampleRate); | 56 var stereoBuffer = context.createBuffer(2, 1024, context.sampleRate); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 64 | 75 |
| 65 finishJSTest(); | 76 finishJSTest(); |
| 66 } | 77 } |
| 67 | 78 |
| 68 runTest(); | 79 runTest(); |
| 69 | 80 |
| 70 </script> | 81 </script> |
| 71 | 82 |
| 72 </body> | 83 </body> |
| 73 </html> | 84 </html> |
| OLD | NEW |