| Index: chrome/test/data/webrtc/peerconnection.js
|
| diff --git a/chrome/test/data/webrtc/peerconnection.js b/chrome/test/data/webrtc/peerconnection.js
|
| index 50459b7c62caec20e0d48d36ddd066f00d351837..639e0f41a8ff34624bc5be8ea6fed1aeb640b757 100644
|
| --- a/chrome/test/data/webrtc/peerconnection.js
|
| +++ b/chrome/test/data/webrtc/peerconnection.js
|
| @@ -28,28 +28,23 @@ var gHasSeenCryptoInSdp = 'no-crypto-seen';
|
|
|
| /**
|
| * Creates a peer connection. Must be called before most other public functions
|
| - * in this file.
|
| - * @param {Object} keygenAlgorithm An |AlgorithmIdentifier| to be used as
|
| - * parameter to |RTCPeerConnection.generateCertificate|. The resulting
|
| - * certificate will be used by the peer connection.
|
| + * in this file. Alternatively, see |preparePeerConnectionWithCertificate|.
|
| + * @param {Object} keygenAlgorithm Unless null, this is an |AlgorithmIdentifier|
|
| + * to be used as parameter to |RTCPeerConnection.generateCertificate|. The
|
| + * resulting certificate will be used by the peer connection. If null, a default
|
| + * certificate is generated by the |RTCPeerConnection| instead.
|
| */
|
| function preparePeerConnection(keygenAlgorithm = null) {
|
| if (gPeerConnection !== null)
|
| - throw failTest('creating peer connection, but we already have one.');
|
| + throw failTest('Creating peer connection, but we already have one.');
|
|
|
| if (keygenAlgorithm === null) {
|
| gPeerConnection = createPeerConnection_(null);
|
| returnToTest('ok-peerconnection-created');
|
| } else {
|
| - webkitRTCPeerConnection.generateCertificate(keygenAlgorithm).then(
|
| + RTCPeerConnection.generateCertificate(keygenAlgorithm).then(
|
| function(certificate) {
|
| - if (gPeerConnection !== null) {
|
| - throw failTest('peer connection already set during certificate ' +
|
| - + 'generation.');
|
| - }
|
| - gPeerConnection = createPeerConnection_(
|
| - {iceServers:[], certificates:[certificate]});
|
| - returnToTest('ok-peerconnection-created');
|
| + preparePeerConnectionWithCertificate(certificate);
|
| },
|
| function() {
|
| failTest('Certificate generation failed. keygenAlgorithm: ' +
|
| @@ -59,6 +54,20 @@ function preparePeerConnection(keygenAlgorithm = null) {
|
| }
|
|
|
| /**
|
| + * Creates a peer connection. Must be called before most other public functions
|
| + * in this file. Alternatively, see |preparePeerConnection|.
|
| + * @param {!Object} certificate The |RTCCertificate| that will be used by the
|
| + * peer connection.
|
| + */
|
| +function preparePeerConnectionWithCertificate(certificate) {
|
| + if (gPeerConnection !== null)
|
| + throw failTest('Creating peer connection, but we already have one.');
|
| + gPeerConnection = createPeerConnection_(
|
| + {iceServers:[], certificates:[certificate]});
|
| + returnToTest('ok-peerconnection-created');
|
| +}
|
| +
|
| +/**
|
| * Asks this page to create a local offer.
|
| *
|
| * Returns a string on the format ok-(JSON encoded session description).
|
|
|