OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/js-test.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <script> | 7 <script> |
8 description("Tests the RTCPeerConnection constructor."); | 8 description("Tests the RTCPeerConnection constructor."); |
9 | 9 |
10 shouldNotThrow("new webkitRTCPeerConnection(null);"); | 10 shouldNotThrow("new webkitRTCPeerConnection(null);"); |
11 shouldNotThrow("new webkitRTCPeerConnection(null, null);"); | 11 shouldNotThrow("new webkitRTCPeerConnection(null, null);"); |
12 shouldNotThrow("new webkitRTCPeerConnection(undefined);"); | 12 shouldNotThrow("new webkitRTCPeerConnection(undefined);"); |
13 shouldNotThrow("new webkitRTCPeerConnection(undefined, undefined);"); | 13 shouldNotThrow("new webkitRTCPeerConnection(undefined, undefined);"); |
14 shouldThrow("new webkitRTCPeerConnection();"); | 14 shouldThrow("new webkitRTCPeerConnection();"); |
15 shouldThrow("new webkitRTCPeerConnection('');"); | 15 shouldThrow("new webkitRTCPeerConnection('');"); |
16 shouldThrow("new webkitRTCPeerConnection(null, '');"); | 16 shouldThrow("new webkitRTCPeerConnection(null, '');"); |
17 | 17 |
18 shouldNotThrow("new webkitRTCPeerConnection({iceServers:[]}, null);"); | 18 shouldNotThrow("new webkitRTCPeerConnection({iceServers:[]}, null);"); |
19 shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{url:'stun:foo.com'}]},
null);"); | 19 shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{url:'stun:foo.com'}]},
null);"); |
20 shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{url:'turn:foo.com', cr
edential:'x'}]}, null);"); | 20 shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{url:'turn:foo.com', cr
edential:'x'}]}, null);"); |
21 shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{url:'turn:foo.com', cr
edential:'x'},{url:'stun:bar.com'}]}, null);"); | 21 shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{url:'turn:foo.com', cr
edential:'x'},{url:'stun:bar.com'}]}, null);"); |
22 shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.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);"); | 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);"); | |
27 | 24 |
| 25 shouldThrow("new webkitRTCPeerConnection({fooServers:[]}, null);"); |
28 shouldThrow("new webkitRTCPeerConnection({iceServers:true}, null);"); | 26 shouldThrow("new webkitRTCPeerConnection({iceServers:true}, null);"); |
29 shouldThrow("new webkitRTCPeerConnection({iceServers:[1, 2, 3]}, null);"); | 27 shouldThrow("new webkitRTCPeerConnection({iceServers:[1, 2, 3]}, null);"); |
30 shouldThrow("new webkitRTCPeerConnection({iceServers:[{}]}, null);"); | 28 shouldThrow("new webkitRTCPeerConnection({iceServers:[{}]}, null);"); |
31 shouldThrow("new webkitRTCPeerConnection({iceServers:[{url:'foo'}]}, null);"); | 29 shouldThrow("new webkitRTCPeerConnection({iceServers:[{url:'foo'}]}, null);"); |
32 shouldThrow("new webkitRTCPeerConnection({iceServers:[{urls:[1, 'turn:foo.com']}
]}, null);"); | 30 shouldThrow("new webkitRTCPeerConnection({iceServers:[{urls:[1, 'turn:foo.com']}
]}, null);"); |
33 | 31 |
34 shouldNotThrow("new webkitRTCPeerConnection({iceServers:[], iceTransports:'none'
}, null);"); | 32 shouldNotThrow("new webkitRTCPeerConnection({iceServers:[], iceTransports:'none'
}, null);"); |
35 shouldNotThrow("new webkitRTCPeerConnection({iceServers:[], iceTransports:'relay
'}, null);"); | 33 shouldNotThrow("new webkitRTCPeerConnection({iceServers:[], iceTransports:'relay
'}, null);"); |
36 shouldNotThrow("new webkitRTCPeerConnection({iceServers:[], iceTransports:'all'}
, null);"); | 34 shouldNotThrow("new webkitRTCPeerConnection({iceServers:[], iceTransports:'all'}
, null);"); |
37 shouldThrow("new webkitRTCPeerConnection({iceServers:[], iceTransports:'foo'}, n
ull);"); | 35 shouldThrow("new webkitRTCPeerConnection({iceServers:[], iceTransports:'foo'}, n
ull);"); |
(...skipping 17 matching lines...) Expand all Loading... |
55 shouldThrow("new webkitRTCPeerConnection(null, {mandatory:{valid_but_unsupported
_1:1}});"); | 53 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}});"); | 54 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}});"); | 55 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}]});"); | 56 shouldThrow("new webkitRTCPeerConnection(null, {optional:[{valid_and_supported_1
:0,valid_and_supported_2:0}]});"); |
59 shouldThrow("new webkitRTCPeerConnection(null, {optional:[{invalid:0}]});"); | 57 shouldThrow("new webkitRTCPeerConnection(null, {optional:[{invalid:0}]});"); |
60 shouldThrow("new webkitRTCPeerConnection(null, {valid_and_supported_1:1});"); | 58 shouldThrow("new webkitRTCPeerConnection(null, {valid_and_supported_1:1});"); |
61 shouldThrow("new webkitRTCPeerConnection(null, {valid_but_unsupported_1:1});"); | 59 shouldThrow("new webkitRTCPeerConnection(null, {valid_but_unsupported_1:1});"); |
62 shouldThrow("new webkitRTCPeerConnection(null, {valid_and_supported_2:1, mandato
ry:{valid_and_supported_1:1}});"); | 60 shouldThrow("new webkitRTCPeerConnection(null, {valid_and_supported_2:1, mandato
ry:{valid_and_supported_1:1}});"); |
63 | 61 |
64 // Construct with certificates. | 62 // Construct with certificates. |
65 shouldNotThrow("new webkitRTCPeerConnection({certificates:null}, null);"); | 63 shouldNotThrow("new webkitRTCPeerConnection({iceServers:[], certificates:null},
null);"); |
66 shouldNotThrow("new webkitRTCPeerConnection({certificates:[]}, null);"); | 64 shouldNotThrow("new webkitRTCPeerConnection({iceServers:[], certificates:[]}, nu
ll);"); |
67 shouldThrow("new webkitRTCPeerConnection({certificates:[null]}, null);"); | 65 shouldThrow("new webkitRTCPeerConnection({iceServers:[], certificates:[null]}, n
ull);"); |
68 shouldThrow("new webkitRTCPeerConnection({certificates:[1337]}, null);"); | 66 shouldThrow("new webkitRTCPeerConnection({iceServers:[], certificates:[1337]}, n
ull);"); |
69 // Global certificate variables so that the "should..." methods can evaluate the
m. | 67 // Global certificate variables so that the "should..." methods can evaluate the
m. |
70 var certRSA = null; | 68 var certRSA = null; |
71 var certECDSA = null; | 69 var certECDSA = null; |
72 function testCertificates1RSA() | 70 function testCertificates1RSA() |
73 { | 71 { |
74 webkitRTCPeerConnection.generateCertificate({ name: "RSASSA-PKCS1-v1_5", mod
ulusLength: 2048, publicExponent: 65537 }) | 72 webkitRTCPeerConnection.generateCertificate({ name: "RSASSA-PKCS1-v1_5", mod
ulusLength: 2048, publicExponent: 65537 }) |
75 .then(function(certificate) { | 73 .then(function(certificate) { |
76 certRSA = certificate; | 74 certRSA = certificate; |
77 shouldNotThrow('new webkitRTCPeerConnection({certificates:[cer
tRSA]}, null);'); | 75 shouldNotThrow('new webkitRTCPeerConnection({iceServers:[], ce
rtificates:[certRSA]}, null);'); |
78 testCertificates2ECDSA(); | 76 testCertificates2ECDSA(); |
79 }, | 77 }, |
80 function() { | 78 function() { |
81 testFailed('Generating RSA 2048'); | 79 testFailed('Generating RSA 2048'); |
82 testCertificates2ECDSA(); | 80 testCertificates2ECDSA(); |
83 }); | 81 }); |
84 } | 82 } |
85 function testCertificates2ECDSA() | 83 function testCertificates2ECDSA() |
86 { | 84 { |
87 webkitRTCPeerConnection.generateCertificate({ name: "ECDSA", namedCurve: "P-
256" }) | 85 webkitRTCPeerConnection.generateCertificate({ name: "ECDSA", namedCurve: "P-
256" }) |
88 .then(function(certificate) { | 86 .then(function(certificate) { |
89 certECDSA = certificate; | 87 certECDSA = certificate; |
90 shouldNotThrow('new webkitRTCPeerConnection({certificates:[cer
tECDSA]}, null);'); | 88 shouldNotThrow('new webkitRTCPeerConnection({iceServers:[], ce
rtificates:[certECDSA]}, null);'); |
91 finishJSTest(); | 89 finishJSTest(); |
92 }, | 90 }, |
93 function() { | 91 function() { |
94 testFailed('Generating ECDSA P-256'); | 92 testFailed('Generating ECDSA P-256'); |
95 finishJSTest(); | 93 finishJSTest(); |
96 }); | 94 }); |
97 } | 95 } |
98 // Sequentially test construction with RSA and ECDSA certificates. | 96 // Sequentially test construction with RSA and ECDSA certificates. |
99 // testCertificates2ECDSA's callback methods mark the end of the async tests. | 97 // testCertificates2ECDSA's callback methods mark the end of the async tests. |
100 testCertificates1RSA(); | 98 testCertificates1RSA(); |
101 | 99 |
102 window.jsTestIsAsync = true; | 100 window.jsTestIsAsync = true; |
103 window.successfullyParsed = true; | 101 window.successfullyParsed = true; |
104 </script> | 102 </script> |
105 </body> | 103 </body> |
106 </html> | 104 </html> |
OLD | NEW |