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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/AudioBuffer/audiobuffer-getChannelData.html

Issue 2782523002: Convert AudioBuffer tests to new Audit (Closed)
Patch Set: Indent some long lines Created 3 years, 8 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
« no previous file with comments | « third_party/WebKit/LayoutTests/webaudio/AudioBuffer/audiobuffer-copy-channel.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <script src="../resources/audioparam-testing.js"></script> 8 <script src="../resources/audioparam-testing.js"></script>
9 <title>Test AudioBuffer.getChannelData() Returns the Same Object</title> 9 <title>Test AudioBuffer.getChannelData() Returns the Same Object</title>
10 </head> 10 </head>
11 11
12 <body> 12 <body>
13 <script> 13 <script>
14 14
15 var sampleRate = 48000; 15 var sampleRate = 48000;
16 var renderDuration = 0.5; 16 var renderDuration = 0.5;
17 17
18 var audit = Audit.createTaskRunner(); 18 var audit = Audit.createTaskRunner();
19 19
20 audit.defineTask("buffer-eq", function (done) { 20 audit.define("buffer-eq", (task, should) => {
21 // Verify that successive calls to getChannelData return the same buffer . 21 // Verify that successive calls to getChannelData return the same buffer .
22 var context = new AudioContext(); 22 var context = new AudioContext();
23 var channelCount = 2; 23 var channelCount = 2;
24 var frameLength = 1000; 24 var frameLength = 1000;
25 var buffer = context.createBuffer(channelCount, frameLength, context.sam pleRate); 25 var buffer = context.createBuffer(channelCount, frameLength, context.sam pleRate);
26 var success = true;
27 26
28 for (var c = 0; c < channelCount; ++c) { 27 for (var c = 0; c < channelCount; ++c) {
29 var a = buffer.getChannelData(c); 28 var a = buffer.getChannelData(c);
30 var b = buffer.getChannelData(c); 29 var b = buffer.getChannelData(c);
31 //testPassed("a = buffer.getChannelData(" + c + ")");
32 //testPassed("b = buffer.getChannelData(" + c + ")");
33 30
34 let message = "buffer.getChannelData(" + c + ")"; 31 let message = "buffer.getChannelData(" + c + ")";
35 success = Should(message + " === "+ message, a === b) 32 should(a === b, message + " === " + message)
36 .beEqualTo(true) && success; 33 .beEqualTo(true);
37 } 34 }
38 35
39 Should("getChannelData", success) 36 task.done();
40 .summarize("correctly returned the same buffer",
41 "inccorrectly returned the different buffers");
42 done();
43 }); 37 });
44 38
45 audit.defineTask("buffer-not-eq", function (done) { 39 audit.define("buffer-not-eq", (task, should) => {
46 var context = new AudioContext(); 40 var context = new AudioContext();
47 var channelCount = 2; 41 var channelCount = 2;
48 var frameLength = 1000; 42 var frameLength = 1000;
49 var buffer1 = context.createBuffer(channelCount, frameLength, context.sa mpleRate); 43 var buffer1 = context.createBuffer(channelCount, frameLength, context.sa mpleRate);
50 var buffer2 = context.createBuffer(channelCount, frameLength, context.sa mpleRate); 44 var buffer2 = context.createBuffer(channelCount, frameLength, context.sa mpleRate);
51 var success = true; 45 var success = true;
52 46
53 for (var c = 0; c < channelCount; ++c) { 47 for (var c = 0; c < channelCount; ++c) {
54 var a = buffer1.getChannelData(c); 48 var a = buffer1.getChannelData(c);
55 var b = buffer2.getChannelData(c); 49 var b = buffer2.getChannelData(c);
56 //testPassed("a = buffer1.getChannelData(" + c + ")");
57 //testPassed("b = buffer2.getChannelData(" + c + ")");
58 50
59 let message = "getChannelData(" + c + ")"; 51 let message = "getChannelData(" + c + ")";
60 success = Should("buffer1." + message + " === buffer2." + message, 52 should(a === b, "buffer1." + message + " === buffer2." + message)
61 a === b)
62 .beEqualTo(false) && success; 53 .beEqualTo(false) && success;
63 } 54 }
64 55
65 Should("getChannelData", success) 56 task.done();
66 .summarize("correctly returned different buffers",
67 "incorrectly returned the same buffers");
68 done();
69 }); 57 });
70 58
71 audit.defineTask("finish", function (done) { 59 audit.run();
72 done();
73 });
74
75 audit.runTasks();
76 </script> 60 </script>
77 </body> 61 </body>
78 </html> 62 </html>
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/webaudio/AudioBuffer/audiobuffer-copy-channel.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698