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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-playbackrate-modulation.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 <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/audit.js"></script>
9 <script src="../resources/audiobuffersource-testing.js"></script> 9 <script src="../resources/audiobuffersource-testing.js"></script>
10 <script src="../resources/buffer-loader.js"></script> 10 <script src="../resources/buffer-loader.js"></script>
11 </head> 11 </head>
12 12
13 <body> 13 <body>
14 <script> 14 <script>
15 15
16 var sampleRate = 44100; 16 var sampleRate = 44100;
17 var duration = 0.25; 17 var duration = 0.25;
18 18
19 var context = new OfflineAudioContext(1, sampleRate * duration, sampleRate); 19 var context = new OfflineAudioContext(1, sampleRate * duration, sampleRate);
20 var referenceBuffer; 20 var referenceBuffer;
21 21
22 var audit = Audit.createTaskRunner(); 22 var audit = Audit.createTaskRunner();
23 23
24 // Task: Load the reference file asynchronously. In order to create a new 24 // Task: Load the reference file asynchronously. In order to create a new
25 // reference file, use the task 'generate-reference' below. 25 // reference file, use the task 'generate-reference' below.
26 audit.defineTask('load-reference', function (done) { 26 audit.define('load-reference', (task, should) => {
27 var loader = new BufferLoader(context, [ 27 var loader = new BufferLoader(context, [
28 'audiobuffersource-playbackrate-modulation-expected.wav' 28 'audiobuffersource-playbackrate-modulation-expected.wav'
29 ], function (bufferList) { 29 ], function (bufferList) {
30 referenceBuffer = bufferList[0]; 30 referenceBuffer = bufferList[0];
31 done(); 31 should(true, "Loaded reference file").beTrue();
32 task.done();
32 }); 33 });
33 34
34 loader.load(); 35 loader.load();
35 }); 36 });
36 37
37 38
38 // Task: Render the actual buffer and compare with the reference. 39 // Task: Render the actual buffer and compare with the reference.
39 audit.defineTask('generate-verify', function (done) { 40 audit.define('generate-verify', (task, should) => {
40 41
41 // With this setting, the playback rate will be changing continuously and 42 // With this setting, the playback rate will be changing continuously and
42 // repeatedly within the range of [0, 200] around 100Hz, based on the 43 // repeatedly within the range of [0, 200] around 100Hz, based on the
43 // input from the oscillator. 44 // input from the oscillator.
44 createSawtoothWithModulation(context, 'playbackRate', 100, 100); 45 createSawtoothWithModulation(context, 'playbackRate', 100, 100);
45 46
46 context.startRendering().then(function (renderedBuffer) { 47 context.startRendering().then(function (renderedBuffer) {
47 var actual = renderedBuffer.getChannelData(0); 48 var actual = renderedBuffer.getChannelData(0);
48 var expected = referenceBuffer.getChannelData(0); 49 var expected = referenceBuffer.getChannelData(0);
49 50
50 // Compare two buffers with arbitrary (yet reasonable) constraints. 51 // Compare two buffers with arbitrary (yet reasonable) constraints.
51 // There parameters are determined by try bot experiments. 52 // There parameters are determined by try bot experiments.
52 compareBuffersWithConstraints(actual, expected, { 53 compareBuffersWithConstraints(should, actual, expected, {
54 prefix: "Verify",
53 thresholdSNR: 92.72, 55 thresholdSNR: 92.72,
54 thresholdDiffULP: 0.985, 56 thresholdDiffULP: 0.985,
55 thresholdDiffCount: 0, 57 thresholdDiffCount: 0,
56 bitDepth: 16 58 bitDepth: 16
57 }); 59 });
58 60
59 var filename = 'audiobuffersource-playbackrate-modulation-actual.wav'; 61 var filename = 'audiobuffersource-playbackrate-modulation-actual.wav';
60 if (downloadAudioBuffer(renderedBuffer, filename)) 62 if (downloadAudioBuffer(renderedBuffer, filename))
61 Should("Saved reference file", true).summarize(filename, ""); 63 should(true, "Saved reference file").message(filename, "");
62 }).then(done); 64 }).then(() => task.done());
63 }); 65 });
64 66
65 audit.runTasks(); 67 audit.run();
66 </script> 68 </script>
67 </body> 69 </body>
68 70
69 </html> 71 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698