Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Unified Diff: third_party/WebKit/LayoutTests/webaudio/audiocontextoptions.html

Issue 2501863003: Support for AudioContextOptions latencyHint. (Closed)
Patch Set: Check all LatencyHints WebAudioDeviceImpl test. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/webaudio/audiocontextoptions.html
diff --git a/third_party/WebKit/LayoutTests/webaudio/audiocontextoptions.html b/third_party/WebKit/LayoutTests/webaudio/audiocontextoptions.html
new file mode 100644
index 0000000000000000000000000000000000000000..94c20cba86635c386fa70535fa5fdb7837b91711
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/webaudio/audiocontextoptions.html
@@ -0,0 +1,70 @@
+<!doctype html>
+<html>
+<head>
+ <title>Test AudioContextOptions</title>
+ <script src="../resources/testharness.js"></script>
+ <script src="../resources/testharnessreport.js"></script>
+ <script src="resources/audio-testing.js"></script>
+</head>
+
+<body>
+ <script>
+ var context;
+ var audit = Audit.createTaskRunner();
+
+ // Task: test AudioContextOptions (1).
+ audit.defineTask('test-audiocontextoptions-1', function (done) {
+
+ // Verify that an AudioContext can be created with default options.
+ Should("context = new AudioContext()", function () {
+ context = new AudioContext();
+ }).notThrow();
+
+ var defaultLatency = context.baseLatency;
+ Should("default baseLatency", defaultLatency).beGreaterThan(0);
+
+ // Verify that any double can be passed and that it results in interactive latency
+ Should("context = new AudioContext({'latencyHint': 0.05})", function () {
+ context = new AudioContext({'latencyHint': 0.05});
+ }).notThrow();
+ Should("double-constructor baseLatency", context.baseLatency).beEqualTo(defaultLatency);
+
+ // Verify that an AudioContext can be created with the expected latency types.
+ Should("context = new AudioContext({'latencyHint': 'interactive'})", function () {
+ context = new AudioContext({'latencyHint': 'interactive'});
+ }).notThrow();
+
+ var interactiveLatency = context.baseLatency;
+ Should("interactive baseLatency", interactiveLatency).beEqualTo(defaultLatency);
+
+ Should("context = new AudioContext({'latencyHint': 'balanced'})", function () {
+ context = new AudioContext({'latencyHint': 'balanced'});
+ }).notThrow();
+
+ var balancedLatency = context.baseLatency;
+ Should("balanced baseLatency", balancedLatency).beGreaterThanOrEqualTo(interactiveLatency);
+
+ Should("context = new AudioContext({'latencyHint': 'playback'})", function () {
+ context = new AudioContext({'latencyHint': 'playback'});
+ }).notThrow();
+
+ var playbackLatency = context.baseLatency;
+ Should("playback baseLatency", playbackLatency).beGreaterThanOrEqualTo(balancedLatency);
+
+ // Verify that invalid latencyHint values are rejected.
+ Should("context = new AudioContext({'latencyHint': 'foo'})", function () {
+ context = new AudioContext({'latencyHint': 'foo'});
+ }).throw();
Raymond Toy 2016/12/08 17:14:38 Include the type of error thrown in "throw()".
Andrew MacPherson 2016/12/09 12:34:14 Done.
+
+ // Verify that no extra options can be passed into the AudioContextOptions.
+ Should("context = new AudioContext('latencyHint')", function () {
+ context = new AudioContext('latencyHint');
+ }).throw();
Raymond Toy 2016/12/08 17:14:38 Include the type of error thrown.
Andrew MacPherson 2016/12/09 12:34:14 Done.
+
+ done();
+ });
+
+ audit.runTasks();
+ </script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698