Update selection handle position in Ref-Internet browser
[framework/web/webkit-efl.git] / LayoutTests / webaudio / mediastreamaudiosourcenode.html
1 <!DOCTYPE html>
2
3 <html>
4 <head>
5 <script src="../fast/js/resources/js-test-pre.js"></script>
6 <script src="resources/audio-testing.js"></script>
7 </head>
8
9 <body>
10 <div id="description"></div>
11 <div id="console"></div>
12
13 <script>
14 description("Basic tests for MediaStreamAudioSourceNode API.");
15
16 var context = 0;
17
18 function error() {
19     testFailed('Stream generation failed.');
20     finishJSTest();
21 }
22
23 function getUserMedia(dictionary, callback) {
24     try {
25         navigator.webkitGetUserMedia(dictionary, callback, error);
26     } catch (e) {
27         testFailed('webkitGetUserMedia threw exception :' + e);
28         finishJSTest();
29     }
30 }
31
32 function gotStream(stream) {
33     s = stream;
34     testPassed('{audio:true} generated stream');
35     shouldBe('s.audioTracks.length', '1');
36     shouldBe('s.videoTracks.length', '0');
37
38     context = new webkitAudioContext();
39
40     // Create an AudioNode from the stream.
41     var mediaStreamSource = context.createMediaStreamSource(stream);
42
43     // Check number of inputs and outputs.
44     if (mediaStreamSource.numberOfInputs == 0)
45         testPassed("Source AudioNode has no inputs.");
46     else
47         testFailed("Source AudioNode should not have inputs.");
48
49     if (mediaStreamSource.numberOfOutputs == 1)
50         testPassed("Source AudioNode has one output.");
51     else
52         testFailed("Source AudioNode should have one output.");
53
54     // Try calling connect() method with illegal values.
55
56     try {
57         mediaStreamSource.connect(0, 0, 0);
58         testFailed("connect() exception should be thrown for illegal destination AudioNode.");
59     } catch(e) {
60         testPassed("connect() exception thrown for illegal destination AudioNode.");
61     }
62
63     try {
64         mediaStreamSource.connect(context.destination, 5, 0);
65         testFailed("connect() exception should be thrown for illegal output index.");
66     } catch(e) {
67         testPassed("connect() exception thrown for illegal output index.");
68     }
69
70     try {
71         mediaStreamSource.connect(context.destination, 0, 5);
72         testFailed("connect() exception should be thrown for illegal input index.");
73     } catch(e) {
74         testPassed("connect() exception thrown for illegal input index.");
75     }
76
77     // Try calling connect() with proper values.
78     try {
79         mediaStreamSource.connect(context.destination, 0, 0);
80         testPassed("mediaStreamSource.connect(context.destination) succeeded.");
81     } catch(e) {
82         testFailed("mediaStreamSource.connect(context.destination) failed.");
83     }
84
85     finishJSTest();
86 }
87
88 getUserMedia({audio:true}, gotStream);
89 window.jsTestIsAsync = true;
90 window.successfullyParsed = true;
91
92 </script>
93
94 <script src="../fast/js/resources/js-test-post.js"></script>
95 </body>
96 </html>