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 1590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1601 allocator_->set_step_delay(kDefaultStepDelay); | 1601 allocator_->set_step_delay(kDefaultStepDelay); |
1602 EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP)); | 1602 EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP)); |
1603 session_->StartGettingPorts(); | 1603 session_->StartGettingPorts(); |
1604 ASSERT_EQ_WAIT(2U, candidates_.size(), 1000); | 1604 ASSERT_EQ_WAIT(2U, candidates_.size(), 1000); |
1605 EXPECT_EQ(2U, ports_.size()); | 1605 EXPECT_EQ(2U, ports_.size()); |
1606 session_->StopGettingPorts(); | 1606 session_->StopGettingPorts(); |
1607 EXPECT_TRUE_WAIT(candidate_allocation_done_, 1000); | 1607 EXPECT_TRUE_WAIT(candidate_allocation_done_, 1000); |
1608 | 1608 |
1609 // After stopping getting ports, adding a new interface will not start | 1609 // After stopping getting ports, adding a new interface will not start |
1610 // getting ports again. | 1610 // getting ports again. |
| 1611 allocator_->set_step_delay(kMinimumStepDelay); |
1611 candidates_.clear(); | 1612 candidates_.clear(); |
1612 ports_.clear(); | 1613 ports_.clear(); |
1613 candidate_allocation_done_ = false; | 1614 candidate_allocation_done_ = false; |
1614 network_manager_.AddInterface(kClientAddr2); | 1615 network_manager_.AddInterface(kClientAddr2); |
1615 rtc::Thread::Current()->ProcessMessages(1000); | 1616 rtc::Thread::Current()->ProcessMessages(1000); |
1616 EXPECT_EQ(0U, candidates_.size()); | 1617 EXPECT_EQ(0U, candidates_.size()); |
1617 EXPECT_EQ(0U, ports_.size()); | 1618 EXPECT_EQ(0U, ports_.size()); |
1618 } | 1619 } |
1619 | 1620 |
1620 TEST_F(BasicPortAllocatorTest, TestClearGettingPorts) { | 1621 TEST_F(BasicPortAllocatorTest, TestClearGettingPorts) { |
1621 AddInterface(kClientAddr); | 1622 AddInterface(kClientAddr); |
1622 allocator_->set_step_delay(kDefaultStepDelay); | 1623 allocator_->set_step_delay(kDefaultStepDelay); |
1623 EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP)); | 1624 EXPECT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP)); |
1624 session_->StartGettingPorts(); | 1625 session_->StartGettingPorts(); |
1625 ASSERT_EQ_WAIT(2U, candidates_.size(), 1000); | 1626 ASSERT_EQ_WAIT(2U, candidates_.size(), 1000); |
1626 EXPECT_EQ(2U, ports_.size()); | 1627 EXPECT_EQ(2U, ports_.size()); |
1627 session_->ClearGettingPorts(); | 1628 session_->ClearGettingPorts(); |
1628 WAIT(candidate_allocation_done_, 1000); | 1629 EXPECT_TRUE_WAIT(candidate_allocation_done_, 1000); |
1629 EXPECT_FALSE(candidate_allocation_done_); | |
1630 | 1630 |
1631 // After clearing getting ports, adding a new interface will start getting | 1631 // After clearing getting ports, adding a new interface will start getting |
1632 // ports again. | 1632 // ports again. |
| 1633 allocator_->set_step_delay(kMinimumStepDelay); |
1633 candidates_.clear(); | 1634 candidates_.clear(); |
1634 ports_.clear(); | 1635 ports_.clear(); |
1635 candidate_allocation_done_ = false; | 1636 candidate_allocation_done_ = false; |
1636 network_manager_.AddInterface(kClientAddr2); | 1637 network_manager_.AddInterface(kClientAddr2); |
1637 ASSERT_EQ_WAIT(2U, candidates_.size(), 1000); | 1638 ASSERT_EQ_WAIT(2U, candidates_.size(), 1000); |
1638 EXPECT_EQ(2U, ports_.size()); | 1639 EXPECT_EQ(2U, ports_.size()); |
| 1640 EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout); |
1639 } | 1641 } |
1640 | 1642 |
1641 // Test that the ports and candidates are updated with new ufrag/pwd/etc. when | 1643 // Test that the ports and candidates are updated with new ufrag/pwd/etc. when |
1642 // a pooled session is taken out of the pool. | 1644 // a pooled session is taken out of the pool. |
1643 TEST_F(BasicPortAllocatorTest, TestTransportInformationUpdated) { | 1645 TEST_F(BasicPortAllocatorTest, TestTransportInformationUpdated) { |
1644 AddInterface(kClientAddr); | 1646 AddInterface(kClientAddr); |
1645 int pool_size = 1; | 1647 int pool_size = 1; |
1646 allocator_->SetConfiguration(allocator_->stun_servers(), | 1648 allocator_->SetConfiguration(allocator_->stun_servers(), |
1647 allocator_->turn_servers(), pool_size, false); | 1649 allocator_->turn_servers(), pool_size, false); |
1648 const PortAllocatorSession* peeked_session = allocator_->GetPooledSession(); | 1650 const PortAllocatorSession* peeked_session = allocator_->GetPooledSession(); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1705 for (const Candidate& candidate : candidates) { | 1707 for (const Candidate& candidate : candidates) { |
1706 // Expect only relay candidates now that the filter is applied. | 1708 // Expect only relay candidates now that the filter is applied. |
1707 EXPECT_EQ(std::string(RELAY_PORT_TYPE), candidate.type()); | 1709 EXPECT_EQ(std::string(RELAY_PORT_TYPE), candidate.type()); |
1708 // Expect that the raddr is emptied due to the CF_RELAY filter. | 1710 // Expect that the raddr is emptied due to the CF_RELAY filter. |
1709 EXPECT_EQ(candidate.related_address(), | 1711 EXPECT_EQ(candidate.related_address(), |
1710 rtc::EmptySocketAddressWithFamily(candidate.address().family())); | 1712 rtc::EmptySocketAddressWithFamily(candidate.address().family())); |
1711 } | 1713 } |
1712 } | 1714 } |
1713 | 1715 |
1714 } // namespace cricket | 1716 } // namespace cricket |
OLD | NEW |