Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3448)

Unified Diff: chrome/test/data/webrtc/peerconnection.js

Issue 1645043004: WebRtcBrowserTest with VP8 and VP9. WebRtcTestBase::NegotiateCall specifying video codec. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: (Updated comments, js include order of munge_sdp.js: after peerconnection.js) Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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); },

Powered by Google App Engine
This is Rietveld 408576698