Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / webaudio / stereo2mono-down-mixing.html
blob659d038868b5cfd0b653ba302f3b239a74ce5955
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 test verifies whether down mixing from stereo to mono will cause assertion error.");
18 var sampleRate = 44100.0;
19 var renderLengthSeconds = 0.1;
21 var context;
22 var toneBuffer;
23 var bufferSource;
25 function createDataBuffer(context, lengthInSeconds) {
26 var audioBuffer = context.createBuffer(2, lengthInSeconds * sampleRate, sampleRate);
28 var n = audioBuffer.length;
29 var data0 = audioBuffer.getChannelData(0);
30 var data1 = audioBuffer.getChannelData(1);
32 for (var i = 0; i < n; ++i) {
33 data0[i] = 1.0;
34 data1[i] = 1.0;
37 return audioBuffer;
40 function testFinished() {
41 testPassed("Test no ASSERT error.");
42 finishJSTest();
45 function runTest() {
46 if (window.testRunner) {
47 testRunner.dumpAsText();
48 testRunner.waitUntilDone();
51 window.jsTestIsAsync = true;
53 // Create offline audio context, the destination is mono.
54 context = new OfflineAudioContext(1, sampleRate * renderLengthSeconds, sampleRate);
55 // Create a stereo AudioBuffer.
56 toneBuffer = createDataBuffer(context, renderLengthSeconds);
58 bufferSource = context.createBufferSource();
59 bufferSource.buffer = toneBuffer;
61 bufferSource.connect(context.destination);
63 bufferSource.start(0);
65 context.oncomplete = testFinished;
66 context.startRendering();
70 runTest();
72 </script>
74 </body>
75 </html>