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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/StereoPanner/stereopannernode-no-glitch.html

Issue 2768983002: Fix duplicate test names in WebAudio tests (Closed)
Patch Set: 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> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 3
4 <head> 4 <head>
5 <script src="../../resources/testharness.js"></script> 5 <script src="../../resources/testharness.js"></script>
6 <script src="../../resources/testharnessreport.js"></script> 6 <script src="../../resources/testharnessreport.js"></script>
7 <script src="../resources/audit-util.js"></script> 7 <script src="../resources/audit-util.js"></script>
8 <script src="../resources/audio-testing.js"></script> 8 <script src="../resources/audio-testing.js"></script>
9 </head> 9 </head>
10 10
(...skipping 12 matching lines...) Expand all
23 // Option for |Should| test util. The number of array elements to be printed 23 // Option for |Should| test util. The number of array elements to be printed
24 // out is arbitrary. 24 // out is arbitrary.
25 var SHOULD_OPTS = { 25 var SHOULD_OPTS = {
26 numberOfArrayLog: 2 26 numberOfArrayLog: 2
27 }; 27 };
28 28
29 var audit = Audit.createTaskRunner(); 29 var audit = Audit.createTaskRunner();
30 30
31 // Extract a transitional region from the AudioBuffer. If no transition 31 // Extract a transitional region from the AudioBuffer. If no transition
32 // found, fail this test. 32 // found, fail this test.
33 function extractPanningTransition(input) { 33 function extractPanningTransition(input, prefix) {
34 var chanL = input.getChannelData(0); 34 var chanL = input.getChannelData(0);
35 var chanR = input.getChannelData(1); 35 var chanR = input.getChannelData(1);
36 var start, end; 36 var start, end;
37 var index = 1; 37 var index = 1;
38 38
39 // Find transition by comparing two consecutive samples. If two consecutiv e 39 // Find transition by comparing two consecutive samples. If two consecutiv e
40 // samples are identical, the transition has not started. 40 // samples are identical, the transition has not started.
41 while (chanL[index-1] === chanL[index] || chanR[index-1] === chanR[index]) { 41 while (chanL[index-1] === chanL[index] || chanR[index-1] === chanR[index]) {
42 if (++index >= input.length) { 42 if (++index >= input.length) {
43 Should(false, 'Transition in the channel data') 43 Should(false, prefix + ': Transition in the channel data')
44 .summarize('found', 'not found'); 44 .summarize('found', 'not found');
45 return null; 45 return null;
46 } 46 }
47 } 47 }
48 start = index - 1; 48 start = index - 1;
49 49
50 // Find the end of transition. If two consecutive samples are not equal, 50 // Find the end of transition. If two consecutive samples are not equal,
51 // the transition is still ongoing. 51 // the transition is still ongoing.
52 while (chanL[index-1] !== chanL[index] || chanR[index-1] !== chanR[index]) { 52 while (chanL[index-1] !== chanL[index] || chanR[index-1] !== chanR[index]) {
53 if (++index >= input.length) { 53 if (++index >= input.length) {
54 Should(false, 'Transition found') 54 Should(false, 'Transition found')
55 .summarize('', 'but the buffer ended prematurely'); 55 .summarize('', 'but the buffer ended prematurely');
56 return null; 56 return null;
57 } 57 }
58 } 58 }
59 end = index; 59 end = index;
60 60
61 Should('Transition found between sample #' + start + ' and #' + end, 61 Should(prefix + ': Transition found between sample #' + start + ' and #' + end,
hongchan 2017/03/22 22:09:42 Wrap at 80.
62 true) 62 true)
63 .summarize('correctly', 'incorrectly'); 63 .summarize('correctly', 'incorrectly');
64 64
65 return { 65 return {
66 left: chanL.subarray(start, end), 66 left: chanL.subarray(start, end),
67 right: chanR.subarray(start, end), 67 right: chanR.subarray(start, end),
68 length: end - start 68 length: end - start
69 }; 69 };
70 } 70 }
71 71
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 source.start(); 135 source.start();
136 136
137 // Schedule the parameter transition by the setter at 1/10 of the render 137 // Schedule the parameter transition by the setter at 1/10 of the render
138 // duration. 138 // duration.
139 context.suspend(0.1 * renderDuration).then(function () { 139 context.suspend(0.1 * renderDuration).then(function () {
140 panner.pan.value = options.endPanValue; 140 panner.pan.value = options.endPanValue;
141 context.resume(); 141 context.resume();
142 }); 142 });
143 143
144 context.startRendering().then(function (buffer) { 144 context.startRendering().then(function (buffer) {
145 var actual = extractPanningTransition(buffer); 145 var actual = extractPanningTransition(buffer, options.message);
146 var expected = generateStereoEqualPanningResult(stereoBuffer, 146 var expected = generateStereoEqualPanningResult(stereoBuffer,
147 options.startPanValue, options.endPanValue, actual.length); 147 options.startPanValue, options.endPanValue, actual.length);
148 148
149 // |notGlitch| tests are redundant if the actual and expected results 149 // |notGlitch| tests are redundant if the actual and expected results
150 // match and if the expected results themselves don't glitch. 150 // match and if the expected results themselves don't glitch.
151 Should('Channel #0', actual.left).notGlitch(GLITCH_THRESHOLD); 151 Should(options.message + ': Channel #0', actual.left).notGlitch(GLITCH_T HRESHOLD);
hongchan 2017/03/22 22:09:42 Wrap at 80. Ditto for the next few lines.
152 Should('Channel #1', actual.right).notGlitch(GLITCH_THRESHOLD); 152 Should(options.message + ': Channel #1', actual.right).notGlitch(GLITCH_ THRESHOLD);
153 153
154 Should('Channel #0', actual.left, SHOULD_OPTS) 154 Should(options.message + ': Channel #0', actual.left, SHOULD_OPTS)
155 .beCloseToArray(expected.left, MAX_ERROR_ALLOWED); 155 .beCloseToArray(expected.left, MAX_ERROR_ALLOWED);
156 Should('Channel #1', actual.right, SHOULD_OPTS) 156 Should(options.message + ': Channel #1', actual.right, SHOULD_OPTS)
157 .beCloseToArray(expected.right, MAX_ERROR_ALLOWED); 157 .beCloseToArray(expected.right, MAX_ERROR_ALLOWED);
158 }).then(done); 158 }).then(done);
159 } 159 }
160 160
161 // Task: move pan from negative (-0.1) to positive (0.1) value to check if 161 // Task: move pan from negative (-0.1) to positive (0.1) value to check if
162 // there is a glitch during the transition. See crbug.com/470559. 162 // there is a glitch during the transition. See crbug.com/470559.
163 audit.defineTask('negative-to-positive', function (done) { 163 audit.defineTask('negative-to-positive', function (done) {
164 panAndVerify({ startPanValue: -0.1, endPanValue: 0.1 }, done); 164 panAndVerify({ startPanValue: -0.1, endPanValue: 0.1, message: "L->R" }, d one);
165 }); 165 });
166 166
167 167
168 // Task: move pan from positive (0.1) to negative (-0.1) value to check if 168 // Task: move pan from positive (0.1) to negative (-0.1) value to check if
169 // there is a glitch during the transition. 169 // there is a glitch during the transition.
170 audit.defineTask('positive-to-negative', function (done) { 170 audit.defineTask('positive-to-negative', function (done) {
171 panAndVerify({ startPanValue: 0.1, endPanValue: -0.1 }, done); 171 panAndVerify({ startPanValue: 0.1, endPanValue: -0.1, message: "R->L" }, d one);
172 }); 172 });
173 173
174 audit.defineTask('finish-test', function (done) { 174 audit.defineTask('finish-test', function (done) {
175 done(); 175 done();
176 }); 176 });
177 177
178 audit.runTasks( 178 audit.runTasks(
179 'negative-to-positive', 179 'negative-to-positive',
180 'positive-to-negative', 180 'positive-to-negative',
181 'finish-test' 181 'finish-test'
182 ); 182 );
183 </script> 183 </script>
184 </body> 184 </body>
185 185
186 </html> 186 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698