Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / webaudio / audionode.html
blob31686b7a24cffb133732081e8a5c290b6d663384
1 <!DOCTYPE html>
3 <html>
4 <head>
5 <script src="../resources/js-test.js"></script>
6 <script src="resources/compatibility.js"></script>
7 <script type="text/javascript" src="resources/audio-testing.js"></script>
8 </head>
10 <body>
11 <div id="description"></div>
12 <div id="console"></div>
14 <script>
15 description("Basic tests for AudioNode API.");
17 var context = 0;
18 var context2 = 0;
19 var context3 = 0;
21 function runTest() {
22 if (window.testRunner) {
23 testRunner.dumpAsText();
24 testRunner.waitUntilDone();
27 window.jsTestIsAsync = true;
29 context = new AudioContext();
30 window.audioNode = context.createBufferSource();
32 // Check input and output numbers of AudioSourceNode.
33 if (audioNode.numberOfInputs === 0)
34 testPassed("Source AudioNode has no inputs.");
35 else
36 testFailed("Source AudioNode should not have inputs.");
38 if (audioNode.numberOfOutputs === 1)
39 testPassed("Source AudioNode has one output.");
40 else
41 testFailed("Source AudioNode should have one output.");
43 // Check input and output numbers of AudioDestinationNode
44 if (context.destination.numberOfInputs === 1)
45 testPassed("Destination AudioNode has one input.");
46 else
47 testFailed("Destination AudioNode should have one input.");
49 if (context.destination.numberOfOutputs === 0)
50 testPassed("Destination AudioNode has no outputs.");
51 else
52 testFailed("Destination AudioNode should have no outputs.");
54 // Try calling connect() method with illegal values.
55 shouldThrow('audioNode.connect(0, 0, 0)');
56 shouldThrow('audioNode.connect(null, 0, 0)');
57 shouldThrow('audioNode.connect(context.destination, 5, 0)');
58 shouldThrow('audioNode.connect(context.destination, 0, 5)');
60 shouldNotThrow('audioNode.connect(context.destination, 0, 0)');
62 // Create a new context and try to connect the other context's node to this one.
63 try {
64 context2 = new AudioContext();
65 window.audioNode.connect(context2.destination);
66 testFailed("exception should be thrown when connecting to other context's node.");
67 } catch(e) {
68 testPassed("exception thrown when connecting to other context's node.");
71 // 3-arg AudioContext doesn't create an offline context anymore.
72 shouldNotThrow("context3 = new AudioContext(1, 44100, 44100)");
73 if (context3 instanceof OfflineAudioContext)
74 testFailed("context3 should not be an OfflineAudioContext");
75 else
76 testPassed("context3 is not an OfflineAudioContext");
78 // Ensure it is an EventTarget
79 try {
80 audioNode.addEventListener('testEvent', function(){
81 testPassed("AudioNode is an EventTarget");
82 });
83 audioNode.dispatchEvent(new Event('testEvent'));
84 } catch(e) {
85 testFailed("exception shouldn't be thrown when testing whether audio node is an event target");
88 finishJSTest();
91 runTest();
93 </script>
95 </body>
96 </html>