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

Unified Diff: webrtc/p2p/base/turnport_unittest.cc

Issue 2685053004: Add the URL attribute to cricket::Candiate. (Closed)
Patch Set: CR comments. Created 3 years, 10 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
« webrtc/p2p/base/turnport.cc ('K') | « webrtc/p2p/base/turnport.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/base/turnport_unittest.cc
diff --git a/webrtc/p2p/base/turnport_unittest.cc b/webrtc/p2p/base/turnport_unittest.cc
index 69b25ea0d8ef35a00e78eb312fd322cb76e35bee..7223eabbee1134d5d6153b28f9fed140d30595dc 100644
--- a/webrtc/p2p/base/turnport_unittest.cc
+++ b/webrtc/p2p/base/turnport_unittest.cc
@@ -647,6 +647,40 @@ TEST_F(TurnPortTest, TestTurnPortType) {
EXPECT_EQ(cricket::RELAY_PORT_TYPE, turn_port_->Type());
}
+// Tests that the URL of the servers can be correctly reconstructed when
+// gathering the candidates.
+TEST_F(TurnPortTest, TestReconstructedServerUrl) {
+ // Connect the TURN server using UDP.
+ CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr);
+ turn_port_->PrepareAddress();
+ EXPECT_TRUE_SIMULATED_WAIT(turn_ready_, kSimulatedRtt * 2, fake_clock_);
+ std::string expected_server_url = "turn:99.99.99.3:3478?transport=udp";
+ EXPECT_EQ(turn_port_->Candidates()[0].url(), expected_server_url);
+
+ // Connect the server with IPV6 using UDP.
+ turn_ready_ = false;
+ turn_server_.AddInternalSocket(kTurnUdpIPv6IntAddr, PROTO_UDP);
+ CreateTurnPort(kLocalIPv6Addr, kTurnUsername, kTurnPassword,
+ kTurnUdpIPv6ProtoAddr);
+ turn_port_->PrepareAddress();
+ EXPECT_TRUE_SIMULATED_WAIT(turn_ready_, kSimulatedRtt * 2, fake_clock_);
+ ASSERT_EQ(1U, turn_port_->Candidates().size());
+ expected_server_url =
+ "turn:2400:4030:1:2c00:be30:abcd:efab:cdef:3478?transport=udp";
+ EXPECT_EQ(turn_port_->Candidates()[0].url(), expected_server_url);
+
+ // Connection the server using TCP.
+ turn_ready_ = false;
+ turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP);
+ CreateTurnPort(kTurnUsername, kTurnPassword, kTurnTcpProtoAddr);
+ turn_port_->PrepareAddress();
+ EXPECT_TRUE_SIMULATED_WAIT(turn_ready_, kSimulatedRtt * 3, fake_clock_);
+ ASSERT_EQ(1U, turn_port_->Candidates().size());
+ expected_server_url = "turn:99.99.99.4:3478?transport=tcp";
+ EXPECT_EQ(turn_port_->Candidates()[0].url(), expected_server_url);
+ turn_ready_ = false;
+}
+
// Do a normal TURN allocation.
TEST_F(TurnPortTest, TestTurnAllocate) {
CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr);
« webrtc/p2p/base/turnport.cc ('K') | « webrtc/p2p/base/turnport.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698