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

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

Issue 1275703006: Bug 4517: Enable connectivity for demo page when no STUN/TURN specifiefd. (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
Index: webrtc/p2p/client/portallocator_unittest.cc
diff --git a/webrtc/p2p/client/portallocator_unittest.cc b/webrtc/p2p/client/portallocator_unittest.cc
index 8735eb0c5ae83c543184e1f9027fa46a6779ad58..075e631d230bf39ad0dbb97ba063e3708fa5b654 100644
--- a/webrtc/p2p/client/portallocator_unittest.cc
+++ b/webrtc/p2p/client/portallocator_unittest.cc
@@ -1211,6 +1211,53 @@ TEST_F(PortAllocatorTest,
EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
}
+// Test that when adapter enumeration is disabled, even with
+// PORTALLOCATOR_ENABLE_LOCALHOST_CANDIDATE specified, for endpoints not behind
+// a NAT, there is only a single STUN candidate because a STUN server is
+// specified.
+TEST_F(PortAllocatorTest,
+ TestAdapterEnumerationDisabledWithoutNat_LocalhostFlagSpecified) {
+ AddInterfaceAsDefault(kClientAddr);
+ allocator_->set_flags(allocator().flags() |
+ cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG |
+ cricket::PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION |
+ cricket::PORTALLOCATOR_DISABLE_RELAY |
+ cricket::PORTALLOCATOR_DISABLE_TCP |
+ cricket::PORTALLOCATOR_ENABLE_LOCALHOST_CANDIDATE |
+ cricket::PORTALLOCATOR_ENABLE_SHARED_SOCKET);
+ EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP));
+ session_->StartGettingPorts();
+ EXPECT_TRUE_WAIT(1U == ports_.size(), kDefaultAllocationTimeout);
+ EXPECT_PRED5(CheckCandidate, candidates_[0],
+ cricket::ICE_CANDIDATE_COMPONENT_RTP, "stun", "udp",
+ kClientAddr);
+ EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
+}
+
+// Test that when adapter enumeration is disabled, with
+// PORTALLOCATOR_ENABLE_LOCALHOST_CANDIDATE specified, a localhost candidate
+// is generated because no STUN/TURN servers are specified.
+TEST_F(PortAllocatorTest,
+ TestAdapterEnumerationDisabledWithoutNat_LocalhostCandidate) {
+ AddInterfaceAsDefault(kClientAddr);
+ ResetWithNoServers();
+ allocator_->set_flags(allocator().flags() |
+ cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG |
+ cricket::PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION |
+ cricket::PORTALLOCATOR_DISABLE_RELAY |
+ cricket::PORTALLOCATOR_DISABLE_TCP |
+ cricket::PORTALLOCATOR_ENABLE_LOCALHOST_CANDIDATE |
+ cricket::PORTALLOCATOR_ENABLE_SHARED_SOCKET);
+ EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP));
+ session_->StartGettingPorts();
+ EXPECT_TRUE_WAIT(1U == ports_.size(), kDefaultAllocationTimeout);
+ EXPECT_EQ(candidates_.size(), 1u);
+ EXPECT_PRED5(CheckCandidate, candidates_[0],
+ cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "udp",
+ rtc::SocketAddress(rtc::GetLoopbackIP(AF_INET), 0));
+ EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
+}
+
class AllocationSequenceForTest : public cricket::AllocationSequence {
public:
AllocationSequenceForTest(cricket::BasicPortAllocatorSession* session,
« webrtc/p2p/client/basicportallocator.cc ('K') | « webrtc/p2p/client/fakeportallocator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698