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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/Convolver/convolver-channels.html

Issue 2669293002: Convert ConvolverNode tests to testharness (Closed)
Patch Set: Remove commented-out code Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 <!doctype html> 1 <!doctype html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/testharness.js"></script>
5 <script src="../../resources/testharnessreport.js"></script>
5 <script src="../resources/audit-util.js"></script> 6 <script src="../resources/audit-util.js"></script>
6 <script src="../resources/audio-testing.js"></script> 7 <script src="../resources/audio-testing.js"></script>
7 <title>Test Supported Number of Channels for ConvolverNode</title> 8 <title>Test Supported Number of Channels for ConvolverNode</title>
8 </head> 9 </head>
9 10
10 <body> 11 <body>
11 <script> 12 <script>
12 description("Test Supported Number of Channels for ConvolverNode");
13 window.jsTestIsAsync = true;
14 13
15 var audit = Audit.createTaskRunner(); 14 var audit = Audit.createTaskRunner();
16 15
17 audit.defineTask("channel-count-test", function (done) { 16 audit.defineTask("channel-count-test", function (done) {
18 // 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.
19 var context = new OfflineAudioContext(1, 1, 48000); 18 var context = new OfflineAudioContext(1, 1, 48000);
20 19
21 var success = true; 20 var success = true;
22 21
23 for (var count = 1; count <= 32; ++count) { 22 for (var count = 1; count <= 32; ++count) {
24 var convolver = context.createConvolver(); 23 var convolver = context.createConvolver();
25 var buffer = context.createBuffer(count, 1, context.sampleRate); 24 var buffer = context.createBuffer(count, 1, context.sampleRate);
26 var message = "ConvolverNode with buffer of " + count + " channels"; 25 var message = "ConvolverNode with buffer of " + count + " channels";
27 26
28 if (count == 1 || count == 2 || count == 4) { 27 if (count == 1 || count == 2 || count == 4) {
29 // These are the only valid channel counts for the buffer. 28 // These are the only valid channel counts for the buffer.
30 success = Should(message, function () { 29 success = Should(message, function () {
31 convolver.buffer = buffer; 30 convolver.buffer = buffer;
32 }).notThrow() && success; 31 }).notThrow() && success;
33 } else { 32 } else {
34 success = Should(message, function () { 33 success = Should(message, function () {
35 convolver.buffer = buffer; 34 convolver.buffer = buffer;
36 }).throw("NotSupportedError") && success; 35 }).throw("NotSupportedError") && success;
37 } 36 }
38 } 37 }
39 38
40 if (success) 39 Should("Multiple channels for the convolver were handled", success)
41 testPassed("Multiple channels for the convolver correctly handled."); 40 .summarize("correctly", "incorrectly");
42 else
43 testFailed("Multiple channels for the convolver were not correctly han dled.");
44 41
45 done(); 42 done();
46 }); 43 });
47 44
48 audit.defineTask("finish", function (done) { 45 audit.defineTask("finish", function (done) {
49 finishJSTest();
50 done(); 46 done();
51 }); 47 });
52 48
53 audit.runTasks(); 49 audit.runTasks();
54 </script> 50 </script>
55 </body> 51 </body>
56 </html> 52 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698