OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../resources/testharness.js"></script> | 4 <title> |
5 <script src="../../resources/testharnessreport.js"></script> | 5 scriptprocessornode-zero-input-channels.html |
6 <script src="../resources/audit-util.js"></script> | 6 </title> |
7 <script src="../resources/audit.js"></script> | 7 <script src="../../resources/testharness.js"></script> |
8 </head> | 8 <script src="../../resources/testharnessreport.js"></script> |
| 9 <script src="../resources/audit-util.js"></script> |
| 10 <script src="../resources/audit.js"></script> |
| 11 </head> |
| 12 <body> |
| 13 <script id="layout-test-code"> |
| 14 let audit = Audit.createTaskRunner(); |
9 | 15 |
10 <body> | 16 let sampleRate = 44100.0; |
11 <script> | 17 let renderLengthInFrames = 512; |
12 let audit = Audit.createTaskRunner(); | 18 let bufferSize = 512; |
13 | 19 |
14 let sampleRate = 44100.0; | 20 audit.define( |
15 let renderLengthInFrames = 512; | 21 { |
16 let bufferSize = 512; | 22 label: 'test', |
| 23 description: |
| 24 'Tests that ScriptProcessorNode accepts 0 input channels' |
| 25 }, |
| 26 (task, should) => { |
| 27 let context = |
| 28 new OfflineAudioContext(1, renderLengthInFrames, sampleRate); |
17 | 29 |
18 audit.define( | 30 let node; |
19 { | |
20 label: 'test', | |
21 description: 'Tests that ScriptProcessorNode accepts 0 input channels' | |
22 }, | |
23 (task, should) => { | |
24 let context = | |
25 new OfflineAudioContext(1, renderLengthInFrames, sampleRate); | |
26 | 31 |
27 let node; | 32 should( |
| 33 () => { |
| 34 node = context.createScriptProcessor(bufferSize, 0, 1); |
| 35 }, |
| 36 'node = context.createScriptProcessor(bufferSize, 0, 1)') |
| 37 .notThrow(); |
| 38 let source = context.createBufferSource(); |
| 39 source.buffer = createImpulseBuffer(context, bufferSize); |
28 | 40 |
29 should(() => { | 41 // The onaudioprocess function doesn't need to do anything. We just |
30 node = context.createScriptProcessor(bufferSize, 0, 1); | 42 // need the process to start to test that implementation accepts 0 |
31 }, 'node = context.createScriptProcessor(bufferSize, 0, 1)').notThrow(); | 43 // input channels. |
32 let source = context.createBufferSource(); | 44 // |
33 source.buffer = createImpulseBuffer(context, bufferSize); | 45 // FIXME: check the .inputBuffer attribute of the |
| 46 // AudioProcessingEvent. |
| 47 node.onaudioprocess = function(e) {}; |
| 48 source.connect(node); |
| 49 node.connect(context.destination); |
| 50 source.start(0); |
34 | 51 |
35 // The onaudioprocess function doesn't need to do anything. We just need | 52 context.oncomplete = event => { |
36 // the process to start to test that implementation accepts 0 input | 53 should(true, 'ScriptProcessorNode accepts 0 input channels') |
37 // channels. | 54 .beTrue(); |
38 // | 55 task.done(); |
39 // FIXME: check the .inputBuffer attribute of the AudioProcessingEvent. | 56 }; |
40 node.onaudioprocess = function(e) {}; | |
41 source.connect(node); | |
42 node.connect(context.destination); | |
43 source.start(0); | |
44 | 57 |
45 context.oncomplete = event => { | 58 context.startRendering(); |
46 should(true, 'ScriptProcessorNode accepts 0 input channels').beTrue(); | 59 }); |
47 task.done(); | |
48 }; | |
49 | 60 |
50 context.startRendering(); | 61 audit.run(); |
51 }); | 62 </script> |
52 | 63 </body> |
53 audit.run(); | |
54 </script> | |
55 | |
56 </body> | |
57 </html> | 64 </html> |
OLD | NEW |