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 <script src="resources/compatibility.js"></script> |
7 </head> | 8 </head> |
8 | 9 |
9 <body> | 10 <body> |
10 <div id="description"></div> | 11 <div id="description"></div> |
11 <div id="console"></div> | 12 <div id="console"></div> |
12 | 13 |
13 <script> | 14 <script> |
14 description("Tests that AudioBufferSourceNode validates AudioBuffer in .buffer a
ttribute setter."); | 15 description("Tests that AudioBufferSourceNode validates AudioBuffer in .buffer a
ttribute setter."); |
15 | 16 |
16 var context; | 17 var context; |
17 var source; | 18 var source; |
18 | 19 |
19 function runTest() { | 20 function runTest() { |
20 if (window.testRunner) { | 21 if (window.testRunner) { |
21 testRunner.dumpAsText(); | 22 testRunner.dumpAsText(); |
22 testRunner.waitUntilDone(); | 23 testRunner.waitUntilDone(); |
23 } | 24 } |
24 | 25 |
25 window.jsTestIsAsync = true; | 26 window.jsTestIsAsync = true; |
26 | 27 |
27 context = new webkitAudioContext(); | 28 context = new AudioContext(); |
28 source = context.createBufferSource(); | 29 source = context.createBufferSource(); |
29 | 30 |
30 // Make sure we can't set to something which isn't an AudioBuffer. | 31 // 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\'."'); | 32 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 shouldThrow("source.buffer = null", '"TypeError: Failed to set the \'buffer\
' property on \'AudioBufferSourceNode\': buffer cannot be null"'); |
33 | 34 |
34 // Check that mono buffer can be set. | 35 // Check that mono buffer can be set. |
35 try { | 36 try { |
36 var monoBuffer = context.createBuffer(1, 1024, context.sampleRate); | 37 var monoBuffer = context.createBuffer(1, 1024, context.sampleRate); |
37 source.buffer = monoBuffer; | 38 source.buffer = monoBuffer; |
(...skipping 26 matching lines...) Expand all Loading... |
64 | 65 |
65 finishJSTest(); | 66 finishJSTest(); |
66 } | 67 } |
67 | 68 |
68 runTest(); | 69 runTest(); |
69 | 70 |
70 </script> | 71 </script> |
71 | 72 |
72 </body> | 73 </body> |
73 </html> | 74 </html> |
OLD | NEW |