OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2009 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 // Test that we don't crash or malfunction if we have no network adapters. | 578 // Test that we don't crash or malfunction if we have no network adapters. |
579 TEST_F(PortAllocatorTest, TestGetAllPortsNoAdapters) { | 579 TEST_F(PortAllocatorTest, TestGetAllPortsNoAdapters) { |
580 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP)); | 580 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP)); |
581 session_->StartGettingPorts(); | 581 session_->StartGettingPorts(); |
582 rtc::Thread::Current()->ProcessMessages(100); | 582 rtc::Thread::Current()->ProcessMessages(100); |
583 // Without network adapter, we should not get any candidate. | 583 // Without network adapter, we should not get any candidate. |
584 EXPECT_EQ(0U, candidates_.size()); | 584 EXPECT_EQ(0U, candidates_.size()); |
585 EXPECT_TRUE(candidate_allocation_done_); | 585 EXPECT_TRUE(candidate_allocation_done_); |
586 } | 586 } |
587 | 587 |
| 588 // Test that when enumeration is disabled, we should not have any ports when |
| 589 // candidate_filter() is set to CF_RELAY and no relay is specified. |
| 590 TEST_F(PortAllocatorTest, |
| 591 TestDisableAdapterEnumerationWithoutNatRelayTransportOnly) { |
| 592 AddInterfaceAsDefaultRoute(kClientAddr); |
| 593 ResetWithStunServerNoNat(kStunAddr); |
| 594 allocator().set_candidate_filter(cricket::CF_RELAY); |
| 595 // Expect to see no ports and no candidates. |
| 596 CheckDisableAdapterEnumeration(0U, rtc::IPAddress(), rtc::IPAddress(), |
| 597 rtc::IPAddress(), rtc::IPAddress()); |
| 598 } |
| 599 |
588 // Test that we should only get STUN and TURN candidates when adapter | 600 // Test that we should only get STUN and TURN candidates when adapter |
589 // enumeration is disabled. | 601 // enumeration is disabled. |
590 TEST_F(PortAllocatorTest, TestDisableAdapterEnumerationBehindNat) { | 602 TEST_F(PortAllocatorTest, TestDisableAdapterEnumerationBehindNat) { |
591 AddInterface(kClientAddr); | 603 AddInterface(kClientAddr); |
592 // GTURN is not configured here. | 604 // GTURN is not configured here. |
593 ResetWithStunServerAndNat(kStunAddr); | 605 ResetWithStunServerAndNat(kStunAddr); |
594 AddTurnServers(kTurnUdpIntAddr, rtc::SocketAddress()); | 606 AddTurnServers(kTurnUdpIntAddr, rtc::SocketAddress()); |
595 // Expect to see 3 ports: STUN, TURN/UDP and TCP ports, and both STUN and | 607 // Expect to see 3 ports: STUN, TURN/UDP and TCP ports, and both STUN and |
596 // TURN/UDP candidates. | 608 // TURN/UDP candidates. |
597 CheckDisableAdapterEnumeration(3U, rtc::IPAddress(), kNatUdpAddr.ipaddr(), | 609 CheckDisableAdapterEnumeration(3U, rtc::IPAddress(), kNatUdpAddr.ipaddr(), |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1314 | 1326 |
1315 // After clearing getting ports, adding a new interface will start getting | 1327 // After clearing getting ports, adding a new interface will start getting |
1316 // ports again. | 1328 // ports again. |
1317 candidates_.clear(); | 1329 candidates_.clear(); |
1318 ports_.clear(); | 1330 ports_.clear(); |
1319 candidate_allocation_done_ = false; | 1331 candidate_allocation_done_ = false; |
1320 network_manager_.AddInterface(kClientAddr2); | 1332 network_manager_.AddInterface(kClientAddr2); |
1321 ASSERT_EQ_WAIT(2U, candidates_.size(), 1000); | 1333 ASSERT_EQ_WAIT(2U, candidates_.size(), 1000); |
1322 EXPECT_EQ(2U, ports_.size()); | 1334 EXPECT_EQ(2U, ports_.size()); |
1323 } | 1335 } |
OLD | NEW |