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

Unified Diff: webrtc/api/webrtcsession_unittest.cc

Issue 1919523002: Fix the flaky WebRtcSessionTest.TestRtxRemovedByCreateAnswer. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Create helper function to determine if the SessionDescriptionContains rtx codec. Created 4 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/webrtcsession_unittest.cc
diff --git a/webrtc/api/webrtcsession_unittest.cc b/webrtc/api/webrtcsession_unittest.cc
index feb1518db0114b6591ec483b5ffecb152dba9b7d..9f518244b022f583f8d194fce22b7310a0e77a0c 100644
--- a/webrtc/api/webrtcsession_unittest.cc
+++ b/webrtc/api/webrtcsession_unittest.cc
@@ -1113,6 +1113,21 @@ class WebRtcSessionTest
EXPECT_EQ(can, session_->CanInsertDtmf(kAudioTrack1));
}
+ bool DescriptionContainsRtxCodec(const SessionDescriptionInterface* desc) {
+ for (const auto& content : desc->description()->contents()) {
+ if (static_cast<cricket::MediaContentDescription*>(content.description)
+ ->type() == cricket::MEDIA_TYPE_VIDEO) {
+ const auto* mdesc =
+ static_cast<cricket::VideoContentDescription*>(content.description);
+ for (const auto& codec : mdesc->codecs()) {
+ if (codec.name == "rtx") {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
// Helper class to configure loopback network and verify Best
// Connection using right IP protocol for TestLoopbackCall
// method. LoopbackNetworkManager applies firewall rules to block
@@ -4284,15 +4299,9 @@ TEST_P(WebRtcSessionTest, TestRenegotiateNewMediaWithCandidatesSeparated) {
SetLocalDescriptionWithoutError(answer);
}
-// Flaky on Win and Mac only. See webrtc:4943
-#if defined(WEBRTC_WIN) || defined(WEBRTC_MAC)
-#define MAYBE_TestRtxRemovedByCreateAnswer DISABLED_TestRtxRemovedByCreateAnswer
-#else
-#define MAYBE_TestRtxRemovedByCreateAnswer TestRtxRemovedByCreateAnswer
-#endif
// Tests that RTX codec is removed from the answer when it isn't supported
// by local side.
-TEST_F(WebRtcSessionTest, MAYBE_TestRtxRemovedByCreateAnswer) {
+TEST_F(WebRtcSessionTest, TestRtxRemovedByCreateAnswer) {
Init();
SendAudioVideoStream1();
std::string offer_sdp(kSdpWithRtx);
@@ -4302,15 +4311,13 @@ TEST_F(WebRtcSessionTest, MAYBE_TestRtxRemovedByCreateAnswer) {
EXPECT_TRUE(offer->ToString(&offer_sdp));
// Offer SDP contains the RTX codec.
- EXPECT_TRUE(offer_sdp.find("rtx") != std::string::npos);
+ EXPECT_TRUE(DescriptionContainsRtxCodec(offer));
SetRemoteDescriptionWithoutError(offer);
SessionDescriptionInterface* answer = CreateAnswer();
- std::string answer_sdp;
- answer->ToString(&answer_sdp);
- // Answer SDP removes the unsupported RTX codec.
- EXPECT_TRUE(answer_sdp.find("rtx") == std::string::npos);
SetLocalDescriptionWithoutError(answer);
+ // Answer SDP does not contain the RTX codec.
+ EXPECT_FALSE(DescriptionContainsRtxCodec(answer));
Taylor Brandstetter 2016/04/23 01:25:40 nit: Can you move this back to before "SetLocalDes
}
// This verifies that the voice channel after bundle has both options from video
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698