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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/WaveShaper/waveshaper-limits.html

Issue 2727663003: Move task.describe to audit.define arg (Closed)
Patch Set: Fix up expected results Created 3 years, 9 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 PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
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/audit.js"></script> 7 <script src="../resources/audit.js"></script>
8 </head> 8 </head>
9 9
10 <body> 10 <body>
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 // Verify that every output value matches our expected reference value. 55 // Verify that every output value matches our expected reference value.
56 for (var k = 0; k < outputData.length; ++k) { 56 for (var k = 0; k < outputData.length; ++k) {
57 var diff = outputData[k] - reference[k]; 57 var diff = outputData[k] - reference[k];
58 should(Math.abs(diff), 58 should(Math.abs(diff),
59 "Max error mapping " + bufferData[k].toFixed(decimals) + " to " + 59 "Max error mapping " + bufferData[k].toFixed(decimals) + " to " +
60 outputData[k].toFixed(decimals)) 60 outputData[k].toFixed(decimals))
61 .beLessThanOrEqualTo(diffThreshold); 61 .beLessThanOrEqualTo(diffThreshold);
62 } 62 }
63 } 63 }
64 64
65 audit.define("test", function (task, should) { 65 audit.define(
66 task.describe("Test WaveShaperNode including values outside the range of [-1,1]"); 66 {
67 context = new OfflineAudioContext(1, testFrames, sampleRate); 67 label: 'test',
68 // Create input values between -1.1 and 1.1 68 description:
69 var buffer = context.createBuffer(1, testFrames, context.sampleRate); 69 'WaveShaperNode including values outside the range of [-1,1]'
70 bufferData = buffer.getChannelData(0); 70 },
71 var start = -1 - scale; 71 function(task, should) {
72 for (var k = 0; k < testFrames; ++k) { 72 context = new OfflineAudioContext(1, testFrames, sampleRate);
73 bufferData[k] = k * scale + start; 73 // Create input values between -1.1 and 1.1
74 } 74 var buffer =
75 context.createBuffer(1, testFrames, context.sampleRate);
76 bufferData = buffer.getChannelData(0);
77 var start = -1 - scale;
78 for (var k = 0; k < testFrames; ++k) {
79 bufferData[k] = k * scale + start;
80 }
75 81
76 var source = context.createBufferSource(); 82 var source = context.createBufferSource();
77 source.buffer = buffer; 83 source.buffer = buffer;
78 84
79 // Create simple waveshaper. It should map -1 to 0, 0 to 1, and +1 to 0 and interpolate 85 // Create simple waveshaper. It should map -1 to 0, 0 to 1, and +1
80 // all points in between using a simple linear interpolator. 86 // to 0 and interpolate all points in between using a simple linear
81 var shaper = context.createWaveShaper(); 87 // interpolator.
82 var curve = new Float32Array(3); 88 var shaper = context.createWaveShaper();
83 curve[0] = 0; 89 var curve = new Float32Array(3);
84 curve[1] = 1; 90 curve[0] = 0;
85 curve[2] = 0; 91 curve[1] = 1;
86 shaper.curve = curve; 92 curve[2] = 0;
87 source.connect(shaper); 93 shaper.curve = curve;
88 shaper.connect(context.destination); 94 source.connect(shaper);
95 shaper.connect(context.destination);
89 96
90 source.start(); 97 source.start();
91 context.startRendering() 98 context.startRendering()
92 .then(buffer => checkResult(buffer, should)) 99 .then(buffer => checkResult(buffer, should))
93 .then(() => task.done()); 100 .then(() => task.done());
94 }); 101 });
95 102
96 audit.run(); 103 audit.run();
97 </script> 104 </script>
98 </body> 105 </body>
99 </html> 106 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698