Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / webaudio / audiobuffersource-channels.html
blob703c565159567be56e8a2036b03ecd77734413aa
1 <!DOCTYPE html>
3 <html>
4 <head>
5 <script src="../resources/js-test.js"></script>
6 <script type="text/javascript" src="resources/audio-testing.js"></script>
7 <script src="resources/compatibility.js"></script>
8 </head>
10 <body>
11 <div id="description"></div>
12 <div id="console"></div>
14 <script>
15 description("Tests that AudioBufferSourceNode validates AudioBuffer in .buffer attribute setter.");
17 var context;
18 var source;
20 function runTest() {
21 if (window.testRunner) {
22 testRunner.dumpAsText();
23 testRunner.waitUntilDone();
26 window.jsTestIsAsync = true;
28 context = new AudioContext();
29 source = context.createBufferSource();
31 // Make sure we can't set to something which isn't an AudioBuffer.
32 shouldThrow("source.buffer = 57", '"TypeError: Failed to set the \'buffer\' property on \'AudioBufferSourceNode\': The provided value is not of type \'AudioBuffer\'."');
33 shouldThrow("source.buffer = null", '"TypeError: Failed to set the \'buffer\' property on \'AudioBufferSourceNode\': The provided value is not of type \'AudioBuffer\'."');
35 // Check that mono buffer can be set.
36 try {
37 var monoBuffer = context.createBuffer(1, 1024, context.sampleRate);
38 var testSource = context.createBufferSource();
39 testSource.buffer = monoBuffer;
40 testPassed("Mono buffer can be set.");
41 } catch(e) {
42 testFailed("Mono buffer can not be set.");
45 // Check that stereo buffer can be set.
46 try {
47 var stereoBuffer = context.createBuffer(2, 1024, context.sampleRate);
48 var testSource = context.createBufferSource();
49 testSource.buffer = stereoBuffer;
50 testPassed("Stereo buffer can be set.");
51 } catch(e) {
52 testFailed("Stereo buffer can not be set.");
55 // Check buffers with more than two channels.
56 for (var i = 3; i < 10; ++i) {
57 try {
58 var buffer = context.createBuffer(i, 1024, context.sampleRate);
59 var testSource = context.createBufferSource();
60 testSource.buffer = buffer;
61 var message = i + " channels buffer can be set.";
62 testPassed(message);
63 } catch(e) {
64 var message = i + " channels buffer can not be set.";
65 testFailed(message);
69 finishJSTest();
72 runTest();
74 </script>
76 </body>
77 </html>