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

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

Issue 2750543003: Support AudioContextOptions latencyHint as double. (Closed)
Patch Set: Created 3 years, 9 months 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
index fe5e714bec6aa3949121c1b519bbaaa3264209ae..5cd732f93485c87a977116f7719aca6b37e06cf6 100644
--- a/third_party/WebKit/LayoutTests/webaudio/audiocontextoptions.html
+++ b/third_party/WebKit/LayoutTests/webaudio/audiocontextoptions.html
@@ -23,12 +23,6 @@
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'});
@@ -36,6 +30,7 @@
var interactiveLatency = context.baseLatency;
Should("interactive baseLatency", interactiveLatency).beEqualTo(defaultLatency);
+ context.close();
Should("context = new AudioContext({'latencyHint': 'balanced'})", function () {
context = new AudioContext({'latencyHint': 'balanced'});
@@ -43,6 +38,7 @@
var balancedLatency = context.baseLatency;
Should("balanced baseLatency", balancedLatency).beGreaterThanOrEqualTo(interactiveLatency);
+ context.close();
Should("context = new AudioContext({'latencyHint': 'playback'})", function () {
context = new AudioContext({'latencyHint': 'playback'});
@@ -50,6 +46,28 @@
var playbackLatency = context.baseLatency;
Should("playback baseLatency", playbackLatency).beGreaterThanOrEqualTo(balancedLatency);
+ context.close();
+
+ // Verify too small exact latency clamped to 'interactive'
+ Should("context = new AudioContext({'latencyHint': 0.000001})", function () {
+ context = new AudioContext({'latencyHint': 0.000001});
+ }).notThrow();
+ Should("double-constructor baseLatency small", context.baseLatency).beEqualTo(defaultLatency);
+ context.close();
+
+ // Verify that exact latency in range works as expected
+ Should("context = new AudioContext({'latencyHint': 0.01})", function () {
+ context = new AudioContext({'latencyHint': 0.01});
+ }).notThrow();
+ Should("double-constructor baseLatency ok", context.baseLatency).beEqualTo(0.02);
Raymond Toy 2017/03/14 15:19:39 Doesn't this really depend on the actual sampleRat
Andrew MacPherson 2017/03/15 15:08:17 Hmm, I think I may not understand where the values
+ context.close();
+
+ // Verify too big exact latency clamped to 'playback'
+ Should("context = new AudioContext({'latencyHint': 5})", function () {
Raymond Toy 2017/03/14 15:19:39 Nit: I think it would be slightly better to comput
Andrew MacPherson 2017/03/15 15:08:18 Done!
+ context = new AudioContext({'latencyHint': 5});
+ }).notThrow();
+ Should("double-constructor baseLatency big", context.baseLatency).beEqualTo(playbackLatency);
+ context.close();
// Verify that invalid latencyHint values are rejected.
Should("context = new AudioContext({'latencyHint': 'foo'})", function () {

Powered by Google App Engine
This is Rietveld 408576698