blob: 6d2f4daa3c1a7569c1add2b012c082db1a8cb1f4 [file] [log] [blame] [edit]
<DOCTYPE html>
<html>
<body>
<script src="../resources/js-test.js"></script>
<script>
description("Validate the value returned by AudioContext.getOutputTimestamp()");
jsTestIsAsync = true;
const audioContext = new AudioContext();
const gainNode = new GainNode(audioContext, { gain: 0.01 });
const oscillatorNode = new OscillatorNode(audioContext);
oscillatorNode.connect(gainNode).connect(audioContext.destination);
oscillatorNode.start();
handle = setInterval(() => {
if (audioContext.currentTime < 0.100)
return;
clearInterval(handle);
contextTime = audioContext.getOutputTimestamp().contextTime;
shouldBeTrue("contextTime > 0.090");
shouldBeTrue("contextTime <= audioContext.currentTime");
finishJSTest();
}, 10);
</script>
</body>
</html>