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

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

Issue 2190533002: Adds a WebRTC browser_test with opus dtx enabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Last comments by Minyue. Created 4 years, 5 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/browser/media/webrtc_browsertest_perf.cc » ('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 2213da9f1c64c33f069546e4b51c8d60692b5003..58ccdc445c72a24cd8b3ad2ee5dfcf87afa9ce69 100644
--- a/chrome/browser/media/webrtc_browsertest_base.cc
+++ b/chrome/browser/media/webrtc_browsertest_base.cc
@@ -336,15 +336,8 @@ void WebRtcTestBase::SetupPeerconnectionWithCertificateWithoutLocalStream(
}
std::string WebRtcTestBase::CreateLocalOffer(
- 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);
+ content::WebContents* from_tab) const {
+ std::string response = ExecuteJavascript("createLocalOffer({})", from_tab);
EXPECT_EQ("ok-", response.substr(0, 3)) << "Failed to create local offer: "
<< response;
@@ -352,10 +345,8 @@ std::string WebRtcTestBase::CreateLocalOffer(
return local_offer;
}
-std::string WebRtcTestBase::CreateAnswer(
- std::string local_offer,
- content::WebContents* to_tab,
- std::string default_video_codec) const {
+std::string WebRtcTestBase::CreateAnswer(std::string local_offer,
+ content::WebContents* to_tab) const {
std::string javascript =
base::StringPrintf("receiveOfferFromPeer('%s', {})", local_offer.c_str());
std::string response = ExecuteJavascript(javascript, to_tab);
@@ -364,17 +355,11 @@ std::string WebRtcTestBase::CreateAnswer(
<< 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;
- }
-
+ 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;
return answer;
}
@@ -399,10 +384,9 @@ void WebRtcTestBase::GatherAndSendIceCandidates(
}
void WebRtcTestBase::NegotiateCall(content::WebContents* from_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);
+ content::WebContents* to_tab) const {
+ std::string local_offer = CreateLocalOffer(from_tab);
+ std::string answer = CreateAnswer(local_offer, to_tab);
ReceiveAnswer(answer, from_tab);
// Send all ICE candidates (wait for gathering to finish if necessary).
@@ -485,3 +469,14 @@ void WebRtcTestBase::GenerateAndCloneCertificate(
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));
+}
« no previous file with comments | « chrome/browser/media/webrtc_browsertest_base.h ('k') | chrome/browser/media/webrtc_browsertest_perf.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698