test_import_with_cache.html (915B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>Test for Worklet</title> 5 <script src="/tests/SimpleTest/SimpleTest.js"></script> 6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 7 <script type="application/javascript" src="common.js"></script> 8 </head> 9 <body> 10 11 <script type="application/javascript"> 12 // This function is called into an iframe. 13 function runTestInIframe() { 14 var audioContext = new AudioContext(); 15 function loading() { 16 audioContext.audioWorklet.addModule("server_import_with_cache.sjs") 17 .then(() => { 18 ok(true, "Import should load a resource."); 19 }, () => { 20 ok(false, "Import should load a resource."); 21 }) 22 .then(() => { 23 done(); 24 }); 25 } 26 27 var count = 0; 28 const MAX = 10; 29 30 function done() { 31 if (++count == MAX) { 32 SimpleTest.finish(); 33 } 34 } 35 36 for (var i = 0; i < MAX; ++i) { 37 loading(); 38 } 39 } 40 </script> 41 </body> 42 </html>