Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / webaudio / audiobuffersource-detune-modulation.html
blob5d1c5792d28e18ae6690cc7578f5a22e3f871b00
1 <!DOCTYPE html>
2 <html>
4 <head>
5 <script src="../resources/js-test.js"></script>
6 <script src="resources/compatibility.js"></script>
7 <script src="resources/audio-testing.js"></script>
8 <script src="resources/audiobuffersource-testing.js"></script>
9 <script src="resources/buffer-loader.js"></script>
10 </head>
12 <body>
13 <script>
14 description('AudioBufferSourceNode: oscillator-driven detune modulation.');
15 window.jsTestIsAsync = true;
17 var sampleRate = 44100;
18 var duration = 0.25;
20 var context = new OfflineAudioContext(1, sampleRate * duration, sampleRate);
21 var referenceBuffer;
23 var audit = Audit.createTaskRunner();
25 // Task: Load the reference file asynchronously. In order to create a new
26 // reference file, use the task 'generate-reference' below.
27 audit.defineTask('load-reference', function (done) {
28 var loader = new BufferLoader(context, [
29 'audiobuffersource-detune-modulation-expected.wav'
30 ], function (bufferList) {
31 referenceBuffer = bufferList[0];
32 done();
33 });
35 loader.load();
36 });
39 // Task: Render the actual buffer and compare with the reference.
40 audit.defineTask('generate-verify', function (done) {
42 // With this setting, the detune will be changing continuously and
43 // repeatedly within the range of [-1200, 1200] around 440Hz, based on the
44 // input from the oscillator.
45 createSawtoothWithModulation(context, 'detune', 440, 1200);
47 context.startRendering().then(function (renderedBuffer) {
48 var actual = renderedBuffer.getChannelData(0);
49 var expected = referenceBuffer.getChannelData(0);
51 // Compare two buffers with arbitrary (yet reasonable) constraints.
52 // There parameters are determined by try bot experiments.
53 compareBuffersWithConstraints(actual, expected, {
54 thresholdSNR: 93.31,
55 thresholdDiffULP: 1.01,
56 thresholdDiffCount: 0,
57 bitDepth: 16
58 });
60 }).then(done);
61 });
63 // Task: Create a new reference audio file. See .runTasks() below to run
64 // this task.
65 audit.defineTask('generate-reference', function (done) {
66 if (!window.testRunner) {
67 done();
68 return;
71 // With this setting, the detune will be changing continuously and
72 // repeatedly within the range of [-1200, 1200] around 440Hz, based on the
73 // input from the oscillator.
74 createSawtoothWithModulation(context, 'detune', 440, 1200);
76 // |finishAudioTest| will automatically create a reference audio file from
77 // the OAC rendering if the reference file does not exist.
78 context.oncomplete = finishAudioTest;
79 context.startRendering();
80 testRunner.waitUntilDone();
82 done();
83 });
85 audit.defineTask('finish', function (done) {
86 finishJSTest();
87 done();
88 });
90 window.onload = function () {
91 audit.runTasks(
92 'load-reference',
93 'generate-verify',
94 'finish'
98 // Use this task to generate a new reference audio file. Make sure to
99 // comment out .runTasks() above before use this.
100 // audit.runTasks('generate-reference');
102 successfullyParsed = true;
103 </script>
104 </body>
106 </html>