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

Unified Diff: webrtc/api/webrtcsdp_unittest.cc

Issue 1815473002: Add 16-bit network id to the candidate signaling. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Remove the old NETWORK_COST attribute. Created 4 years, 9 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 | « webrtc/api/webrtcsdp.cc ('k') | webrtc/base/network.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/webrtcsdp_unittest.cc
diff --git a/webrtc/api/webrtcsdp_unittest.cc b/webrtc/api/webrtcsdp_unittest.cc
index 95597016420f54d14acde1e60c8f7a5004f75a14..c52720453b7021042760dabc688efd5768dc94fd 100644
--- a/webrtc/api/webrtcsdp_unittest.cc
+++ b/webrtc/api/webrtcsdp_unittest.cc
@@ -2058,6 +2058,19 @@ TEST_F(WebRtcSdpTest, SerializeCandidates) {
candidate_with_ufrag));
message = webrtc::SdpSerializeCandidate(*jcandidate_);
EXPECT_EQ(std::string(kRawCandidate) + " ufrag ABC", message);
+
+ Candidate candidate_with_network_info(candidates_.front());
+ candidate_with_network_info.set_network_id(1);
+ jcandidate_.reset(new JsepIceCandidate(std::string("audio"), 0,
+ candidate_with_network_info));
+ message = webrtc::SdpSerializeCandidate(*jcandidate_);
+ EXPECT_EQ(std::string(kRawCandidate) + " network-id 1", message);
+ candidate_with_network_info.set_network_cost(999);
+ jcandidate_.reset(new JsepIceCandidate(std::string("audio"), 0,
+ candidate_with_network_info));
+ message = webrtc::SdpSerializeCandidate(*jcandidate_);
+ EXPECT_EQ(std::string(kRawCandidate) + " network-id 1 network-cost 999",
+ message);
}
// TODO(mallinath) : Enable this test once WebRTCSdp capable of parsing
@@ -2325,6 +2338,7 @@ TEST_F(WebRtcSdpTest, DeserializeCandidate) {
EXPECT_EQ(kDummyMid, jcandidate.sdp_mid());
EXPECT_EQ(kDummyIndex, jcandidate.sdp_mline_index());
EXPECT_TRUE(jcandidate.candidate().IsEquivalent(jcandidate_->candidate()));
+ EXPECT_EQ(0, jcandidate.candidate().network_cost());
// Candidate line without generation extension.
sdp = kSdpOneCandidate;
@@ -2336,6 +2350,22 @@ TEST_F(WebRtcSdpTest, DeserializeCandidate) {
expected.set_generation(0);
EXPECT_TRUE(jcandidate.candidate().IsEquivalent(expected));
+ // Candidate with network id and/or cost.
+ sdp = kSdpOneCandidate;
+ Replace(" generation 2", " generation 2 network-id 2", &sdp);
+ EXPECT_TRUE(SdpDeserializeCandidate(sdp, &jcandidate));
+ EXPECT_EQ(kDummyMid, jcandidate.sdp_mid());
+ EXPECT_EQ(kDummyIndex, jcandidate.sdp_mline_index());
+ expected = jcandidate_->candidate();
+ expected.set_network_id(2);
+ EXPECT_TRUE(jcandidate.candidate().IsEquivalent(expected));
+ EXPECT_EQ(0, jcandidate.candidate().network_cost());
+ // Add network cost
+ Replace(" network-id 2", " network-id 2 network-cost 9", &sdp);
+ EXPECT_TRUE(SdpDeserializeCandidate(sdp, &jcandidate));
+ EXPECT_TRUE(jcandidate.candidate().IsEquivalent(expected));
+ EXPECT_EQ(9, jcandidate.candidate().network_cost());
+
sdp = kSdpTcpActiveCandidate;
EXPECT_TRUE(SdpDeserializeCandidate(sdp, &jcandidate));
// Make a cricket::Candidate equivalent to kSdpTcpCandidate string.
« no previous file with comments | « webrtc/api/webrtcsdp.cc ('k') | webrtc/base/network.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698