test_currentTime.html (838B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>Test AudioContext.currentTime</title> 5 <script src="/tests/SimpleTest/SimpleTest.js"></script> 6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 7 </head> 8 <body> 9 <pre id="test"> 10 <script class="testbody" type="text/javascript"> 11 12 SimpleTest.waitForExplicitFinish(); 13 SimpleTest.requestFlakyTimeout("This test needs to wait a while for the AudioContext's timer to start."); 14 addLoadEvent(function() { 15 var ac = new AudioContext(); 16 is(ac.currentTime, 0, "AudioContext.currentTime should be 0 initially"); 17 ac.onstatechange = function () { 18 ok(ac.state == "running", "AudioContext.currentTime should eventually start"); 19 ok(ac.currentTime > 0, "AudioContext.currentTime should have increased by now"); 20 SimpleTest.finish(); 21 } 22 }); 23 24 </script> 25 </pre> 26 </body> 27 </html>