Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / webaudio / biquad-tail.html
blob6a66c7d6585fe4a81d149c0e21735fb8af0873aa
1 <!doctype html>
2 <html>
3 <head>
4 <title>Test Biquad Tail Output</title>
5 <script src="../resources/js-test.js"></script>
6 <script src="resources/compatibility.js"></script>
7 <script src="resources/audio-testing.js"></script>
8 </head>
10 <body>
11 <script>
12 description("Test Biquad Tail Output");
13 window.jsTestIsAsync = true;
15 // A high sample rate shows the issue more clearly.
16 var sampleRate = 192000;
17 // Some short duration because we don't need to run the test for very long.
18 var testDurationSec = 0.5;
19 var testDurationFrames = testDurationSec * sampleRate;
21 // Amplitude experimentally determined to give a biquad output close to 1. (No attempt was
22 // made to produce exactly 1; it's not needed.)
23 var sourceAmplitude = 100;
25 // The output of the biquad filter should not change by more than this much between output
26 // samples. Threshold was determined experimentally.
27 var glitchThreshold = 0.0129;
29 // Test that a Biquad filter doesn't have it's output terminated because the input has gone
30 // away. Generally, when a source node is finished, it disconnects itself from any downstream
31 // nodes. This is the correct behavior. Nodes that have no inputs (disconnected) are
32 // generally assumed to output zeroes. This is also desired behavior. However, biquad
33 // filters have memory so they should not suddenly output zeroes when the input is
34 // disconnected. This test checks to see if the output doesn't suddenly change to zero.
35 function runTest() {
36 var context = new OfflineAudioContext(1, testDurationFrames, sampleRate);
38 // Create an impulse source.
39 var buffer = context.createBuffer(1, 1, context.sampleRate);
40 buffer.getChannelData(0)[0] = sourceAmplitude;
41 var source = context.createBufferSource();
42 source.buffer = buffer;
44 // Create the biquad filter. It doesn't really matter what kind, so the default filter type
45 // and parameters is fine. Connect the source to it.
46 var biquad = context.createBiquadFilter();
47 source.connect(biquad);
48 biquad.connect(context.destination);
50 source.start();
52 context.startRendering().then(function(result) {
53 // There should be no large discontinuities in the output
54 var success = true;
55 success = success && Should("Biquad output", result.getChannelData(0)).notGlitch(glitchThreshold);
56 if (success)
57 testPassed("Biquad tail output correctly completed.");
58 else
59 testFailed("Biquad tail output not correctly completed.");
60 }).then(finishJSTest);
63 runTest();
64 successfullyParsed = true;
65 </script>
66 </body>
67 </html>