Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / webaudio / realtimeanalyser-basic.html
blob1d61d3503514f7b763398e3cb356066be3b031bd
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>
9 <body>
10 <div id="description"></div>
11 <div id="console"></div>
13 <script>
14 description("Basic tests for AnalyserNode.");
16 var context = 0;
18 function runTest() {
19 if (window.testRunner) {
20 testRunner.dumpAsText();
21 testRunner.waitUntilDone();
24 window.jsTestIsAsync = true;
26 context = new AudioContext();
27 var analyser = context.createAnalyser();
29 if (analyser.numberOfInputs === 1)
30 testPassed("AnalyserNode has one input.");
31 else
32 testFailed("AnalyserNode should have one input, not " + analyser.numberOfInputs + ".");
34 if (analyser.numberOfOutputs === 1)
35 testPassed("AnalyserNode has one output.");
36 else
37 testFailed("AnalyserNode should have one output.");
39 if (analyser.minDecibels === -100)
40 testPassed("minDecibels default value is -100.");
41 else
42 testFailed("minDecibels default value should be -100.");
44 if (analyser.maxDecibels === -30)
45 testPassed("maxDecibels default value is -30.");
46 else
47 testFailed("maxDecibels default value should be -30.");
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.");
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 + ".");
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 + ".");
68 finishJSTest();
71 runTest();
73 </script>
75 </body>
76 </html>