Set input method state when webpage move by history
[framework/web/webkit-efl.git] / LayoutTests / webaudio / stereo2mono-down-mixing.html
1 <!DOCTYPE html>
2
3 <html>
4 <head>
5 <script src="../fast/js/resources/js-test-pre.js"></script>
6 <script src="resources/audio-testing.js"></script>
7 </head>
8
9 <body>
10
11 <div id="description"></div>
12 <div id="console"></div>
13
14 <script>
15 description("This test verifies whether down mixing from stereo to mono will cause assertion error.");
16
17 var sampleRate = 44100.0;
18 var renderLengthSeconds = 0.1;
19
20 var context;
21 var toneBuffer;
22 var bufferSource;
23
24 function createDataBuffer(context, lengthInSeconds) {
25     var audioBuffer = context.createBuffer(2, lengthInSeconds * sampleRate, sampleRate);
26
27     var n = audioBuffer.length;
28     var data0 = audioBuffer.getChannelData(0);
29     var data1 = audioBuffer.getChannelData(1);
30
31     for (var i = 0; i < n; ++i) {
32         data0[i] = 1.0;
33         data1[i] = 1.0;
34     }
35
36     return audioBuffer;
37 }
38
39 function testFinished() {
40     testPassed("Test no ASSERT error.");
41     finishJSTest();
42 }
43
44 function runTest() {
45     if (window.testRunner) {
46         testRunner.dumpAsText();
47         testRunner.waitUntilDone();
48     }
49
50     window.jsTestIsAsync = true;
51
52     // Create offline audio context, the destination is mono.
53     context = new webkitOfflineAudioContext(1, sampleRate * renderLengthSeconds, sampleRate);
54     // Create a stereo AudioBuffer.
55     toneBuffer = createDataBuffer(context, renderLengthSeconds);
56
57     bufferSource = context.createBufferSource();
58     bufferSource.buffer = toneBuffer;
59
60     bufferSource.connect(context.destination);
61
62     bufferSource.noteOn(0);
63
64     context.oncomplete = testFinished;
65     context.startRendering();
66 }
67
68
69 runTest();
70
71 </script>
72
73 <script src="../fast/js/resources/js-test-post.js"></script>
74 </body>
75 </html>