Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / webaudio / realtimeanalyser-basic.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../resources/js-test.js"></script>
5 <script src="resources/audio-testing.js"></script>
6 <script src="resoruces/compatibility.js"></script>
7 </head>
8
9 <body>
10 <div id="description"></div>
11 <div id="console"></div>
12
13 <script>
14 description("Basic tests for AnalyserNode.");
15
16 var context = 0;
17
18 function runTest() {
19     if (window.testRunner) {
20         testRunner.dumpAsText();
21         testRunner.waitUntilDone();
22     }
23
24     window.jsTestIsAsync = true;
25
26     context = new AudioContext();
27     var analyser = context.createAnalyser();
28
29     if (analyser.numberOfInputs === 1)
30         testPassed("AnalyserNode has one input.");
31     else
32         testFailed("AnalyserNode should have one input, not " + analyser.numberOfInputs + ".");
33
34     if (analyser.numberOfOutputs === 1)
35         testPassed("AnalyserNode has one output.");
36     else
37         testFailed("AnalyserNode should have one output.");
38
39     if (analyser.minDecibels === -100)
40         testPassed("minDecibels default value is -100.");
41     else
42         testFailed("minDecibels default value should be -100.");
43
44     if (analyser.maxDecibels === -30)
45         testPassed("maxDecibels default value is -30.");
46     else
47         testFailed("maxDecibels default value should be -30.");
48
49     if (analyser.smoothingTimeConstant === 0.8)
50         testPassed("smoothingTimeConstant default value is 0.8.");
51     else
52         testFailed("smoothingTimeConstant default value should be 0.8.");
53
54     var expectedValue = -50 - (1/3);
55     analyser.minDecibels = expectedValue;
56     if (analyser.minDecibels === expectedValue)
57         testPassed("minDecibels value is set to " + expectedValue + ".")
58     else
59         testFailed("minDecibels value should be set to " + expectedValue + ", not " + analyser.minDecibels + ".");
60
61     expectedValue = -40 - (1/3);
62     analyser.maxDecibels = expectedValue;
63     if (analyser.maxDecibels === expectedValue)
64         testPassed("maxDecibels value is set to " + expectedValue + ".")
65     else
66         testFailed("maxDecibels value should be set to " + expectedValue + ", not " + analyser.maxDecibels + ".");
67
68     finishJSTest();
69 }
70
71 runTest();
72
73 </script>
74
75 </body>
76 </html>