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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-detune-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 var sampleRate = 44100; 15 var sampleRate = 44100;
16 var duration = 0.25; 16 var duration = 0.25;
17 17
18 var context = new OfflineAudioContext(1, sampleRate * duration, sampleRate); 18 var context = new OfflineAudioContext(1, sampleRate * duration, sampleRate);
19 var referenceBuffer; 19 var referenceBuffer;
20 var audioBufferResult; 20 var audioBufferResult;
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-detune-modulation-expected.wav' 28 'audiobuffersource-detune-modulation-expected.wav'
29 ], function (bufferList) { 29 ], function (bufferList) {
30 referenceBuffer = bufferList[0]; 30 referenceBuffer = bufferList[0];
31 done(); 31 task.done();
32 }); 32 });
33 33
34 loader.load(); 34 loader.load();
35 }); 35 });
36 36
37 37
38 // Task: Render the actual buffer and compare with the reference. 38 // Task: Render the actual buffer and compare with the reference.
39 audit.defineTask('generate-verify', function (done) { 39 audit.define('generate-verify', (task, should) => {
40 40
41 // With this setting, the detune will be changing continuously and 41 // With this setting, the detune will be changing continuously and
42 // repeatedly within the range of [-1200, 1200] around 440Hz, based on the 42 // repeatedly within the range of [-1200, 1200] around 440Hz, based on the
43 // input from the oscillator. 43 // input from the oscillator.
44 createSawtoothWithModulation(context, 'detune', 440, 1200); 44 createSawtoothWithModulation(context, 'detune', 440, 1200);
45 45
46 context.startRendering().then(function (renderedBuffer) { 46 context.startRendering().then(function (renderedBuffer) {
47 audioBufferResult = renderedBuffer; 47 audioBufferResult = renderedBuffer;
48 var actual = renderedBuffer.getChannelData(0); 48 var actual = renderedBuffer.getChannelData(0);
49 var expected = referenceBuffer.getChannelData(0); 49 var expected = referenceBuffer.getChannelData(0);
50 50
51 // Compare two buffers with arbitrary (yet reasonable) constraints. 51 // Compare two buffers with arbitrary (yet reasonable) constraints.
52 // There parameters are determined by try bot experiments. 52 // There parameters are determined by try bot experiments.
53 compareBuffersWithConstraints(actual, expected, { 53 compareBuffersWithConstraints(should, actual, expected, {
54 prefix: "",
54 thresholdSNR: 93.31, 55 thresholdSNR: 93.31,
55 thresholdDiffULP: 1.01, 56 thresholdDiffULP: 1.01,
56 thresholdDiffCount: 0, 57 thresholdDiffCount: 0,
57 bitDepth: 16}); 58 bitDepth: 16});
58 59
59 var filename = 'audiobuffersource-detune-modulation-actual.wav'; 60 var filename = 'audiobuffersource-detune-modulation-actual.wav';
60 if (downloadAudioBuffer(renderedBuffer, filename)) 61 if (downloadAudioBuffer(renderedBuffer, filename))
61 Should("Saved reference file", true).summarize(filename, ""); 62 should(true, "Saved reference file").message(filename, "");
62 }).then(done); 63 }).then(() => task.done());
63 }); 64 });
64 65
65 audit.runTasks(); 66 audit.run();
66 </script> 67 </script>
67 </body> 68 </body>
68 69
69 </html> 70 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698