Index: third_party/WebKit/ManualTests/webaudio/audiooutputtimestamp.html |
diff --git a/third_party/WebKit/ManualTests/webaudio/audiooutputtimestamp.html b/third_party/WebKit/ManualTests/webaudio/audiooutputtimestamp.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ae26ec35c2cd71cabd3b0b97fd91a22d5eec0a18 |
--- /dev/null |
+++ b/third_party/WebKit/ManualTests/webaudio/audiooutputtimestamp.html |
@@ -0,0 +1,73 @@ |
+<!doctype html> |
+<html> |
+ <head> |
+ <title>Test AudioContext.getOutputTimestamp() method</title> |
+ <style type="text/css"> |
+ body { |
+ margin: 2em; |
+ } |
+ .manual-test-ui { |
+ font-family: Arial; |
+ padding: 1em; |
+ border: 1px solid #999; |
+ } |
+ .manual-test-ui button { |
+ padding: 1em; |
+ font-size: 1em; |
+ } |
+ .manual-test-ui div { |
+ padding: 10px; |
+ font-size: 1.5em; |
+ } |
+ </style> |
+ </head> |
+ |
+ <body> |
+ <h1>Test AudioContext.getOutputTimestamp() method</h1> |
+ |
+ <p>Tests the values returned from AudioContext.getOutputTimestamp()</p> |
+ |
+ <p>Press "Start" to run the test. You should hear a sine tone.</p> |
+ |
+ <p>Press "Refresh" to fetch the fresh output audio timestamp values |
+ and compare them to 'AudioContext.currentTime' and 'Performance.now()'. </p> |
+ |
+ <p><b>Note: </b> The "AudioTimestamp" Runtime Enabled Feature must be enabled: |
+ i.e. use '--enable-blink-features=AudioTimestamp' in command-line switches for |
+ chrome/content_shell.</p> |
+ |
+ <div class="manual-test-ui"> |
+ <div id="audioTime"></div> |
+ <div id="performanceTime"></div> |
+ <div id="timestampContextTime"></div> |
+ <div id="timestampPerformanceTime"></div> |
+ |
+ <button id="startButton" onclick="start()">Start</button> |
+ <button id="valuesButton" onclick="refreshValues()">Refresh Values</button> |
+ <button onclick="context.suspend()">Suspend</button> |
+ <button onclick="context.resume()">Resume</button> |
+ </div> |
+ |
+ <script type="text/javascript"> |
+ var context = new AudioContext(); |
+ |
+ refreshValues(); |
+ |
+ function start() { |
+ document.querySelector('#startButton').disabled = true; |
+ let oscillator = context.createOscillator(); |
+ oscillator.connect(context.destination); |
+ oscillator.start(); |
+ } |
+ |
+ function refreshValues() { |
+ document.querySelector("#audioTime").innerHTML = "context.currentTime: " + context.currentTime; |
+ document.querySelector("#performanceTime").innerHTML = "performance.now(): " + performance.now(); |
+ |
+ let timestamp = context.getOutputTimestamp(); |
+ document.querySelector("#timestampContextTime").innerHTML = "timestamp audio: " + timestamp.contextTime; |
+ document.querySelector("#timestampPerformanceTime").innerHTML = "timestamp performance: " + timestamp.performanceTime; |
+ } |
+ </script> |
+ </body> |
+</html> |