OLD | NEW |
(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 // Verify that an AudioContext can be created with the expected latency ty
pes. |
| 24 Should("context = new AudioContext({'latencyHint': 'interactive'})", funct
ion () { |
| 25 context = new AudioContext({'latencyHint': 'interactive'}); |
| 26 }).notThrow(); |
| 27 Should("context = new AudioContext({'latencyHint': 'balanced'})", function
() { |
| 28 context = new AudioContext({'latencyHint': 'balanced'}); |
| 29 }).notThrow(); |
| 30 Should("context = new AudioContext({'latencyHint': 'playback'})", function
() { |
| 31 context = new AudioContext({'latencyHint': 'playback'}); |
| 32 }).notThrow(); |
| 33 |
| 34 // Verify that invalid latencyHint values are rejected. |
| 35 Should("context = new AudioContext({'latencyHint': 'foo'})", function () { |
| 36 context = new AudioContext({'latencyHint': 'foo'}); |
| 37 }).throw(); |
| 38 |
| 39 // Verify that no extra options can be passed into the AudioContextOptions
. |
| 40 Should("context = new AudioContext('latencyHint')", function () { |
| 41 context = new AudioContext('latencyHint'); |
| 42 }).throw(); |
| 43 |
| 44 done(); |
| 45 }); |
| 46 |
| 47 audit.runTasks(); |
| 48 </script> |
| 49 </body> |
| 50 </html> |
OLD | NEW |