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..a377d1a31eedf9f8385d2a10065a0f8da8043ac1 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(); |
Raymond Toy
2017/04/06 17:31:59
Are we running out of online contexts without this
Andrew MacPherson
2017/04/07 06:59:03
Yes that's the reason for this. I've split the tes
|
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,34 @@ |
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; |
Raymond Toy
2017/04/06 17:32:00
Why divide by 4? Don't you want to divide by 2 so
Andrew MacPherson
2017/04/07 06:59:03
Currently AudioContext.baseLatency is returning th
|
+ Should("context = new AudioContext({'latencyHint': validLatency})", function () { |
+ context = new AudioContext({'latencyHint': validLatency}); |
+ }).notThrow(); |
+ Should("double-constructor baseLatency inrange 1", context.baseLatency).beGreaterThanOrEqualTo(defaultLatency); |
Raymond Toy
2017/04/06 17:32:00
defaultLatency or interactiveLatency?
Andrew MacPherson
2017/04/07 06:59:03
Done.
|
+ Should("double-constructor baseLatency inrange 2", context.baseLatency).beLessThanOrEqualTo(playbackLatency); |
+ context.close(); |
+ |
+ // Verify too big exact latency clamped to some value |
+ var context1; |
+ var context2; |
+ Should("creating two high latency contexts", function () { |
+ context1 = new AudioContext({'latencyHint': playbackLatency*2}); |
+ context2 = new AudioContext({'latencyHint': playbackLatency*20}); |
+ }).notThrow(); |
+ Should("high latency context baseLatency", context1.baseLatency).beEqualTo(context2.baseLatency); |
+ context1.close(); |
+ context2.close(); |
// Verify that invalid latencyHint values are rejected. |
Should("context = new AudioContext({'latencyHint': 'foo'})", function () { |