Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / webaudio / mediastreamaudiosourcenode.html
blobb55cda6162b7fee6f9552bc2eb73b6d0bb362255
1 <!DOCTYPE html>
3 <html>
4 <head>
5 <script src="../resources/js-test.js"></script>
6 <script src="resources/compatibility.js"></script>
7 <script 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 MediaStreamAudioSourceNode API.");
17 var context = 0;
19 function error() {
20 testFailed('Stream generation failed.');
21 finishJSTest();
24 function getUserMedia(dictionary, callback) {
25 try {
26 navigator.webkitGetUserMedia(dictionary, callback, error);
27 } catch (e) {
28 testFailed('webkitGetUserMedia threw exception :' + e);
29 finishJSTest();
33 function gotStream(stream) {
34 s = stream;
35 testPassed('{audio:true} generated stream');
36 shouldBe('s.getAudioTracks().length', '1');
37 shouldBe('s.getVideoTracks().length', '0');
39 context = new AudioContext();
41 // Create an AudioNode from the stream.
42 var mediaStreamSource = context.createMediaStreamSource(stream);
44 // Check number of inputs and outputs.
45 if (mediaStreamSource.numberOfInputs == 0)
46 testPassed("Source AudioNode has no inputs.");
47 else
48 testFailed("Source AudioNode should not have inputs.");
50 if (mediaStreamSource.numberOfOutputs == 1)
51 testPassed("Source AudioNode has one output.");
52 else
53 testFailed("Source AudioNode should have one output.");
55 // Try calling connect() method with illegal values.
57 try {
58 mediaStreamSource.connect(0, 0, 0);
59 testFailed("connect() exception should be thrown for illegal destination AudioNode.");
60 } catch(e) {
61 testPassed("connect() exception thrown for illegal destination AudioNode.");
64 try {
65 mediaStreamSource.connect(context.destination, 5, 0);
66 testFailed("connect() exception should be thrown for illegal output index.");
67 } catch(e) {
68 testPassed("connect() exception thrown for illegal output index.");
71 try {
72 mediaStreamSource.connect(context.destination, 0, 5);
73 testFailed("connect() exception should be thrown for illegal input index.");
74 } catch(e) {
75 testPassed("connect() exception thrown for illegal input index.");
78 // Try calling connect() with proper values.
79 try {
80 mediaStreamSource.connect(context.destination, 0, 0);
81 testPassed("mediaStreamSource.connect(context.destination) succeeded.");
82 } catch(e) {
83 testFailed("mediaStreamSource.connect(context.destination) failed.");
86 finishJSTest();
89 getUserMedia({audio:true}, gotStream);
90 window.jsTestIsAsync = true;
91 window.successfullyParsed = true;
93 </script>
95 </body>
96 </html>