Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / webaudio / audionode-connect-order.html
blobbfe80cea6f4dbd6dc503957a7deddb9b2f59a863
1 <!DOCTYPE html>
3 <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 </head>
10 <body>
12 <div id="description"></div>
13 <div id="console"></div>
15 <script>
16 description("This tests that we don't trigger an assertion failure due to AudioNode connection order.");
18 var sampleRate = 44100.0;
19 var renderLengthSeconds = 0.125;
20 var delayTimeSeconds = 0.1;
22 function createSinWaveBuffer(context, lengthInSeconds, frequency) {
23 var audioBuffer = context.createBuffer(1, lengthInSeconds * sampleRate, sampleRate);
25 var n = audioBuffer.length;
26 var data = audioBuffer.getChannelData(0);
28 for (var i = 0; i < n; ++i) {
29 data[i] = Math.sin(frequency * 2 * Math.PI * i / sampleRate);
32 return audioBuffer;
35 function runTest() {
36 if (window.testRunner) {
37 testRunner.dumpAsText();
38 testRunner.waitUntilDone();
41 window.jsTestIsAsync = true;
43 // Create offline audio context.
44 var context = new OfflineAudioContext(1, sampleRate * renderLengthSeconds, sampleRate);
45 var toneBuffer = createSinWaveBuffer(context, renderLengthSeconds, 880);
47 var bufferSource = context.createBufferSource();
48 bufferSource.buffer = toneBuffer;
49 bufferSource.connect(context.destination);
51 var delay = context.createDelay();
52 delay.delayTime.value = delayTimeSeconds;
54 // We connect delay node to gain node before anything is connected to delay node itself.
55 // We do this because we try to trigger the ASSERT which might be fired due to AudioNode connection order,
56 // especially when gain node and delay node is involved e.g. https://bugs.webkit.org/show_bug.cgi?id=76685.
58 var gain = context.createGain();
59 gain.connect(context.destination);
60 delay.connect(gain);
62 bufferSource.start(0);
64 context.oncomplete = finishJSTest;
65 context.startRendering();
68 runTest();
70 </script>
72 </body>
73 </html>