Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / mediastream / getusermedia.html
blobbb0ba110ee653da44541bfa79ebf5959589d28f6
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <p id="description"></p>
8 <div id="console"></div>
9 <script>
10 description("Tests webkitGetUserMedia.");
12 var stream;
13 var errorArg;
15 function error() {
16 testFailed('Error callback called.');
17 finishJSTest();
20 function gotStreamInError(s) {
21 testFailed('Stream generated.');
22 finishJSTest();
25 function gotStream5(s) {
26 stream = s;
27 testPassed('Stream generated.');
28 shouldBe('stream.getAudioTracks().length', '1');
29 shouldBe('stream.getVideoTracks().length', '1');
30 finishJSTest();
33 function error1(e) {
34 errorArg = e;
35 testPassed('Error callback called.');
36 shouldBeEqualToString('errorArg.name', 'ConstraintNotSatisfiedError');
37 shouldBeEqualToString('errorArg.constraintName', 'valid_but_unsupported_1');
39 shouldNotThrow("navigator.webkitGetUserMedia({audio:{mandatory:{'valid_and_supported_1':1}, optional:[{'valid_but_unsupported_1':0}]}, video:true}, gotStream5, error);");
42 function gotStream4(s) {
43 stream = s;
44 testPassed('Stream generated.');
45 shouldBe('stream.getAudioTracks().length', '1');
46 shouldBe('stream.getVideoTracks().length', '1');
48 shouldNotThrow("navigator.webkitGetUserMedia({audio:{mandatory:{'valid_but_unsupported_1':0}, optional:[]}, video:true}, gotStreamInError, error1);");
51 function gotStream3(s) {
52 stream = s;
53 testPassed('Stream generated.');
54 shouldBe('stream.getAudioTracks().length', '1');
55 shouldBe('stream.getVideoTracks().length', '1');
57 shouldNotThrow("navigator.webkitGetUserMedia({audio:{mandatory:{}, optional:[]}, video:true}, gotStream4, error);");
60 function gotStream2(s) {
61 stream = s;
62 testPassed('Stream generated.');
63 shouldBe('stream.getAudioTracks().length', '0');
64 shouldBe('stream.getVideoTracks().length', '1');
66 shouldNotThrow("navigator.webkitGetUserMedia({audio:true, video:true}, gotStream3, error);");
69 function gotStream1(s) {
70 stream = s;
71 testPassed('Stream generated.');
72 shouldBe('stream.getAudioTracks().length', '1');
73 shouldBe('stream.getVideoTracks().length', '0');
75 shouldNotThrow("navigator.webkitGetUserMedia({video:true}, gotStream2, error);")
78 shouldThrow("navigator.webkitGetUserMedia({audio:false, video:false}, error, error);")
79 shouldNotThrow("navigator.webkitGetUserMedia({audio:true}, gotStream1, error);");
81 window.jsTestIsAsync = true;
82 window.successfullyParsed = true;
83 </script>
84 </body>
85 </html>