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 () { |