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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/Panner/panner-automation-position.html

Issue 2799793003: Convert Panner tests to new Audit (Closed)
Patch Set: Address review comments 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> 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/panner-formulas.js"></script> 8 <script src="../resources/panner-formulas.js"></script>
9 <title>Test Automation of PannerNode Positions</title> 9 <title>Test Automation of PannerNode Positions</title>
10 </head> 10 </head>
11 11
12 <body> 12 <body>
13 <script> 13 <script>
14 var sampleRate = 48000; 14 var sampleRate = 48000;
15 // These tests are quite slow, so don't run for many frames. 256 frames s hould be enough to 15 // These tests are quite slow, so don't run for many frames. 256 frames s hould be enough to
16 // demonstrate that automations are working. 16 // demonstrate that automations are working.
17 var renderFrames = 256; 17 var renderFrames = 256;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 errorThreshold: [{ 72 errorThreshold: [{
73 relativeThreshold: 6.5324e-6 73 relativeThreshold: 6.5324e-6
74 }, { 74 }, {
75 relativeThreshold: 6.5756e-6 75 relativeThreshold: 6.5756e-6
76 }] 76 }]
77 }]; 77 }];
78 78
79 for (var k = 0; k < testConfigs.length; ++k) { 79 for (var k = 0; k < testConfigs.length; ++k) {
80 var config = testConfigs[k]; 80 var config = testConfigs[k];
81 var tester = function (c, channelCount) { 81 var tester = function (c, channelCount) {
82 return function (done) { 82 return (task, should) => {
83 runTest(c, channelCount).then(done); 83 runTest(should, c, channelCount)
84 .then(() => task.done());
84 } 85 }
85 }; 86 };
86 87
87 var baseTestName = config.distanceModel.model + " rolloff: " + config.di stanceModel.rolloff; 88 var baseTestName = config.distanceModel.model + " rolloff: " + config.di stanceModel.rolloff;
88 89
89 // Define tasks for both 1-channel and 2-channel 90 // Define tasks for both 1-channel and 2-channel
90 audit.defineTask(k + ": 1-channel " + baseTestName, tester(config, 1)); 91 audit.define(k + ": 1-channel " + baseTestName, tester(config, 1));
91 audit.defineTask(k + ": 2-channel " + baseTestName, tester(config, 2)); 92 audit.define(k + ": 2-channel " + baseTestName, tester(config, 2));
92 } 93 }
93 94
94 audit.runTasks(); 95 audit.run();
95 96
96 function runTest(options, channelCount) { 97 function runTest(should, options, channelCount) {
97 // Output has 5 channels: channels 0 and 1 are for the stereo output of the panner node. 98 // Output has 5 channels: channels 0 and 1 are for the stereo output of the panner node.
98 // Channels 2-5 are the for automation of the x,y,z coordinate so that w e have actual 99 // Channels 2-5 are the for automation of the x,y,z coordinate so that w e have actual
99 // coordinates used for the panner automation. 100 // coordinates used for the panner automation.
100 context = new OfflineAudioContext(5, renderFrames, sampleRate); 101 context = new OfflineAudioContext(5, renderFrames, sampleRate);
101 102
102 // Stereo source for the panner. 103 // Stereo source for the panner.
103 var source = context.createBufferSource(); 104 var source = context.createBufferSource();
104 source.buffer = createConstantBuffer(context, renderFrames, channelCount == 1 ? 1 : [1, 2]); 105 source.buffer = createConstantBuffer(context, renderFrames, channelCount == 1 ? 1 : [1, 2]);
105 106
106 panner = context.createPanner(); 107 panner = context.createPanner();
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 + options.startPosition[2] + "] -> [" 238 + options.startPosition[2] + "] -> ["
238 + options.endPosition[0] + ", " 239 + options.endPosition[0] + ", "
239 + options.endPosition[1] + ", " 240 + options.endPosition[1] + ", "
240 + options.endPosition[2] + "]: "; 241 + options.endPosition[2] + "]: ";
241 242
242 var errorThreshold = 0; 243 var errorThreshold = 0;
243 244
244 if (options.errorThreshold) 245 if (options.errorThreshold)
245 errorThreshold = options.errorThreshold[channelCount - 1] 246 errorThreshold = options.errorThreshold[channelCount - 1]
246 247
247 Should(prefix + "distanceModel: " + info + ", left channel", data0, { 248 should(data0, prefix + "distanceModel: " + info + ", left channel")
248 precision: 5 249 .beCloseToArray(expected0, {
249 }) 250 absoluteThreshold: errorThreshold
250 .beCloseToArray(expected0, errorThreshold); 251 });
251 Should(prefix + "distanceModel: " + info + ", right channel", data1, { 252 should(data1, prefix + "distanceModel: " + info + ", right channel")
252 precision: 5 253 .beCloseToArray(expected1, {
253 }) 254 absoluteThreshold: errorThreshold
254 .beCloseToArray(expected1, errorThreshold); 255 });
255 }); 256 });
256 } 257 }
257 </script> 258 </script>
258 </body> 259 </body>
259 </html> 260 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698