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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-premature-loop-stop.html

Issue 2783553002: Convert AudioBufferSource tests to new Audit (Closed)
Patch Set: Indent neatly. Created 3 years, 8 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 <title>Test AudioBufferSourceNode premature loop stop</title> 5 <title>Test AudioBufferSourceNode premature loop stop</title>
6 <script src="../../resources/testharness.js"></script> 6 <script src="../../resources/testharness.js"></script>
7 <script src="../../resources/testharnessreport.js"></script> 7 <script src="../../resources/testharnessreport.js"></script>
8 <script src="../resources/audit-util.js"></script> 8 <script src="../resources/audit-util.js"></script>
9 <script src="../resources/audio-testing.js"></script> 9 <script src="../resources/audit.js"></script>
10 </head> 10 </head>
11 11
12 <body> 12 <body>
13 <script> 13 <script>
14 14
15 // Reasonably low sample rate for the optimum test speed. 15 // Reasonably low sample rate for the optimum test speed.
16 var sampleRate = 4096; 16 var sampleRate = 4096;
17 17
18 var audit = Audit.createTaskRunner(); 18 var audit = Audit.createTaskRunner();
19 19
20 // Task: Create a buffer with 3 regions filled with constant value of [1, 2, 20 // Task: Create a buffer with 3 regions filled with constant value of [1, 2,
21 // 3]. Then set a loop range over the second region. Start the loop and 21 // 3]. Then set a loop range over the second region. Start the loop and
22 // disable it in the middle of looping. Verify the rendered buffer has the 22 // disable it in the middle of looping. Verify the rendered buffer has the
23 // entire content including the looped region. 23 // entire content including the looped region.
24 audit.defineTask('premature-loop-stop', function (done) { 24 audit.define('premature-loop-stop', (task, should) => {
25 var regionValues = [1, 2, 3]; 25 var regionValues = [1, 2, 3];
26 26
27 // The region length is 2 * render quantum size to be able to suspend the 27 // The region length is 2 * render quantum size to be able to suspend the
28 // rendering at the half of the region. 28 // rendering at the half of the region.
29 var regionLength = 256; 29 var regionLength = 256;
30 30
31 // The test will repeat the second region 3 times, thus the rendered audio 31 // The test will repeat the second region 3 times, thus the rendered audio
32 // have the length of 5 * regionLength. 32 // have the length of 5 * regionLength.
33 var context = new OfflineAudioContext(1, 5 * regionLength, sampleRate); 33 var context = new OfflineAudioContext(1, 5 * regionLength, sampleRate);
34 34
(...skipping 28 matching lines...) Expand all
63 63
64 context.startRendering().then(function (renderedBuffer) { 64 context.startRendering().then(function (renderedBuffer) {
65 var channel = renderedBuffer.getChannelData(0); 65 var channel = renderedBuffer.getChannelData(0);
66 66
67 // Verify if the rendered buffer has the following structure: 67 // Verify if the rendered buffer has the following structure:
68 // | 1 | 2 | 2 | 2 | 3 | 68 // | 1 | 2 | 2 | 2 | 3 |
69 var region1 = channel.subarray(0, regionLength - 1); 69 var region1 = channel.subarray(0, regionLength - 1);
70 var region2 = channel.subarray(regionLength, 4 * regionLength - 1); 70 var region2 = channel.subarray(regionLength, 4 * regionLength - 1);
71 var region3 = channel.subarray(4 * regionLength, 5 * regionLength - 1); 71 var region3 = channel.subarray(4 * regionLength, 5 * regionLength - 1);
72 72
73 Should('Region #1', region1).beConstantValueOf(1); 73 should(region1, 'Region #1').beConstantValueOf(1);
74 Should('Region #2 (looped)', region2).beConstantValueOf(2); 74 should(region2, 'Region #2 (looped)').beConstantValueOf(2);
75 Should('Region #3', region3).beConstantValueOf(3); 75 should(region3, 'Region #3').beConstantValueOf(3);
76 }).then(done); 76 }).then(() => task.done());
77 }); 77 });
78 78
79 audit.defineTask('finish', function (done) { 79 audit.run();
80 done();
81 });
82
83 audit.runTasks();
84
85 successfullyParsed = true;
86 </script> 80 </script>
87 </body> 81 </body>
88 82
89 </html> 83 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698