audioworklet-suspend.https.html (1376B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title> 5 Test if activation of worklet thread does not resume context rendering. 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 const audit = Audit.createTaskRunner(); 14 const context = new AudioContext(); 15 const filePath = 'processors/dummy-processor.js'; 16 17 context.suspend(); 18 19 // Suspends the context right away and then activate worklet. The current 20 // time must not advance since the context is suspended. 21 audit.define( 22 {label: 'load-worklet-and-suspend'}, 23 async (task, should) => { 24 await context.audioWorklet.addModule(filePath); 25 const suspendTime = context.currentTime; 26 const dummy = new AudioWorkletNode(context, 'dummy'); 27 dummy.connect(context.destination); 28 return task.timeout(() => { 29 should(context.currentTime === suspendTime, 30 'context.currentTime did not change after worklet started') 31 .beTrue(); 32 should(context.state, 'context.state').beEqualTo('suspended'); 33 }, 500); 34 }); 35 36 audit.run(); 37 </script> 38 </body> 39 </html>