1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
4 <script src=
"../../resources/js-test.js"></script>
7 <p id=
"description"></p>
8 <div id=
"console"></div>
10 description("Tests webkitGetUserMedia.");
16 testFailed('Error callback called.');
20 function gotStreamInError(s
) {
21 testFailed('Stream generated.');
25 function gotStream5(s
) {
27 testPassed('Stream generated.');
28 shouldBe('stream.getAudioTracks().length', '1');
29 shouldBe('stream.getVideoTracks().length', '1');
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
) {
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
) {
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
) {
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
) {
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;