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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/Convolver/convolution-mono-mono.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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webaudio/Convolver/convolution-mono-mono-expected.txt » ('j') | 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 2
3 <html> 3 <html>
4 <head> 4 <head>
5 <script src="../../resources/js-test.js"></script> 5 <script src="../../resources/testharness.js"></script>
6 <script src="../../resources/testharnessreport.js"></script>
6 <script src="../resources/audit-util.js"></script> 7 <script src="../resources/audit-util.js"></script>
7 <script src="../resources/audio-testing.js"></script> 8 <script src="../resources/audit.js"></script>
8 <script src="../resources/convolution-testing.js"></script> 9 <script src="../resources/convolution-testing.js"></script>
9 </head> 10 </head>
10 11
11 <body> 12 <body>
13 <script>
14 let audit = Audit.createTaskRunner();
12 15
13 <div id="description"></div> 16 //description("Tests ConvolverNode processing a mono channel with mono impulse r esponse.");
14 <div id="console"></div>
15
16 <script>
17 description("Tests ConvolverNode processing a mono channel with mono impulse res ponse.");
18 17
19 // To test the convolver, we convolve two square pulses together to 18 // To test the convolver, we convolve two square pulses together to
20 // produce a triangular pulse. To verify the result is correct we 19 // produce a triangular pulse. To verify the result is correct we
21 // check several parts of the result. First, we make sure the initial 20 // check several parts of the result. First, we make sure the initial
22 // part of the result is zero (due to the latency in the convolver). 21 // part of the result is zero (due to the latency in the convolver).
23 // Next, the triangular pulse should match the theoretical result to 22 // Next, the triangular pulse should match the theoretical result to
24 // within some roundoff. After the triangular pulse, the result 23 // within some roundoff. After the triangular pulse, the result
25 // should be exactly zero, but round-off prevents that. We make sure 24 // should be exactly zero, but round-off prevents that. We make sure
26 // the part after the pulse is sufficiently close to zero. Finally, 25 // the part after the pulse is sufficiently close to zero. Finally,
27 // the result should be exactly zero because the inputs are exactly 26 // the result should be exactly zero because the inputs are exactly
28 // zero. 27 // zero.
29 function runTest() { 28 audit.define("test", function (task, should) {
30 if (window.testRunner) {
31 testRunner.dumpAsText();
32 testRunner.waitUntilDone();
33 }
34
35 window.jsTestIsAsync = true;
36
37 // Create offline audio context. 29 // Create offline audio context.
38 var context = new OfflineAudioContext(2, sampleRate * renderLengthSeconds, s ampleRate); 30 var context = new OfflineAudioContext(2, sampleRate * renderLengthSeconds, s ampleRate);
39 31
40 var squarePulse = createSquarePulseBuffer(context, pulseLengthFrames); 32 var squarePulse = createSquarePulseBuffer(context, pulseLengthFrames);
41 var trianglePulse = createTrianglePulseBuffer(context, 2 * pulseLengthFrames ); 33 var trianglePulse = createTrianglePulseBuffer(context, 2 * pulseLengthFrames );
42 34
43 var bufferSource = context.createBufferSource(); 35 var bufferSource = context.createBufferSource();
44 bufferSource.buffer = squarePulse; 36 bufferSource.buffer = squarePulse;
45 37
46 var convolver = context.createConvolver(); 38 var convolver = context.createConvolver();
47 convolver.normalize = false; 39 convolver.normalize = false;
48 convolver.buffer = squarePulse; 40 convolver.buffer = squarePulse;
49 41
50 bufferSource.connect(convolver); 42 bufferSource.connect(convolver);
51 convolver.connect(context.destination); 43 convolver.connect(context.destination);
52 44
53 bufferSource.start(0); 45 bufferSource.start(0);
54 46
55 context.oncomplete = checkConvolvedResult(trianglePulse); 47 context.startRendering()
56 context.startRendering(); 48 .then(buffer => {
57 } 49 checkConvolvedResult(buffer, trianglePulse, should);
50 })
51 .then(task.done.bind(task));;
52 });
58 53
59 runTest(); 54 audit.run();
60 successfullyParsed = true;
61
62 </script> 55 </script>
63 56
64 </body> 57 </body>
65 </html> 58 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webaudio/Convolver/convolution-mono-mono-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698