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

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

Issue 2750543003: Support AudioContextOptions latencyHint as double. (Closed)
Patch Set: Fix audiocontextoptions LayoutTest. 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..e2b3f99a293a860153221afaa076644cfd9f27bc 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,30 @@
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': interactiveLatency/4})", function () {
+ context = new AudioContext({'latencyHint': interactiveLatency/4});
+ }).notThrow();
+ Should("double-constructor baseLatency small", context.baseLatency).beEqualTo(defaultLatency);
+ context.close();
+
+ // Verify that exact latency in range works as expected
+ var validLatency = (interactiveLatency + playbackLatency) / 4;
+ Should("context = new AudioContext({'latencyHint': validLatency})", function () {
+ context = new AudioContext({'latencyHint': validLatency});
+ }).notThrow();
+ Should("double-constructor baseLatency inrange 1", context.baseLatency).beGreaterThanOrEqualTo(defaultLatency);
+ Should("double-constructor baseLatency inrange 2", context.baseLatency).beLessThanOrEqualTo(playbackLatency);
+ context.close();
+
+ // Verify too big exact latency clamped to 'playback'
+ Should("context = new AudioContext({'latencyHint': playbackLatency*2})", function () {
+ context = new AudioContext({'latencyHint': playbackLatency*2});
+ }).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