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);"); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 shouldThrow("new webkitRTCPeerConnection(null, {mandatory:{valid_and_supported_1
:66}});"); | 53 shouldThrow("new webkitRTCPeerConnection(null, {mandatory:{valid_and_supported_1
:66}});"); |
54 shouldThrow("new webkitRTCPeerConnection(null, {mandatory:{invalid:1}});"); | 54 shouldThrow("new webkitRTCPeerConnection(null, {mandatory:{invalid:1}});"); |
55 shouldThrow("new webkitRTCPeerConnection(null, {mandatory:{valid_but_unsupported
_1: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}});"); | 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}});"); | 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}]});"); | 58 shouldThrow("new webkitRTCPeerConnection(null, {optional:[{valid_and_supported_1
:0,valid_and_supported_2:0}]});"); |
59 shouldThrow("new webkitRTCPeerConnection(null, {optional:[{invalid:0}]});"); | 59 shouldThrow("new webkitRTCPeerConnection(null, {optional:[{invalid:0}]});"); |
60 shouldThrow("new webkitRTCPeerConnection(null, {valid_and_supported_1:1});"); | 60 shouldThrow("new webkitRTCPeerConnection(null, {valid_and_supported_1:1});"); |
61 shouldThrow("new webkitRTCPeerConnection(null, {valid_but_unsupported_1:1});"); | 61 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}});"); | 62 shouldThrow("new webkitRTCPeerConnection(null, {valid_and_supported_2:1, mandato
ry:{valid_and_supported_1:1}});"); |
| 63 |
| 64 // Construct with certificates. |
| 65 shouldNotThrow("new webkitRTCPeerConnection({certificates:null}, null);"); |
| 66 shouldNotThrow("new webkitRTCPeerConnection({certificates:[]}, null);"); |
| 67 shouldThrow("new webkitRTCPeerConnection({certificates:[null]}, null);"); |
| 68 shouldThrow("new webkitRTCPeerConnection({certificates:[1337]}, null);"); |
| 69 // Global certificate variables so that the "should..." methods can evaluate the
m. |
| 70 var certRSA = null; |
| 71 var certECDSA = null; |
| 72 function testCertificates1RSA() |
| 73 { |
| 74 webkitRTCPeerConnection.generateCertificate({ name: "RSASSA-PKCS1-v1_5", mod
ulusLength: 2048, publicExponent: 65537 }) |
| 75 .then(function(certificate) { |
| 76 certRSA = certificate; |
| 77 shouldNotThrow('new webkitRTCPeerConnection({certificates:[cer
tRSA]}, null);'); |
| 78 testCertificates2ECDSA(); |
| 79 }, |
| 80 function() { |
| 81 testFailed('Generating RSA 2048'); |
| 82 testCertificates2ECDSA(); |
| 83 }); |
| 84 } |
| 85 function testCertificates2ECDSA() |
| 86 { |
| 87 webkitRTCPeerConnection.generateCertificate({ name: "ECDSA", namedCurve: "P-
256" }) |
| 88 .then(function(certificate) { |
| 89 certECDSA = certificate; |
| 90 shouldNotThrow('new webkitRTCPeerConnection({certificates:[cer
tECDSA]}, null);'); |
| 91 finishJSTest(); |
| 92 }, |
| 93 function() { |
| 94 testFailed('Generating ECDSA P-256'); |
| 95 finishJSTest(); |
| 96 }); |
| 97 } |
| 98 // Sequentially test construction with RSA and ECDSA certificates. |
| 99 // testCertificates2ECDSA's callback methods mark the end of the async tests. |
| 100 testCertificates1RSA(); |
| 101 |
| 102 window.jsTestIsAsync = true; |
| 103 window.successfullyParsed = true; |
63 </script> | 104 </script> |
64 </body> | 105 </body> |
65 </html> | 106 </html> |
OLD | NEW |