1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
4 <script src=
"../../resources/js-test.js"></script>
8 description("Tests the RTCPeerConnection constructor.");
10 shouldNotThrow("new webkitRTCPeerConnection(null);");
11 shouldNotThrow("new webkitRTCPeerConnection(null, null);");
12 shouldNotThrow("new webkitRTCPeerConnection(undefined);");
13 shouldNotThrow("new webkitRTCPeerConnection(undefined, undefined);");
14 shouldThrow("new webkitRTCPeerConnection();");
15 shouldThrow("new webkitRTCPeerConnection('');");
16 shouldThrow("new webkitRTCPeerConnection(null, '');");
18 shouldNotThrow("new webkitRTCPeerConnection({iceServers:[]}, null);");
19 shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{url:'stun:foo.com'}]}, null);");
20 shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{url:'turn:foo.com', credential:'x'}]}, null);");
21 shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{url:'turn:foo.com', credential:'x'},{url:'stun:bar.com'}]}, null);");
22 shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]}, null);");
23 shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:['stun:foo.com', 'turn:foo.com']}]}, null);");
24 shouldNotThrow("new webkitRTCPeerConnection({iceServers:undefined}, null);");
25 shouldNotThrow("new webkitRTCPeerConnection({}, null);");
26 shouldThrow("new webkitRTCPeerConnection({iceServers:null}, null);");
28 shouldThrow("new webkitRTCPeerConnection({iceServers:true}, null);");
29 shouldThrow("new webkitRTCPeerConnection({iceServers:[1, 2, 3]}, null);");
30 shouldThrow("new webkitRTCPeerConnection({iceServers:[{}]}, null);");
31 shouldThrow("new webkitRTCPeerConnection({iceServers:[{url:'foo'}]}, null);");
32 shouldThrow("new webkitRTCPeerConnection({iceServers:[{urls:[1, 'turn:foo.com']}]}, null);");
34 shouldNotThrow("new webkitRTCPeerConnection({iceServers:[], iceTransports:'none'}, null);");
35 shouldNotThrow("new webkitRTCPeerConnection({iceServers:[], iceTransports:'relay'}, null);");
36 shouldNotThrow("new webkitRTCPeerConnection({iceServers:[], iceTransports:'all'}, null);");
37 shouldThrow("new webkitRTCPeerConnection({iceServers:[], iceTransports:'foo'}, null);");
39 shouldNotThrow("new webkitRTCPeerConnection({iceServers:[], bundlePolicy:'balanced'}, null);");
40 shouldNotThrow("new webkitRTCPeerConnection({iceServers:[], bundlePolicy:'max-bundle'}, null);");
41 shouldNotThrow("new webkitRTCPeerConnection({iceServers:[], bundlePolicy:'max-compat'}, null);");
42 shouldThrow("new webkitRTCPeerConnection({iceServers:[], bundlePolicy:'foo'}, null);");
44 shouldNotThrow("new webkitRTCPeerConnection({iceServers:[], rtcpMuxPolicy:'negotiate'}, null);");
45 shouldNotThrow("new webkitRTCPeerConnection({iceServers:[], rtcpMuxPolicy:'require'}, null);");
46 shouldThrow("new webkitRTCPeerConnection({iceServers:[], rtcpMuxPolicy:'foo'}, null);");
48 shouldNotThrow("new webkitRTCPeerConnection(null, {mandatory:{valid_and_supported_1:1}});");
49 shouldNotThrow("new webkitRTCPeerConnection(null, {mandatory:{valid_and_supported_1:1, valid_and_supported_2:1}});");
50 shouldNotThrow("new webkitRTCPeerConnection(null, {optional:[{valid_and_supported_1:0}]});");
51 shouldNotThrow("new webkitRTCPeerConnection(null, {optional:[{valid_and_supported_1:0},{valid_and_supported_2:0}]});");
52 shouldNotThrow("new webkitRTCPeerConnection(null, {optional:[{valid_but_unsupported_1:0},{valid_but_unsupported_2:0}]});");
53 shouldThrow("new webkitRTCPeerConnection(null, {mandatory:{valid_and_supported_1:66}});");
54 shouldThrow("new webkitRTCPeerConnection(null, {mandatory:{invalid:1}});");
55 shouldThrow("new webkitRTCPeerConnection(null, {mandatory:{valid_but_unsupported_1:1}});");
56 shouldThrow("new webkitRTCPeerConnection(null, {mandatory:{valid_but_unsupported_1:1, valid_and_supported_1:1}});");
57 shouldThrow("new webkitRTCPeerConnection(null, {optional:{valid_and_supported_1:0}});");
58 shouldThrow("new webkitRTCPeerConnection(null, {optional:[{valid_and_supported_1:0,valid_and_supported_2:0}]});");
59 shouldThrow("new webkitRTCPeerConnection(null, {optional:[{invalid:0}]});");
60 shouldThrow("new webkitRTCPeerConnection(null, {valid_and_supported_1:1});");
61 shouldThrow("new webkitRTCPeerConnection(null, {valid_but_unsupported_1:1});");
62 shouldThrow("new webkitRTCPeerConnection(null, {valid_and_supported_2:1, mandatory:{valid_and_supported_1:1}});");