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

Unified Diff: chrome/browser/media/webrtc_browsertest_base.cc

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: knitted the nits 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
« no previous file with comments | « chrome/browser/media/webrtc_browsertest_base.h ('k') | chrome/test/data/webrtc/munge_sdp.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 01788c7d229840e347fe18e3f8b5e0cf06352ccd..378c80d7887f9c605407c735b806e98d967f660e 100644
--- a/chrome/browser/media/webrtc_browsertest_base.cc
+++ b/chrome/browser/media/webrtc_browsertest_base.cc
@@ -315,8 +315,15 @@ void WebRtcTestBase::SetupPeerconnectionWithoutLocalStream(
}
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;
@@ -324,8 +331,10 @@ std::string WebRtcTestBase::CreateLocalOffer(
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);
@@ -334,6 +343,17 @@ std::string WebRtcTestBase::CreateAnswer(std::string local_offer,
<< response;
std::string answer = response.substr(3);
+
+ 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;
}
@@ -358,9 +378,10 @@ void WebRtcTestBase::GatherAndSendIceCandidates(
}
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).
« no previous file with comments | « chrome/browser/media/webrtc_browsertest_base.h ('k') | chrome/test/data/webrtc/munge_sdp.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698