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

Unified Diff: webrtc/p2p/client/portallocator_unittest.cc

Issue 1311153003: Add check to prevent TURN usage if the protocol is not allowed. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 years, 4 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/p2p/client/basicportallocator.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/client/portallocator_unittest.cc
diff --git a/webrtc/p2p/client/portallocator_unittest.cc b/webrtc/p2p/client/portallocator_unittest.cc
index 561442557312c717996910c187b5ca831cd0e7f1..7a52a2eff8a6711a31502bed3c12c190316392f4 100644
--- a/webrtc/p2p/client/portallocator_unittest.cc
+++ b/webrtc/p2p/client/portallocator_unittest.cc
@@ -606,6 +606,36 @@ TEST_F(PortAllocatorTest,
rtc::IPAddress());
}
+// Test that we disable relay over UDP, and only TCP is used when connecting to
+// the relay server.
+TEST_F(PortAllocatorTest, TestDisableUdpTurn) {
+ turn_server_.AddInternalSocket(kTurnTcpIntAddr, cricket::PROTO_TCP);
+ AddInterface(kClientAddr);
+ ResetWithStunServerAndNat(kStunAddr);
+ AddTurnServers(kTurnUdpIntAddr, kTurnTcpIntAddr);
+ EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP));
+ session_->set_flags(cricket::PORTALLOCATOR_DISABLE_UDP_RELAY |
+ cricket::PORTALLOCATOR_DISABLE_UDP |
+ cricket::PORTALLOCATOR_DISABLE_STUN |
+ cricket::PORTALLOCATOR_ENABLE_SHARED_SOCKET);
+
+ session_->StartGettingPorts();
+ EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
+
+ // Expect to see 2 ports and 2 candidates - TURN/TCP and TCP ports, TCP and
+ // TURN/TCP candidates.
+ EXPECT_EQ(2U, ports_.size());
+ EXPECT_EQ(2U, candidates_.size());
+ EXPECT_PRED5(CheckCandidate, candidates_[0],
+ cricket::ICE_CANDIDATE_COMPONENT_RTP, "relay", "udp",
+ kTurnUdpExtAddr);
+ // The TURN candidate should use TCP to contact the TURN server.
+ EXPECT_EQ(cricket::TCP_PROTOCOL_NAME, candidates_[0].relay_protocol());
+ EXPECT_PRED5(CheckCandidate, candidates_[1],
+ cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "tcp",
+ kClientAddr);
+}
+
// Disable for asan, see
// https://code.google.com/p/webrtc/issues/detail?id=4743 for details.
#if !defined(ADDRESS_SANITIZER)
« no previous file with comments | « webrtc/p2p/client/basicportallocator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698