Index: chrome/browser/media/webrtc_browsertest_base.cc |
diff --git a/chrome/browser/media/webrtc_browsertest_base.cc b/chrome/browser/media/webrtc_browsertest_base.cc |
index 58ccdc445c72a24cd8b3ad2ee5dfcf87afa9ce69..2213da9f1c64c33f069546e4b51c8d60692b5003 100644 |
--- a/chrome/browser/media/webrtc_browsertest_base.cc |
+++ b/chrome/browser/media/webrtc_browsertest_base.cc |
@@ -336,8 +336,15 @@ |
} |
std::string WebRtcTestBase::CreateLocalOffer( |
- content::WebContents* from_tab) const { |
- std::string response = ExecuteJavascript("createLocalOffer({})", from_tab); |
+ content::WebContents* from_tab, |
+ std::string default_video_codec) const { |
+ if (default_video_codec.empty()) |
+ default_video_codec = "null"; |
+ else |
+ default_video_codec = "'" + default_video_codec + "'"; |
+ std::string javascript = base::StringPrintf( |
+ "createLocalOffer({}, %s)", default_video_codec.c_str()); |
+ std::string response = ExecuteJavascript(javascript, from_tab); |
EXPECT_EQ("ok-", response.substr(0, 3)) << "Failed to create local offer: " |
<< response; |
@@ -345,8 +352,10 @@ |
return local_offer; |
} |
-std::string WebRtcTestBase::CreateAnswer(std::string local_offer, |
- content::WebContents* to_tab) const { |
+std::string WebRtcTestBase::CreateAnswer( |
+ std::string local_offer, |
+ content::WebContents* to_tab, |
+ std::string default_video_codec) const { |
std::string javascript = |
base::StringPrintf("receiveOfferFromPeer('%s', {})", local_offer.c_str()); |
std::string response = ExecuteJavascript(javascript, to_tab); |
@@ -355,11 +364,17 @@ |
<< response; |
std::string answer = response.substr(3); |
- response = ExecuteJavascript( |
- base::StringPrintf("verifyDefaultVideoCodec('%s')", answer.c_str()), |
- to_tab); |
- EXPECT_EQ("ok-", response.substr(0, 3)) |
- << "Receiving peer failed to verify default codec: " << response; |
+ |
+ if (!default_video_codec.empty()) { |
+ response = ExecuteJavascript( |
+ base::StringPrintf("verifyDefaultVideoCodec('%s', '%s')", |
+ answer.c_str(), default_video_codec.c_str()), |
+ to_tab); |
+ EXPECT_EQ("ok-", response.substr(0, 3)) |
+ << "Receiving peer failed to verify default codec: " |
+ << response; |
+ } |
+ |
return answer; |
} |
@@ -384,9 +399,10 @@ |
} |
void WebRtcTestBase::NegotiateCall(content::WebContents* from_tab, |
- content::WebContents* to_tab) const { |
- std::string local_offer = CreateLocalOffer(from_tab); |
- std::string answer = CreateAnswer(local_offer, to_tab); |
+ content::WebContents* to_tab, |
+ const std::string& video_codec) const { |
+ std::string local_offer = CreateLocalOffer(from_tab, video_codec); |
+ std::string answer = CreateAnswer(local_offer, to_tab, video_codec); |
ReceiveAnswer(answer, from_tab); |
// Send all ICE candidates (wait for gathering to finish if necessary). |
@@ -469,14 +485,3 @@ |
EXPECT_EQ("ok-generated-and-cloned", response) << "Failed to generate and " |
"clone certificate: " << response; |
} |
- |
-void WebRtcTestBase::SetDefaultVideoCodec( |
- content::WebContents* tab, |
- const std::string& video_codec) const { |
- EXPECT_EQ("ok-forced", |
- ExecuteJavascript("forceVideoCodec('" + video_codec + "')", tab)); |
-} |
- |
-void WebRtcTestBase::EnableOpusDtx(content::WebContents* tab) const { |
- EXPECT_EQ("ok-forced", ExecuteJavascript("forceOpusDtx()", tab)); |
-} |