Chromium Code Reviews| 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..4ae1c822002c7743a3fc9f3c3f0ba0cde00acf8e 100644 |
| --- a/chrome/browser/media/webrtc_browsertest_base.cc |
| +++ b/chrome/browser/media/webrtc_browsertest_base.cc |
| @@ -335,15 +335,16 @@ void WebRtcTestBase::SetupPeerconnectionWithCertificateWithoutLocalStream( |
| EXPECT_EQ("ok-peerconnection-created", ExecuteJavascript(javascript, tab)); |
| } |
| -std::string WebRtcTestBase::CreateLocalOffer( |
| - content::WebContents* from_tab, |
| - std::string default_video_codec) const { |
| +std::string WebRtcTestBase::CreateLocalOffer(content::WebContents* from_tab, |
|
phoglund_chromium
2016/07/27 09:15:05
I'm concerned this is going to go out of control i
Ivo-OOO until feb 6
2016/07/27 14:12:43
Good point, I implemented option 2.
|
| + std::string default_video_codec, |
| + bool opus_dtx) 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 javascript = base::StringPrintf("createLocalOffer({}, %s, %s)", |
| + default_video_codec.c_str(), |
| + opus_dtx ? "true" : "false"); |
| std::string response = ExecuteJavascript(javascript, from_tab); |
| EXPECT_EQ("ok-", response.substr(0, 3)) << "Failed to create local offer: " |
| << response; |
| @@ -352,12 +353,13 @@ 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, |
| + std::string default_video_codec, |
| + bool opus_dtx) const { |
| std::string javascript = |
| - base::StringPrintf("receiveOfferFromPeer('%s', {})", local_offer.c_str()); |
| + base::StringPrintf("receiveOfferFromPeer('%s', {}, %s)", |
| + local_offer.c_str(), opus_dtx ? "true" : "false"); |
| std::string response = ExecuteJavascript(javascript, to_tab); |
| EXPECT_EQ("ok-", response.substr(0, 3)) |
| << "Receiving peer failed to receive offer and create answer: " |
| @@ -374,6 +376,13 @@ std::string WebRtcTestBase::CreateAnswer( |
| << "Receiving peer failed to verify default codec: " |
| << response; |
| } |
| + if (opus_dtx) { |
| + response = ExecuteJavascript( |
| + base::StringPrintf("verifyOpusDtxEnabled('%s')", answer.c_str()), |
| + to_tab); |
| + EXPECT_EQ("ok-", response.substr(0, 3)) |
|
phoglund_chromium
2016/07/27 09:15:05
Just check ok-verified. In the above the response
Ivo-OOO until feb 6
2016/07/27 14:12:43
I moved this code to the javascript side, so this
|
| + << "Receiving peer failed to verify opus dtx: " << response; |
| + } |
| return answer; |
| } |
| @@ -400,9 +409,10 @@ 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); |
| + const std::string& video_codec, |
| + bool opus_dtx) const { |
| + std::string local_offer = CreateLocalOffer(from_tab, video_codec, opus_dtx); |
| + std::string answer = CreateAnswer(local_offer, to_tab, video_codec, opus_dtx); |
| ReceiveAnswer(answer, from_tab); |
| // Send all ICE candidates (wait for gathering to finish if necessary). |