convolver-setBuffer-already-has-value.html (1450B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title> 5 convolver-setBuffer-already-has-value.html 6 </title> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 <script src="/webaudio/resources/audit.js"></script> 10 </head> 11 <body> 12 <script id="layout-test-code"> 13 let audit = Audit.createTaskRunner(); 14 15 audit.define('test', (task, should) => { 16 let context = new AudioContext(); 17 let audioBuffer = new AudioBuffer( 18 {numberOfChannels: 1, length: 1, sampleRate: context.sampleRate}); 19 let convolver = context.createConvolver(); 20 should(() => { 21 convolver.buffer = null; 22 }, 'Set buffer to null before set non-null').notThrow(); 23 24 should(() => { 25 convolver.buffer = audioBuffer; 26 }, 'Set buffer first normally').notThrow(); 27 28 should(() => { 29 convolver.buffer = audioBuffer; 30 }, 'Set buffer a second time').notThrow(); 31 32 should(() => { 33 convolver.buffer = null; 34 }, 'Set buffer to null').notThrow(); 35 36 should(() => { 37 convolver.buffer = null; 38 }, 'Set buffer to null again, to make sure').notThrow(); 39 40 should(() => { 41 convolver.buffer = audioBuffer; 42 }, 'Set buffer to non-null to verify it is set') 43 .notThrow(); 44 45 task.done(); 46 }); 47 48 audit.run(); 49 </script> 50 </body> 51 </html>