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

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
« webrtc/p2p/base/portallocator.h ('K') | « 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..4a404fb612d847d3f47534363413f428e36a9b0c 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, only TCP is used when connecting to the
pthatcher1 2015/08/26 17:27:53 UDP, only => UDP, and only
+// 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(
+ session_->flags() | cricket::PORTALLOCATOR_DISABLE_UDP_RELAY |
+ cricket::PORTALLOCATOR_DISABLE_UDP | cricket::PORTALLOCATOR_DISABLE_STUN |
+ cricket::PORTALLOCATOR_ENABLE_SHARED_SOCKET);
pthatcher1 2015/08/26 17:27:53 Did you run "git cl format" on this?
guoweis_webrtc 2015/08/26 20:31:36 yeah, it was git cl format did that.
+
+ session_->StartGettingPorts();
+ EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
+
+ // Expect to see 2 ports - TURN/TCP and TCP port. TCP and TURN/TCP
+ // candidates.
pthatcher1 2015/08/26 17:27:53 2 ports => 2 ports and 2 candidates TURN/TCP and T
+ 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)
« webrtc/p2p/base/portallocator.h ('K') | « webrtc/p2p/client/basicportallocator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698