Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / webaudio / realtimeanalyser-float-data.html
blobb490bf574e2eddf6db67b939587696061032c6b8
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <script src="../resources/js-test.js"></script>
5 <script src="resources/compatibility.js"></script>
6 <script src="resources/audio-testing.js"></script>
7 </head>
9 <body>
10 <div id="description"></div>
11 <div id="console"></div>
13 <script>
14 description("Test AnalyserNode getFloatTimeDomainData");
16 var sampleRate = 44100;
17 // Render length and FFT length. Hence this must be a power of two.
18 var sampleFrameLength = 2048;
20 var src;
21 var analyser;
22 var renderedData;
24 function checkResult() {
25 var fftSize = analyser.fftSize;
26 renderedData = new Float32Array(fftSize);
27 analyser.getFloatTimeDomainData(renderedData);
29 var trueData = src.buffer.getChannelData(0);
30 var success = true;
32 // Verify that the received time domain data is exactly equal to the actual time domain
33 // data. This is true only because the render length and FFT size are the same.
34 for (k = 0; k < fftSize; ++k) {
35 if (trueData[k] != renderedData[k]) {
36 testFailed("Data mismatch at index " + k
37 + ". Expected " + trueData[k]
38 + " but got " + renderedData[k]
39 + ".");
40 success = false;
41 break;
45 if (success) {
46 testPassed("Received expected float time domain data.");
47 } else {
48 testFailed("Received float time domain data did not match expected result.");
51 finishJSTest();
54 function runTests() {
55 if (window.testRunner) {
56 testRunner.dumpAsText();
57 testRunner.waitUntilDone();
60 window.jsTestIsAsync = true;
62 context = new OfflineAudioContext(1, sampleFrameLength, sampleRate);
64 // Use a simple linear ramp as the source.
65 src = context.createBufferSource();
66 src.buffer = createLinearRampBuffer(context, sampleFrameLength);
68 analyser = context.createAnalyser();
69 analyser.fftSize = sampleFrameLength;
71 src.connect(analyser);
72 analyser.connect(context.destination);
73 src.start();
75 context.oncomplete = checkResult;
76 context.startRendering();
79 runTests();
80 successfullyParsed = true;
81 </script>
82 </body>
83 </html>