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

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

Issue 2895963003: Apply layout-test-tidy to LayoutTests/webaudio (Closed)
Patch Set: Created 3 years, 7 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/AudioContext/audiocontextoptions.html
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioContext/audiocontextoptions.html b/third_party/WebKit/LayoutTests/webaudio/AudioContext/audiocontextoptions.html
index 24e279834daf95d506564564215a8019cca906d4..492beee76c2f21405f9d0c1c584a82105a7424bf 100644
--- a/third_party/WebKit/LayoutTests/webaudio/AudioContext/audiocontextoptions.html
+++ b/third_party/WebKit/LayoutTests/webaudio/AudioContext/audiocontextoptions.html
@@ -1,139 +1,157 @@
-<!doctype html>
+<!DOCTYPE html>
<html>
-<head>
- <title>Test AudioContextOptions</title>
- <script src="../../resources/testharness.js"></script>
- <script src="../../resources/testharnessreport.js"></script>
- <script src="../resources/audit.js"></script>
-</head>
-
-<body>
- <script>
- let context;
- let defaultLatency;
- let interactiveLatency;
- let balancedLatency;
- let playbackLatency;
-
- let audit = Audit.createTaskRunner();
-
- audit.define(
- {
- label : "test-audiocontextoptions-latencyHint-basic",
- description : "Test creating contexts with basic latencyHint types."
- },
- function(task, should) {
- let closingPromises = [];
-
- // Verify that an AudioContext can be created with default options.
- should(function(){context = new AudioContext()},
- "context = new AudioContext()")
- .notThrow();
-
- defaultLatency = context.baseLatency;
- should(defaultLatency, "default baseLatency").beGreaterThan(0);
-
- // Verify that an AudioContext can be created with the expected
- // latency types.
- should(function(){context = new AudioContext(
- {'latencyHint' : 'interactive'})},
- "context = new AudioContext({'latencyHint': 'interactive'})")
- .notThrow();
-
- interactiveLatency = context.baseLatency;
- should(interactiveLatency, "interactive baseLatency")
- .beEqualTo(defaultLatency);
- closingPromises.push(context.close());
-
- should(function(){context =
- new AudioContext({'latencyHint' : 'balanced'})},
- "context = new AudioContext({'latencyHint': 'balanced'})")
- .notThrow();
-
- balancedLatency = context.baseLatency;
- should(balancedLatency, "balanced baseLatency")
- .beGreaterThanOrEqualTo(interactiveLatency);
- closingPromises.push(context.close());
-
- should(function(){context =
- new AudioContext({'latencyHint' : 'playback'})},
- "context = new AudioContext({'latencyHint': 'playback'})")
- .notThrow();
-
- playbackLatency = context.baseLatency;
- should(playbackLatency, "playback baseLatency")
- .beGreaterThanOrEqualTo(balancedLatency);
- closingPromises.push(context.close());
-
- Promise.all(closingPromises).then(function() { task.done(); });
- });
-
- audit.define(
- {
- label : "test-audiocontextoptions-latencyHint-double",
- description :
- "Test creating contexts with explicit latencyHint values."
- },
- function(task, should) {
- var closingPromises = [];
-
- // Verify too small exact latency clamped to 'interactive'
- should(function(){context = new AudioContext(
- {'latencyHint' : interactiveLatency / 2})},
- "context = new AudioContext({'latencyHint': " +
- "interactiveLatency/2})")
- .notThrow();
- should(context.baseLatency, "double-constructor baseLatency small")
- .beEqualTo(interactiveLatency);
- closingPromises.push(context.close());
-
- // Verify that exact latency in range works as expected
- var validLatency = (interactiveLatency + playbackLatency) / 2;
- should(function(){context = new AudioContext(
- {'latencyHint' : validLatency})},
- "context = new AudioContext({'latencyHint': validLatency})")
- .notThrow();
- should(context.baseLatency,
- "double-constructor baseLatency inrange 1")
- .beGreaterThanOrEqualTo(interactiveLatency);
- should(context.baseLatency,
- "double-constructor baseLatency inrange 2")
- .beLessThanOrEqualTo(playbackLatency);
- closingPromises.push(context.close());
-
- // Verify too big exact latency clamped to some value
- var context1;
- var context2;
- should(
- function() {
- context1 =
- new AudioContext({'latencyHint' : playbackLatency * 10});
- context2 =
- new AudioContext({'latencyHint' : playbackLatency * 20});
- },
- "creating two high latency contexts")
- .notThrow();
- should(context1.baseLatency, "high latency context baseLatency")
- .beEqualTo(context2.baseLatency);
- closingPromises.push(context1.close());
- closingPromises.push(context2.close());
-
- // Verify that invalid latencyHint values are rejected.
- should(
- function(){context = new AudioContext({'latencyHint' : 'foo'})},
- "context = new AudioContext({'latencyHint': 'foo'})")
- .throw("TypeError");
-
- // Verify that no extra options can be passed into the
- // AudioContextOptions.
- should(function(){context = new AudioContext('latencyHint')},
- "context = new AudioContext('latencyHint')")
- .throw("TypeError");
-
- Promise.all(closingPromises).then(function() { task.done(); });
- });
-
- audit.run();
- </script>
-</body>
+ <head>
+ <title>
+ Test AudioContextOptions
+ </title>
+ <script src="../../resources/testharness.js"></script>
+ <script src="../../resources/testharnessreport.js"></script>
+ <script src="../resources/audit.js"></script>
+ </head>
+ <body>
+ <script id="layout-test-code">
+ let context;
+ let defaultLatency;
+ let interactiveLatency;
+ let balancedLatency;
+ let playbackLatency;
+
+ let audit = Audit.createTaskRunner();
+
+ audit.define(
+ {
+ label: 'test-audiocontextoptions-latencyHint-basic',
+ description: 'Test creating contexts with basic latencyHint types.'
+ },
+ function(task, should) {
+ let closingPromises = [];
+
+ // Verify that an AudioContext can be created with default options.
+ should(function() {
+ context = new AudioContext()
+ }, 'context = new AudioContext()').notThrow();
+
+ defaultLatency = context.baseLatency;
+ should(defaultLatency, 'default baseLatency').beGreaterThan(0);
+
+ // Verify that an AudioContext can be created with the expected
+ // latency types.
+ should(
+ function() {
+ context = new AudioContext({'latencyHint': 'interactive'})
+ },
+ 'context = new AudioContext({\'latencyHint\': \'interactive\'})')
+ .notThrow();
+
+ interactiveLatency = context.baseLatency;
+ should(interactiveLatency, 'interactive baseLatency')
+ .beEqualTo(defaultLatency);
+ closingPromises.push(context.close());
+
+ should(
+ function() {
+ context = new AudioContext({'latencyHint': 'balanced'})
+ },
+ 'context = new AudioContext({\'latencyHint\': \'balanced\'})')
+ .notThrow();
+
+ balancedLatency = context.baseLatency;
+ should(balancedLatency, 'balanced baseLatency')
+ .beGreaterThanOrEqualTo(interactiveLatency);
+ closingPromises.push(context.close());
+
+ should(
+ function() {
+ context = new AudioContext({'latencyHint': 'playback'})
+ },
+ 'context = new AudioContext({\'latencyHint\': \'playback\'})')
+ .notThrow();
+
+ playbackLatency = context.baseLatency;
+ should(playbackLatency, 'playback baseLatency')
+ .beGreaterThanOrEqualTo(balancedLatency);
+ closingPromises.push(context.close());
+
+ Promise.all(closingPromises).then(function() {
+ task.done();
+ });
+ });
+
+ audit.define(
+ {
+ label: 'test-audiocontextoptions-latencyHint-double',
+ description:
+ 'Test creating contexts with explicit latencyHint values.'
+ },
+ function(task, should) {
+ let closingPromises = [];
+
+ // Verify too small exact latency clamped to 'interactive'
+ should(
+ function() {
+ context =
+ new AudioContext({'latencyHint': interactiveLatency / 2})
+ },
+ 'context = new AudioContext({\'latencyHint\': ' +
+ 'interactiveLatency/2})')
+ .notThrow();
+ should(context.baseLatency, 'double-constructor baseLatency small')
+ .beEqualTo(interactiveLatency);
+ closingPromises.push(context.close());
+
+ // Verify that exact latency in range works as expected
+ let validLatency = (interactiveLatency + playbackLatency) / 2;
+ should(
+ function() {
+ context = new AudioContext({'latencyHint': validLatency})
+ },
+ 'context = new AudioContext({\'latencyHint\': validLatency})')
+ .notThrow();
+ should(
+ context.baseLatency, 'double-constructor baseLatency inrange 1')
+ .beGreaterThanOrEqualTo(interactiveLatency);
+ should(
+ context.baseLatency, 'double-constructor baseLatency inrange 2')
+ .beLessThanOrEqualTo(playbackLatency);
+ closingPromises.push(context.close());
+
+ // Verify too big exact latency clamped to some value
+ let context1;
+ let context2;
+ should(function() {
+ context1 =
+ new AudioContext({'latencyHint': playbackLatency * 10});
+ context2 =
+ new AudioContext({'latencyHint': playbackLatency * 20});
+ }, 'creating two high latency contexts').notThrow();
+ should(context1.baseLatency, 'high latency context baseLatency')
+ .beEqualTo(context2.baseLatency);
+ closingPromises.push(context1.close());
+ closingPromises.push(context2.close());
+
+ // Verify that invalid latencyHint values are rejected.
+ should(
+ function() {
+ context = new AudioContext({'latencyHint': 'foo'})
+ },
+ 'context = new AudioContext({\'latencyHint\': \'foo\'})')
+ .throw('TypeError');
+
+ // Verify that no extra options can be passed into the
+ // AudioContextOptions.
+ should(
+ function() {
+ context = new AudioContext('latencyHint')
+ },
+ 'context = new AudioContext(\'latencyHint\')')
+ .throw('TypeError');
+
+ Promise.all(closingPromises).then(function() {
+ task.done();
+ });
+ });
+
+ audit.run();
+ </script>
+ </body>
</html>

Powered by Google App Engine
This is Rietveld 408576698