Chromium Code Reviews| Index: chrome/test/data/webrtc/peerconnection.js |
| diff --git a/chrome/test/data/webrtc/peerconnection.js b/chrome/test/data/webrtc/peerconnection.js |
| index 578718802d0b57aadf4a2d9f27d57087727da521..75900769e46ae39cd555e6501afb87815f63b69a 100644 |
| --- a/chrome/test/data/webrtc/peerconnection.js |
| +++ b/chrome/test/data/webrtc/peerconnection.js |
| @@ -44,12 +44,18 @@ function preparePeerConnection() { |
| * Returns a string on the format ok-(JSON encoded session description). |
| * |
| * @param {!Object} constraints Any createOffer constraints. |
| + * @param {!String} videoCodec If not null, promotes the specified codec to be |
|
phoglund_chromium
2016/02/01 14:20:44
Remove the !, which means that the parameter is ma
hbos_chromium
2016/02/02 14:07:19
Oh so that's what it means... :) done.
|
| + * the default video codec, e.g. the first one in the list on the 'm=video' SDP |
| + * offer line. |videoCodec| is the case-sensitive codec name, e.g. 'VP8'. |
| */ |
| -function createLocalOffer(constraints) { |
| +function createLocalOffer(constraints, videoCodec = null) { |
| peerConnection_().createOffer( |
| function(localOffer) { |
| success_('createOffer'); |
| + |
| setLocalDescription(peerConnection, localOffer); |
| + if (videoCodec !== null) |
| + localOffer.sdp = setSdpDefaultVideoCodec(localOffer.sdp, videoCodec); |
| returnToTest('ok-' + JSON.stringify(localOffer)); |
| }, |
| @@ -65,8 +71,13 @@ function createLocalOffer(constraints) { |
| * @param {!string} sessionDescJson A JSON-encoded session description of type |
| * 'offer'. |
| * @param {!Object} constraints Any createAnswer constraints. |
| + * @param {!string} videoCodec If not null, verifies that the specified codec |
|
phoglund_chromium
2016/02/01 14:20:44
Call this expectedVideoCodec
phoglund_chromium
2016/02/01 14:20:44
Same here
hbos_chromium
2016/02/02 14:07:19
Done.
|
| + * is the default video codec, e.g. the first one in the list on the 'm=video' |
| + * SDP answer line. If this is not the case, |failure_| occurs. |videoCodec| is |
| + * the case-sensitive codec name, e.g. 'VP8', or null not to perform any |
| + * verification. |
| */ |
| -function receiveOfferFromPeer(sessionDescJson, constraints) { |
| +function receiveOfferFromPeer(sessionDescJson, constraints, videoCodec = null) { |
| offer = parseJson_(sessionDescJson); |
| if (!offer.type) |
| failTest('Got invalid session description from peer: ' + sessionDescJson); |
| @@ -82,7 +93,21 @@ function receiveOfferFromPeer(sessionDescJson, constraints) { |
| peerConnection_().createAnswer( |
| function(answer) { |
| success_('createAnswer'); |
| + |
| setLocalDescription(peerConnection, answer); |
| + if (videoCodec !== null) { |
|
phoglund_chromium
2016/02/01 14:20:44
Break this out into a new function verifyDefaultVi
hbos_chromium
2016/02/02 14:07:19
Done.
|
| + var defaultVideoCodec = getSdpDefaultVideoCodec(answer.sdp); |
| + if (defaultVideoCodec === null) { |
| + failure_('createAnswer', |
|
phoglund_chromium
2016/02/01 14:20:44
Should be failTest. Also note failTest takes one a
hbos_chromium
2016/02/02 14:07:19
failure_ is defined in this file.
|
| + 'Could not determine default video codec.'); |
| + } |
| + if (videoCodec !== defaultVideoCodec) { |
| + failure_('createAnswer', |
|
phoglund_chromium
2016/02/01 14:20:44
Same here
|
| + 'Expected default video codec ' + videoCodec + |
| + ', got ' + defaultVideoCodec + '.'); |
| + } |
| + } |
| + |
| returnToTest('ok-' + JSON.stringify(answer)); |
| }, |
| function(error) { failure_('createAnswer', error); }, |