Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / webaudio / audiobuffer.html
blob1844487139dacf5526b4d4ec48385347b07701db
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="resources/compatibility.js"></script>
7 </head>
8 <body>
9 <script>
10 description("Basic tests for AudioBuffer.");
12 var sampleRate = 44100.0
13 var lengthInSeconds = 2;
14 var numberOfChannels = 4;
16 var context = new AudioContext();
17 var buffer = context.createBuffer(numberOfChannels, sampleRate * lengthInSeconds, sampleRate);
19 if (buffer.sampleRate === sampleRate)
20 testPassed("sampleRate has been set correctly.");
21 else
22 testFailed("sampleRate should be set correctly.");
24 if (buffer.length === sampleRate * lengthInSeconds)
25 testPassed("length has been set correctly.");
26 else
27 testFailed("length should be set correctly");
29 if (buffer.duration === lengthInSeconds)
30 testPassed("duration has been set correctly.");
31 else
32 testFailed("duration should be set correctly.");
34 if (buffer.numberOfChannels === numberOfChannels)
35 testPassed("numberOfChannels has been set correctly.");
36 else
37 testFailed("numberOfChannels should be set correctly.");
39 for (var index = 0; index < buffer.numberOfChannels; ++index) {
40 if (buffer.getChannelData(index) instanceof window.Float32Array)
41 testPassed("getChannelData(" + index + ") returns a Float32Array object.");
42 else
43 testFailed("getChannelData(" + index + ") should return a Float32Array object.");
46 try {
47 buffer.getChannelData(buffer.numberOfChannels);
48 testFailed("Exception should be thrown when index is not less than numberOfChannels.");
49 } catch(e) {
50 testPassed("Exception has been thrown correctly when index is not less than numberOfChannels.");
53 var buffer2 = context.createBuffer(1, 1000, 24576);
54 var expectedDuration = 1000/24576;
56 if (buffer2.duration == expectedDuration)
57 testPassed("duration has expected accuracy.");
58 else
59 testFailed("duration is " + buffer2.duration + " sec instead of " + expectedDuration + " sec.");
60 </script>
62 </body>
63 </html>