Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../resources/testharness.js"></script> | 4 <script src="../../resources/testharness.js"></script> |
| 5 <script src="../../resources/testharnessreport.js"></script> | 5 <script src="../../resources/testharnessreport.js"></script> |
| 6 <script src="../resources/audit-util.js"></script> | 6 <script src="../resources/audit-util.js"></script> |
| 7 <script src="../resources/audio-testing.js"></script> | 7 <script src="../resources/audit.js"></script> |
| 8 <title>Test Supported Number of Channels for ConvolverNode</title> | 8 <title>Test Supported Number of Channels for ConvolverNode</title> |
| 9 </head> | 9 </head> |
| 10 | 10 |
| 11 <body> | 11 <body> |
| 12 <script> | 12 <script> |
| 13 | 13 |
| 14 var audit = Audit.createTaskRunner(); | 14 var audit = Audit.createTaskRunner(); |
| 15 | 15 |
| 16 audit.defineTask("channel-count-test", function (done) { | 16 audit.define("channel-count-test", (task, should) => { |
| 17 // Just need a context to create nodes on, so any allowed length and rat e is ok. | 17 // Just need a context to create nodes on, so any allowed length and rat e is ok. |
| 18 var context = new OfflineAudioContext(1, 1, 48000); | 18 var context = new OfflineAudioContext(1, 1, 48000); |
| 19 | 19 |
| 20 var success = true; | 20 var success = true; |
| 21 | 21 |
| 22 for (var count = 1; count <= 32; ++count) { | 22 for (var count = 1; count <= 32; ++count) { |
| 23 var convolver = context.createConvolver(); | 23 var convolver = context.createConvolver(); |
| 24 var buffer = context.createBuffer(count, 1, context.sampleRate); | 24 var buffer = context.createBuffer(count, 1, context.sampleRate); |
| 25 var message = "ConvolverNode with buffer of " + count + " channels"; | 25 var message = "ConvolverNode with buffer of " + count + " channels"; |
| 26 | 26 |
| 27 if (count == 1 || count == 2 || count == 4) { | 27 if (count == 1 || count == 2 || count == 4) { |
| 28 // These are the only valid channel counts for the buffer. | 28 // These are the only valid channel counts for the buffer. |
| 29 success = Should(message, function () { | 29 should(function () { |
| 30 convolver.buffer = buffer; | 30 convolver.buffer = buffer; |
| 31 }).notThrow() && success; | 31 }, message).notThrow(); |
|
hongchan
2017/04/07 22:26:45
nit: this could be one liner.
should(() => convol
Raymond Toy
2017/04/07 22:44:12
Well, I wrapped .notThrow() to the next line.
| |
| 32 } else { | 32 } else { |
| 33 success = Should(message, function () { | 33 should(function () { |
| 34 convolver.buffer = buffer; | 34 convolver.buffer = buffer; |
| 35 }).throw("NotSupportedError") && success; | 35 }, message).throw("NotSupportedError"); |
|
hongchan
2017/04/07 22:26:45
Ditto.
| |
| 36 } | 36 } |
| 37 } | 37 } |
| 38 | 38 |
| 39 Should("Multiple channels for the convolver were handled", success) | 39 task.done(); |
| 40 .summarize("correctly", "incorrectly"); | |
| 41 | |
| 42 done(); | |
| 43 }); | 40 }); |
| 44 | 41 |
| 45 audit.defineTask("finish", function (done) { | 42 audit.run(); |
| 46 done(); | |
| 47 }); | |
| 48 | |
| 49 audit.runTasks(); | |
| 50 </script> | 43 </script> |
| 51 </body> | 44 </body> |
| 52 </html> | 45 </html> |
| OLD | NEW |