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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/Convolver/convolution-mono-mono.html

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

Powered by Google App Engine
This is Rietveld 408576698