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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/audiocontextoptions.html

Issue 2501863003: Support for AudioContextOptions latencyHint. (Closed)
Patch Set: More fixes based on reviewer comments. Created 4 years 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!doctype html>
2 <html>
3 <head>
4 <title>Test AudioContextOptions</title>
5 <script src="../resources/testharness.js"></script>
6 <script src="../resources/testharnessreport.js"></script>
7 <script src="resources/audio-testing.js"></script>
8 </head>
9
10 <body>
11 <script>
12 var context;
13 var audit = Audit.createTaskRunner();
14
15 // Task: test AudioContextOptions (1).
16 audit.defineTask('test-audiocontextoptions-1', function (done) {
17
18 // Verify that an AudioContext can be created with default options.
19 Should("context = new AudioContext()", function () {
20 context = new AudioContext();
21 }).notThrow();
22
23 var defaultLatency = context.baseLatency;
24 Should("default baseLatency > 0", defaultLatency).beGreaterThan(0);
25
26 // Verify that a double can be passed
27 Should("context = new AudioContext({'latencyHint': 0.05})", function () {
28 context = new AudioContext({'latencyHint': 0.05});
29 }).notThrow();
30 Should("double baseLatency == default baseLatency", context.baseLatency).b eEqualTo(defaultLatency);
Raymond Toy 2016/12/01 16:26:51 Please inspect the actual test output and verify t
Andrew MacPherson 2016/12/02 09:42:55 Done.
31
32 // Verify that an AudioContext can be created with the expected latency ty pes.
33 Should("context = new AudioContext({'latencyHint': 'interactive'})", funct ion () {
34 context = new AudioContext({'latencyHint': 'interactive'});
35 }).notThrow();
36
37 var interactiveLatency = context.baseLatency;
38 Should("interactive baseLatency == default baseLatency", interactiveLatenc y).beEqualTo(defaultLatency);
39
40 Should("context = new AudioContext({'latencyHint': 'balanced'})", function () {
41 context = new AudioContext({'latencyHint': 'balanced'});
42 }).notThrow();
43
44 var balancedLatency = context.baseLatency;
45 Should("balanced baseLatency >= interactive baseLatency", balancedLatency) .beGreaterThanOrEqualTo(interactiveLatency);
46
47 Should("context = new AudioContext({'latencyHint': 'playback'})", function () {
48 context = new AudioContext({'latencyHint': 'playback'});
49 }).notThrow();
50
51 var playbackLatency = context.baseLatency;
52 Should("playback baseLatency >= balanced baseLatency", playbackLatency).be GreaterThanOrEqualTo(balancedLatency);
53
54 // Verify that invalid latencyHint values are rejected.
55 Should("context = new AudioContext({'latencyHint': 'foo'})", function () {
56 context = new AudioContext({'latencyHint': 'foo'});
57 }).throw();
58
59 // Verify that no extra options can be passed into the AudioContextOptions .
60 Should("context = new AudioContext('latencyHint')", function () {
61 context = new AudioContext('latencyHint');
62 }).throw();
63
64 done();
65 });
66
67 audit.runTasks();
68 </script>
69 </body>
70 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698