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 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1583 // Test that a connection succeeds when the P2PTransportChannel uses a pooled | 1583 // Test that a connection succeeds when the P2PTransportChannel uses a pooled |
1584 // PortAllocatorSession that has not yet finished gathering candidates. | 1584 // PortAllocatorSession that has not yet finished gathering candidates. |
1585 TEST_F(P2PTransportChannelTest, TestUsingPooledSessionBeforeDoneGathering) { | 1585 TEST_F(P2PTransportChannelTest, TestUsingPooledSessionBeforeDoneGathering) { |
1586 ConfigureEndpoints(OPEN, OPEN, kDefaultPortAllocatorFlags, | 1586 ConfigureEndpoints(OPEN, OPEN, kDefaultPortAllocatorFlags, |
1587 kDefaultPortAllocatorFlags); | 1587 kDefaultPortAllocatorFlags); |
1588 // First create a pooled session for each endpoint. | 1588 // First create a pooled session for each endpoint. |
1589 auto& allocator_1 = GetEndpoint(0)->allocator_; | 1589 auto& allocator_1 = GetEndpoint(0)->allocator_; |
1590 auto& allocator_2 = GetEndpoint(1)->allocator_; | 1590 auto& allocator_2 = GetEndpoint(1)->allocator_; |
1591 int pool_size = 1; | 1591 int pool_size = 1; |
1592 allocator_1->SetConfiguration(allocator_1->stun_servers(), | 1592 allocator_1->SetConfiguration(allocator_1->stun_servers(), |
1593 allocator_1->turn_servers(), pool_size, false); | 1593 allocator_1->turn_servers(), pool_size); |
1594 allocator_2->SetConfiguration(allocator_2->stun_servers(), | 1594 allocator_2->SetConfiguration(allocator_2->stun_servers(), |
1595 allocator_2->turn_servers(), pool_size, false); | 1595 allocator_2->turn_servers(), pool_size); |
1596 const PortAllocatorSession* pooled_session_1 = | 1596 const PortAllocatorSession* pooled_session_1 = |
1597 allocator_1->GetPooledSession(); | 1597 allocator_1->GetPooledSession(); |
1598 const PortAllocatorSession* pooled_session_2 = | 1598 const PortAllocatorSession* pooled_session_2 = |
1599 allocator_2->GetPooledSession(); | 1599 allocator_2->GetPooledSession(); |
1600 ASSERT_NE(nullptr, pooled_session_1); | 1600 ASSERT_NE(nullptr, pooled_session_1); |
1601 ASSERT_NE(nullptr, pooled_session_2); | 1601 ASSERT_NE(nullptr, pooled_session_2); |
1602 // Sanity check that pooled sessions haven't gathered anything yet. | 1602 // Sanity check that pooled sessions haven't gathered anything yet. |
1603 EXPECT_TRUE(pooled_session_1->ReadyPorts().empty()); | 1603 EXPECT_TRUE(pooled_session_1->ReadyPorts().empty()); |
1604 EXPECT_TRUE(pooled_session_1->ReadyCandidates().empty()); | 1604 EXPECT_TRUE(pooled_session_1->ReadyCandidates().empty()); |
1605 EXPECT_TRUE(pooled_session_2->ReadyPorts().empty()); | 1605 EXPECT_TRUE(pooled_session_2->ReadyPorts().empty()); |
(...skipping 20 matching lines...) Expand all Loading... |
1626 // Test that a connection succeeds when the P2PTransportChannel uses a pooled | 1626 // Test that a connection succeeds when the P2PTransportChannel uses a pooled |
1627 // PortAllocatorSession that already finished gathering candidates. | 1627 // PortAllocatorSession that already finished gathering candidates. |
1628 TEST_F(P2PTransportChannelTest, TestUsingPooledSessionAfterDoneGathering) { | 1628 TEST_F(P2PTransportChannelTest, TestUsingPooledSessionAfterDoneGathering) { |
1629 ConfigureEndpoints(OPEN, OPEN, kDefaultPortAllocatorFlags, | 1629 ConfigureEndpoints(OPEN, OPEN, kDefaultPortAllocatorFlags, |
1630 kDefaultPortAllocatorFlags); | 1630 kDefaultPortAllocatorFlags); |
1631 // First create a pooled session for each endpoint. | 1631 // First create a pooled session for each endpoint. |
1632 auto& allocator_1 = GetEndpoint(0)->allocator_; | 1632 auto& allocator_1 = GetEndpoint(0)->allocator_; |
1633 auto& allocator_2 = GetEndpoint(1)->allocator_; | 1633 auto& allocator_2 = GetEndpoint(1)->allocator_; |
1634 int pool_size = 1; | 1634 int pool_size = 1; |
1635 allocator_1->SetConfiguration(allocator_1->stun_servers(), | 1635 allocator_1->SetConfiguration(allocator_1->stun_servers(), |
1636 allocator_1->turn_servers(), pool_size, false); | 1636 allocator_1->turn_servers(), pool_size); |
1637 allocator_2->SetConfiguration(allocator_2->stun_servers(), | 1637 allocator_2->SetConfiguration(allocator_2->stun_servers(), |
1638 allocator_2->turn_servers(), pool_size, false); | 1638 allocator_2->turn_servers(), pool_size); |
1639 const PortAllocatorSession* pooled_session_1 = | 1639 const PortAllocatorSession* pooled_session_1 = |
1640 allocator_1->GetPooledSession(); | 1640 allocator_1->GetPooledSession(); |
1641 const PortAllocatorSession* pooled_session_2 = | 1641 const PortAllocatorSession* pooled_session_2 = |
1642 allocator_2->GetPooledSession(); | 1642 allocator_2->GetPooledSession(); |
1643 ASSERT_NE(nullptr, pooled_session_1); | 1643 ASSERT_NE(nullptr, pooled_session_1); |
1644 ASSERT_NE(nullptr, pooled_session_2); | 1644 ASSERT_NE(nullptr, pooled_session_2); |
1645 // Wait for the pooled sessions to finish gathering before the | 1645 // Wait for the pooled sessions to finish gathering before the |
1646 // P2PTransportChannels try to use them. | 1646 // P2PTransportChannels try to use them. |
1647 EXPECT_TRUE_WAIT(pooled_session_1->CandidatesAllocationDone() && | 1647 EXPECT_TRUE_WAIT(pooled_session_1->CandidatesAllocationDone() && |
1648 pooled_session_2->CandidatesAllocationDone(), | 1648 pooled_session_2->CandidatesAllocationDone(), |
(...skipping 1830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3479 | 3479 |
3480 // TCP Relay/Relay is the next. | 3480 // TCP Relay/Relay is the next. |
3481 VerifyNextPingableConnection(RELAY_PORT_TYPE, RELAY_PORT_TYPE, | 3481 VerifyNextPingableConnection(RELAY_PORT_TYPE, RELAY_PORT_TYPE, |
3482 TCP_PROTOCOL_NAME); | 3482 TCP_PROTOCOL_NAME); |
3483 | 3483 |
3484 // Finally, Local/Relay will be pinged. | 3484 // Finally, Local/Relay will be pinged. |
3485 VerifyNextPingableConnection(LOCAL_PORT_TYPE, RELAY_PORT_TYPE); | 3485 VerifyNextPingableConnection(LOCAL_PORT_TYPE, RELAY_PORT_TYPE); |
3486 } | 3486 } |
3487 | 3487 |
3488 } // namespace cricket { | 3488 } // namespace cricket { |
OLD | NEW |