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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 Endpoint() | 285 Endpoint() |
286 : role_(ICEROLE_UNKNOWN), | 286 : role_(ICEROLE_UNKNOWN), |
287 tiebreaker_(0), | 287 tiebreaker_(0), |
288 role_conflict_(false), | 288 role_conflict_(false), |
289 save_candidates_(false) {} | 289 save_candidates_(false) {} |
290 bool HasTransport(const rtc::PacketTransportInternal* transport) { | 290 bool HasTransport(const rtc::PacketTransportInternal* transport) { |
291 return (transport == cd1_.ch_.get() || transport == cd2_.ch_.get()); | 291 return (transport == cd1_.ch_.get() || transport == cd2_.ch_.get()); |
292 } | 292 } |
293 ChannelData* GetChannelData(rtc::PacketTransportInternal* transport) { | 293 ChannelData* GetChannelData(rtc::PacketTransportInternal* transport) { |
294 if (!HasTransport(transport)) | 294 if (!HasTransport(transport)) |
295 return NULL; | 295 return nullptr; |
296 if (cd1_.ch_.get() == transport) | 296 if (cd1_.ch_.get() == transport) |
297 return &cd1_; | 297 return &cd1_; |
298 else | 298 else |
299 return &cd2_; | 299 return &cd2_; |
300 } | 300 } |
301 | 301 |
302 void SetIceRole(IceRole role) { role_ = role; } | 302 void SetIceRole(IceRole role) { role_ = role; } |
303 IceRole ice_role() { return role_; } | 303 IceRole ice_role() { return role_; } |
304 void SetIceTiebreaker(uint64_t tiebreaker) { tiebreaker_ = tiebreaker; } | 304 void SetIceTiebreaker(uint64_t tiebreaker) { tiebreaker_ = tiebreaker; } |
305 uint64_t GetIceTiebreaker() { return tiebreaker_; } | 305 uint64_t GetIceTiebreaker() { return tiebreaker_; } |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 | 423 |
424 rtc::NATSocketServer* nat() { return nss_.get(); } | 424 rtc::NATSocketServer* nat() { return nss_.get(); } |
425 rtc::FirewallSocketServer* fw() { return ss_.get(); } | 425 rtc::FirewallSocketServer* fw() { return ss_.get(); } |
426 | 426 |
427 Endpoint* GetEndpoint(int endpoint) { | 427 Endpoint* GetEndpoint(int endpoint) { |
428 if (endpoint == 0) { | 428 if (endpoint == 0) { |
429 return &ep1_; | 429 return &ep1_; |
430 } else if (endpoint == 1) { | 430 } else if (endpoint == 1) { |
431 return &ep2_; | 431 return &ep2_; |
432 } else { | 432 } else { |
433 return NULL; | 433 return nullptr; |
434 } | 434 } |
435 } | 435 } |
436 BasicPortAllocator* GetAllocator(int endpoint) { | 436 BasicPortAllocator* GetAllocator(int endpoint) { |
437 return GetEndpoint(endpoint)->allocator_.get(); | 437 return GetEndpoint(endpoint)->allocator_.get(); |
438 } | 438 } |
439 webrtc::FakeMetricsObserver* GetMetricsObserver(int endpoint) { | 439 webrtc::FakeMetricsObserver* GetMetricsObserver(int endpoint) { |
440 return GetEndpoint(endpoint)->metrics_observer_; | 440 return GetEndpoint(endpoint)->metrics_observer_; |
441 } | 441 } |
442 void AddAddress(int endpoint, const SocketAddress& addr) { | 442 void AddAddress(int endpoint, const SocketAddress& addr) { |
443 GetEndpoint(endpoint)->network_manager_.AddInterface(addr); | 443 GetEndpoint(endpoint)->network_manager_.AddInterface(addr); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 } | 546 } |
547 | 547 |
548 void Test(const Result& expected) { | 548 void Test(const Result& expected) { |
549 rtc::ScopedFakeClock clock; | 549 rtc::ScopedFakeClock clock; |
550 int64_t connect_start = rtc::TimeMillis(); | 550 int64_t connect_start = rtc::TimeMillis(); |
551 int64_t connect_time; | 551 int64_t connect_time; |
552 | 552 |
553 // Create the channels and wait for them to connect. | 553 // Create the channels and wait for them to connect. |
554 CreateChannels(); | 554 CreateChannels(); |
555 EXPECT_TRUE_SIMULATED_WAIT( | 555 EXPECT_TRUE_SIMULATED_WAIT( |
556 ep1_ch1() != NULL && ep2_ch1() != NULL && ep1_ch1()->receiving() && | 556 ep1_ch1() != nullptr && ep2_ch1() != nullptr && |
557 ep1_ch1()->writable() && ep2_ch1()->receiving() && | 557 ep1_ch1()->receiving() && ep1_ch1()->writable() && |
558 ep2_ch1()->writable(), | 558 ep2_ch1()->receiving() && ep2_ch1()->writable(), |
559 expected.connect_wait + kShortTimeout, clock); | 559 expected.connect_wait + kShortTimeout, clock); |
560 connect_time = rtc::TimeMillis() - connect_start; | 560 connect_time = rtc::TimeMillis() - connect_start; |
561 if (connect_time < expected.connect_wait) { | 561 if (connect_time < expected.connect_wait) { |
562 LOG(LS_INFO) << "Connect time: " << connect_time << " ms"; | 562 LOG(LS_INFO) << "Connect time: " << connect_time << " ms"; |
563 } else { | 563 } else { |
564 LOG(LS_INFO) << "Connect time: " << "TIMEOUT (" | 564 LOG(LS_INFO) << "Connect time: " << "TIMEOUT (" |
565 << expected.connect_wait << " ms)"; | 565 << expected.connect_wait << " ms)"; |
566 } | 566 } |
567 | 567 |
568 // Allow a few turns of the crank for the selected connections to emerge. | 568 // Allow a few turns of the crank for the selected connections to emerge. |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 return channel->SendPacket(data, len, options, 0); | 812 return channel->SendPacket(data, len, options, 0); |
813 } | 813 } |
814 bool CheckDataOnChannel(IceTransportInternal* channel, | 814 bool CheckDataOnChannel(IceTransportInternal* channel, |
815 const char* data, | 815 const char* data, |
816 int len) { | 816 int len) { |
817 return GetChannelData(channel)->CheckData(data, len); | 817 return GetChannelData(channel)->CheckData(data, len); |
818 } | 818 } |
819 static const Candidate* LocalCandidate(P2PTransportChannel* ch) { | 819 static const Candidate* LocalCandidate(P2PTransportChannel* ch) { |
820 return (ch && ch->selected_connection()) | 820 return (ch && ch->selected_connection()) |
821 ? &ch->selected_connection()->local_candidate() | 821 ? &ch->selected_connection()->local_candidate() |
822 : NULL; | 822 : nullptr; |
823 } | 823 } |
824 static const Candidate* RemoteCandidate(P2PTransportChannel* ch) { | 824 static const Candidate* RemoteCandidate(P2PTransportChannel* ch) { |
825 return (ch && ch->selected_connection()) | 825 return (ch && ch->selected_connection()) |
826 ? &ch->selected_connection()->remote_candidate() | 826 ? &ch->selected_connection()->remote_candidate() |
827 : NULL; | 827 : nullptr; |
828 } | 828 } |
829 Endpoint* GetEndpoint(rtc::PacketTransportInternal* transport) { | 829 Endpoint* GetEndpoint(rtc::PacketTransportInternal* transport) { |
830 if (ep1_.HasTransport(transport)) { | 830 if (ep1_.HasTransport(transport)) { |
831 return &ep1_; | 831 return &ep1_; |
832 } else if (ep2_.HasTransport(transport)) { | 832 } else if (ep2_.HasTransport(transport)) { |
833 return &ep2_; | 833 return &ep2_; |
834 } else { | 834 } else { |
835 return NULL; | 835 return nullptr; |
836 } | 836 } |
837 } | 837 } |
838 P2PTransportChannel* GetRemoteChannel(IceTransportInternal* ch) { | 838 P2PTransportChannel* GetRemoteChannel(IceTransportInternal* ch) { |
839 if (ch == ep1_ch1()) | 839 if (ch == ep1_ch1()) |
840 return ep2_ch1(); | 840 return ep2_ch1(); |
841 else if (ch == ep1_ch2()) | 841 else if (ch == ep1_ch2()) |
842 return ep2_ch2(); | 842 return ep2_ch2(); |
843 else if (ch == ep2_ch1()) | 843 else if (ch == ep2_ch1()) |
844 return ep1_ch1(); | 844 return ep1_ch1(); |
845 else if (ch == ep2_ch2()) | 845 else if (ch == ep2_ch2()) |
846 return ep1_ch2(); | 846 return ep1_ch2(); |
847 else | 847 else |
848 return NULL; | 848 return nullptr; |
849 } | 849 } |
850 std::list<std::string>& GetPacketList( | 850 std::list<std::string>& GetPacketList( |
851 rtc::PacketTransportInternal* transport) { | 851 rtc::PacketTransportInternal* transport) { |
852 return GetChannelData(transport)->ch_packets_; | 852 return GetChannelData(transport)->ch_packets_; |
853 } | 853 } |
854 | 854 |
855 enum RemoteIceParameterSource { FROM_CANDIDATE, FROM_SETICEPARAMETERS }; | 855 enum RemoteIceParameterSource { FROM_CANDIDATE, FROM_SETICEPARAMETERS }; |
856 | 856 |
857 // How does the test pass ICE parameters to the P2PTransportChannel? | 857 // How does the test pass ICE parameters to the P2PTransportChannel? |
858 // On the candidate itself, or through SetRemoteIceParameters? | 858 // On the candidate itself, or through SetRemoteIceParameters? |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1075 #define SUSU &kStunUdpToStunUdp | 1075 #define SUSU &kStunUdpToStunUdp |
1076 #define SUPU &kStunUdpToPrflxUdp | 1076 #define SUPU &kStunUdpToPrflxUdp |
1077 #define PUSU &kPrflxUdpToStunUdp | 1077 #define PUSU &kPrflxUdpToStunUdp |
1078 #define LURU &kLocalUdpToRelayUdp | 1078 #define LURU &kLocalUdpToRelayUdp |
1079 #define PURU &kPrflxUdpToRelayUdp | 1079 #define PURU &kPrflxUdpToRelayUdp |
1080 #define RUPU &kRelayUdpToPrflxUdp | 1080 #define RUPU &kRelayUdpToPrflxUdp |
1081 #define LTLT &kLocalTcpToLocalTcp | 1081 #define LTLT &kLocalTcpToLocalTcp |
1082 #define LTPT &kLocalTcpToPrflxTcp | 1082 #define LTPT &kLocalTcpToPrflxTcp |
1083 #define PTLT &kPrflxTcpToLocalTcp | 1083 #define PTLT &kPrflxTcpToLocalTcp |
1084 // TODO: Enable these once TestRelayServer can accept external TCP. | 1084 // TODO: Enable these once TestRelayServer can accept external TCP. |
1085 #define LTRT NULL | 1085 #define LTRT nullptr |
1086 #define LSRS NULL | 1086 #define LSRS nullptr |
1087 | 1087 |
1088 // Test matrix. Originator behavior defined by rows, receiever by columns. | 1088 // Test matrix. Originator behavior defined by rows, receiever by columns. |
1089 | 1089 |
1090 // TODO: Fix NULLs caused by lack of TCP support in NATSocket. | 1090 // TODO: Fix nulls caused by lack of TCP support in NATSocket. |
1091 // TODO: Fix NULLs caused by no HTTP proxy support. | 1091 // TODO: Fix nulls caused by no HTTP proxy support. |
1092 // TODO: Rearrange rows/columns from best to worst. | 1092 // TODO: Rearrange rows/columns from best to worst. |
1093 const P2PTransportChannelTest::Result* | 1093 const P2PTransportChannelTest::Result* |
1094 P2PTransportChannelTest::kMatrix[NUM_CONFIGS][NUM_CONFIGS] = { | 1094 P2PTransportChannelTest::kMatrix[NUM_CONFIGS][NUM_CONFIGS] = { |
1095 // OPEN CONE ADDR PORT SYMM 2CON SCON !UDP !TCP HTTP PRXH PRXS | 1095 // OPEN CONE ADDR PORT SYMM 2CON SCON !UDP !TCP HTTP PRXH |
1096 /*OP*/ {LULU, LUSU, LUSU, LUSU, LUPU, LUSU, LUPU, LTPT, LTPT, LSRS, NULL, LTPT}, | 1096 // PRXS |
1097 /*CO*/ {SULU, SUSU, SUSU, SUSU, SUPU, SUSU, SUPU, NULL, NULL, LSRS, NULL, LTRT}, | 1097 /*OP*/ {LULU, LUSU, LUSU, LUSU, LUPU, LUSU, LUPU, LTPT, LTPT, LSRS, |
1098 /*AD*/ {SULU, SUSU, SUSU, SUSU, SUPU, SUSU, SUPU, NULL, NULL, LSRS, NULL, LTRT}, | 1098 nullptr, LTPT}, |
1099 /*PO*/ {SULU, SUSU, SUSU, SUSU, RUPU, SUSU, RUPU, NULL, NULL, LSRS, NULL, LTRT}, | 1099 /*CO*/ {SULU, SUSU, SUSU, SUSU, SUPU, SUSU, SUPU, nullptr, nullptr, |
1100 /*SY*/ {PULU, PUSU, PUSU, PURU, PURU, PUSU, PURU, NULL, NULL, LSRS, NULL, LTRT}, | 1100 LSRS, nullptr, LTRT}, |
1101 /*2C*/ {SULU, SUSU, SUSU, SUSU, SUPU, SUSU, SUPU, NULL, NULL, LSRS, NULL, LTRT}, | 1101 /*AD*/ {SULU, SUSU, SUSU, SUSU, SUPU, SUSU, SUPU, nullptr, nullptr, |
1102 /*SC*/ {PULU, PUSU, PUSU, PURU, PURU, PUSU, PURU, NULL, NULL, LSRS, NULL, LTRT}, | 1102 LSRS, nullptr, LTRT}, |
1103 /*!U*/ {LTPT, NULL, NULL, NULL, NULL, NULL, NULL, LTPT, LTPT, LSRS, NULL, LTRT}, | 1103 /*PO*/ {SULU, SUSU, SUSU, SUSU, RUPU, SUSU, RUPU, nullptr, nullptr, |
1104 /*!T*/ {PTLT, NULL, NULL, NULL, NULL, NULL, NULL, PTLT, LTRT, LSRS, NULL, LTRT}, | 1104 LSRS, nullptr, LTRT}, |
1105 /*HT*/ {LSRS, LSRS, LSRS, LSRS, LSRS, LSRS, LSRS, LSRS, LSRS, LSRS, NULL, LSRS}, | 1105 /*SY*/ {PULU, PUSU, PUSU, PURU, PURU, PUSU, PURU, nullptr, nullptr, |
1106 /*PR*/ {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | 1106 LSRS, nullptr, LTRT}, |
1107 /*PR*/ {LTRT, LTRT, LTRT, LTRT, LTRT, LTRT, LTRT, LTRT, LTRT, LSRS, NULL, LTRT}, | 1107 /*2C*/ {SULU, SUSU, SUSU, SUSU, SUPU, SUSU, SUPU, nullptr, nullptr, |
| 1108 LSRS, nullptr, LTRT}, |
| 1109 /*SC*/ {PULU, PUSU, PUSU, PURU, PURU, PUSU, PURU, nullptr, nullptr, |
| 1110 LSRS, nullptr, LTRT}, |
| 1111 /*!U*/ {LTPT, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, |
| 1112 LTPT, LTPT, LSRS, nullptr, LTRT}, |
| 1113 /*!T*/ {PTLT, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, |
| 1114 PTLT, LTRT, LSRS, nullptr, LTRT}, |
| 1115 /*HT*/ {LSRS, LSRS, LSRS, LSRS, LSRS, LSRS, LSRS, LSRS, LSRS, LSRS, |
| 1116 nullptr, LSRS}, |
| 1117 /*PR*/ {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, |
| 1118 nullptr, nullptr, nullptr, nullptr, nullptr}, |
| 1119 /*PR*/ {LTRT, LTRT, LTRT, LTRT, LTRT, LTRT, LTRT, LTRT, LTRT, LSRS, |
| 1120 nullptr, LTRT}, |
1108 }; | 1121 }; |
1109 | 1122 |
1110 // The actual tests that exercise all the various configurations. | 1123 // The actual tests that exercise all the various configurations. |
1111 // Test names are of the form P2PTransportChannelTest_TestOPENToNAT_FULL_CONE | 1124 // Test names are of the form P2PTransportChannelTest_TestOPENToNAT_FULL_CONE |
1112 #define P2P_TEST_DECLARATION(x, y, z) \ | 1125 #define P2P_TEST_DECLARATION(x, y, z) \ |
1113 TEST_F(P2PTransportChannelTest, z##Test##x##To##y) { \ | 1126 TEST_F(P2PTransportChannelTest, z##Test##x##To##y) { \ |
1114 ConfigureEndpoints(x, y, PORTALLOCATOR_ENABLE_SHARED_SOCKET, \ | 1127 ConfigureEndpoints(x, y, PORTALLOCATOR_ENABLE_SHARED_SOCKET, \ |
1115 PORTALLOCATOR_ENABLE_SHARED_SOCKET); \ | 1128 PORTALLOCATOR_ENABLE_SHARED_SOCKET); \ |
1116 if (kMatrix[x][y] != NULL) \ | 1129 if (kMatrix[x][y] != nullptr) \ |
1117 Test(*kMatrix[x][y]); \ | 1130 Test(*kMatrix[x][y]); \ |
1118 else \ | 1131 else \ |
1119 LOG(LS_WARNING) << "Not yet implemented"; \ | 1132 LOG(LS_WARNING) << "Not yet implemented"; \ |
1120 } | 1133 } |
1121 | 1134 |
1122 #define P2P_TEST(x, y) \ | 1135 #define P2P_TEST(x, y) \ |
1123 P2P_TEST_DECLARATION(x, y,) | 1136 P2P_TEST_DECLARATION(x, y,) |
1124 | 1137 |
1125 #define P2P_TEST_SET(x) \ | 1138 #define P2P_TEST_SET(x) \ |
1126 P2P_TEST(x, OPEN) \ | 1139 P2P_TEST(x, OPEN) \ |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1509 DestroyChannels(); | 1522 DestroyChannels(); |
1510 } | 1523 } |
1511 | 1524 |
1512 // Test that if remote candidates don't have ufrag and pwd, we still work. | 1525 // Test that if remote candidates don't have ufrag and pwd, we still work. |
1513 TEST_F(P2PTransportChannelTest, RemoteCandidatesWithoutUfragPwd) { | 1526 TEST_F(P2PTransportChannelTest, RemoteCandidatesWithoutUfragPwd) { |
1514 rtc::ScopedFakeClock clock; | 1527 rtc::ScopedFakeClock clock; |
1515 set_remote_ice_parameter_source(FROM_SETICEPARAMETERS); | 1528 set_remote_ice_parameter_source(FROM_SETICEPARAMETERS); |
1516 ConfigureEndpoints(OPEN, OPEN, kDefaultPortAllocatorFlags, | 1529 ConfigureEndpoints(OPEN, OPEN, kDefaultPortAllocatorFlags, |
1517 kDefaultPortAllocatorFlags); | 1530 kDefaultPortAllocatorFlags); |
1518 CreateChannels(); | 1531 CreateChannels(); |
1519 const Connection* selected_connection = NULL; | 1532 const Connection* selected_connection = nullptr; |
1520 // Wait until the callee's connections are created. | 1533 // Wait until the callee's connections are created. |
1521 EXPECT_TRUE_SIMULATED_WAIT( | 1534 EXPECT_TRUE_SIMULATED_WAIT( |
1522 (selected_connection = ep2_ch1()->selected_connection()) != NULL, | 1535 (selected_connection = ep2_ch1()->selected_connection()) != nullptr, |
1523 kMediumTimeout, clock); | 1536 kMediumTimeout, clock); |
1524 // Wait to make sure the selected connection is not changed. | 1537 // Wait to make sure the selected connection is not changed. |
1525 SIMULATED_WAIT(ep2_ch1()->selected_connection() != selected_connection, | 1538 SIMULATED_WAIT(ep2_ch1()->selected_connection() != selected_connection, |
1526 kShortTimeout, clock); | 1539 kShortTimeout, clock); |
1527 EXPECT_TRUE(ep2_ch1()->selected_connection() == selected_connection); | 1540 EXPECT_TRUE(ep2_ch1()->selected_connection() == selected_connection); |
1528 DestroyChannels(); | 1541 DestroyChannels(); |
1529 } | 1542 } |
1530 | 1543 |
1531 // Test that a host behind NAT cannot be reached when incoming_only | 1544 // Test that a host behind NAT cannot be reached when incoming_only |
1532 // is set to true. | 1545 // is set to true. |
(...skipping 22 matching lines...) Expand all Loading... |
1555 TEST_F(P2PTransportChannelTest, IncomingOnlyOpen) { | 1568 TEST_F(P2PTransportChannelTest, IncomingOnlyOpen) { |
1556 rtc::ScopedFakeClock clock; | 1569 rtc::ScopedFakeClock clock; |
1557 ConfigureEndpoints(OPEN, NAT_FULL_CONE, kDefaultPortAllocatorFlags, | 1570 ConfigureEndpoints(OPEN, NAT_FULL_CONE, kDefaultPortAllocatorFlags, |
1558 kDefaultPortAllocatorFlags); | 1571 kDefaultPortAllocatorFlags); |
1559 | 1572 |
1560 SetAllocatorFlags(0, kOnlyLocalPorts); | 1573 SetAllocatorFlags(0, kOnlyLocalPorts); |
1561 CreateChannels(); | 1574 CreateChannels(); |
1562 ep1_ch1()->set_incoming_only(true); | 1575 ep1_ch1()->set_incoming_only(true); |
1563 | 1576 |
1564 EXPECT_TRUE_SIMULATED_WAIT( | 1577 EXPECT_TRUE_SIMULATED_WAIT( |
1565 ep1_ch1() != NULL && ep2_ch1() != NULL && ep1_ch1()->receiving() && | 1578 ep1_ch1() != nullptr && ep2_ch1() != nullptr && ep1_ch1()->receiving() && |
1566 ep1_ch1()->writable() && ep2_ch1()->receiving() && | 1579 ep1_ch1()->writable() && ep2_ch1()->receiving() && |
1567 ep2_ch1()->writable(), | 1580 ep2_ch1()->writable(), |
1568 kMediumTimeout, clock); | 1581 kMediumTimeout, clock); |
1569 | 1582 |
1570 DestroyChannels(); | 1583 DestroyChannels(); |
1571 } | 1584 } |
1572 | 1585 |
1573 TEST_F(P2PTransportChannelTest, TestTcpConnectionsFromActiveToPassive) { | 1586 TEST_F(P2PTransportChannelTest, TestTcpConnectionsFromActiveToPassive) { |
1574 rtc::ScopedFakeClock clock; | 1587 rtc::ScopedFakeClock clock; |
1575 AddAddress(0, kPublicAddrs[0]); | 1588 AddAddress(0, kPublicAddrs[0]); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1769 kDefaultPortAllocatorFlags); | 1782 kDefaultPortAllocatorFlags); |
1770 SetAllocationStepDelay(0, kDefaultStepDelay); | 1783 SetAllocationStepDelay(0, kDefaultStepDelay); |
1771 SetAllocationStepDelay(1, kDefaultStepDelay); | 1784 SetAllocationStepDelay(1, kDefaultStepDelay); |
1772 IceConfig continual_gathering_config = | 1785 IceConfig continual_gathering_config = |
1773 CreateIceConfig(1000, GATHER_CONTINUALLY); | 1786 CreateIceConfig(1000, GATHER_CONTINUALLY); |
1774 // By default, ep2 does not gather continually. | 1787 // By default, ep2 does not gather continually. |
1775 IceConfig default_config; | 1788 IceConfig default_config; |
1776 CreateChannels(continual_gathering_config, default_config); | 1789 CreateChannels(continual_gathering_config, default_config); |
1777 | 1790 |
1778 EXPECT_TRUE_SIMULATED_WAIT( | 1791 EXPECT_TRUE_SIMULATED_WAIT( |
1779 ep1_ch1() != NULL && ep2_ch1() != NULL && ep1_ch1()->receiving() && | 1792 ep1_ch1() != nullptr && ep2_ch1() != nullptr && ep1_ch1()->receiving() && |
1780 ep1_ch1()->writable() && ep2_ch1()->receiving() && | 1793 ep1_ch1()->writable() && ep2_ch1()->receiving() && |
1781 ep2_ch1()->writable(), | 1794 ep2_ch1()->writable(), |
1782 kMediumTimeout, clock); | 1795 kMediumTimeout, clock); |
1783 SIMULATED_WAIT( | 1796 SIMULATED_WAIT( |
1784 IceGatheringState::kIceGatheringComplete == ep1_ch1()->gathering_state(), | 1797 IceGatheringState::kIceGatheringComplete == ep1_ch1()->gathering_state(), |
1785 kShortTimeout, clock); | 1798 kShortTimeout, clock); |
1786 EXPECT_EQ(IceGatheringState::kIceGatheringGathering, | 1799 EXPECT_EQ(IceGatheringState::kIceGatheringGathering, |
1787 ep1_ch1()->gathering_state()); | 1800 ep1_ch1()->gathering_state()); |
1788 // By now, ep2 should have completed gathering. | 1801 // By now, ep2 should have completed gathering. |
1789 EXPECT_EQ(IceGatheringState::kIceGatheringComplete, | 1802 EXPECT_EQ(IceGatheringState::kIceGatheringComplete, |
(...skipping 23 matching lines...) Expand all Loading... |
1813 ASSERT_NE(nullptr, pooled_session_1); | 1826 ASSERT_NE(nullptr, pooled_session_1); |
1814 ASSERT_NE(nullptr, pooled_session_2); | 1827 ASSERT_NE(nullptr, pooled_session_2); |
1815 // Sanity check that pooled sessions haven't gathered anything yet. | 1828 // Sanity check that pooled sessions haven't gathered anything yet. |
1816 EXPECT_TRUE(pooled_session_1->ReadyPorts().empty()); | 1829 EXPECT_TRUE(pooled_session_1->ReadyPorts().empty()); |
1817 EXPECT_TRUE(pooled_session_1->ReadyCandidates().empty()); | 1830 EXPECT_TRUE(pooled_session_1->ReadyCandidates().empty()); |
1818 EXPECT_TRUE(pooled_session_2->ReadyPorts().empty()); | 1831 EXPECT_TRUE(pooled_session_2->ReadyPorts().empty()); |
1819 EXPECT_TRUE(pooled_session_2->ReadyCandidates().empty()); | 1832 EXPECT_TRUE(pooled_session_2->ReadyCandidates().empty()); |
1820 // Now let the endpoints connect and try exchanging some data. | 1833 // Now let the endpoints connect and try exchanging some data. |
1821 CreateChannels(); | 1834 CreateChannels(); |
1822 EXPECT_TRUE_SIMULATED_WAIT( | 1835 EXPECT_TRUE_SIMULATED_WAIT( |
1823 ep1_ch1() != NULL && ep2_ch1() != NULL && ep1_ch1()->receiving() && | 1836 ep1_ch1() != nullptr && ep2_ch1() != nullptr && ep1_ch1()->receiving() && |
1824 ep1_ch1()->writable() && ep2_ch1()->receiving() && | 1837 ep1_ch1()->writable() && ep2_ch1()->receiving() && |
1825 ep2_ch1()->writable(), | 1838 ep2_ch1()->writable(), |
1826 kMediumTimeout, clock); | 1839 kMediumTimeout, clock); |
1827 TestSendRecv(clock); | 1840 TestSendRecv(clock); |
1828 // Make sure the P2PTransportChannels are actually using ports from the | 1841 // Make sure the P2PTransportChannels are actually using ports from the |
1829 // pooled sessions. | 1842 // pooled sessions. |
1830 auto pooled_ports_1 = pooled_session_1->ReadyPorts(); | 1843 auto pooled_ports_1 = pooled_session_1->ReadyPorts(); |
1831 auto pooled_ports_2 = pooled_session_2->ReadyPorts(); | 1844 auto pooled_ports_2 = pooled_session_2->ReadyPorts(); |
1832 EXPECT_NE(pooled_ports_1.end(), | 1845 EXPECT_NE(pooled_ports_1.end(), |
1833 std::find(pooled_ports_1.begin(), pooled_ports_1.end(), | 1846 std::find(pooled_ports_1.begin(), pooled_ports_1.end(), |
(...skipping 24 matching lines...) Expand all Loading... |
1858 ASSERT_NE(nullptr, pooled_session_1); | 1871 ASSERT_NE(nullptr, pooled_session_1); |
1859 ASSERT_NE(nullptr, pooled_session_2); | 1872 ASSERT_NE(nullptr, pooled_session_2); |
1860 // Wait for the pooled sessions to finish gathering before the | 1873 // Wait for the pooled sessions to finish gathering before the |
1861 // P2PTransportChannels try to use them. | 1874 // P2PTransportChannels try to use them. |
1862 EXPECT_TRUE_SIMULATED_WAIT(pooled_session_1->CandidatesAllocationDone() && | 1875 EXPECT_TRUE_SIMULATED_WAIT(pooled_session_1->CandidatesAllocationDone() && |
1863 pooled_session_2->CandidatesAllocationDone(), | 1876 pooled_session_2->CandidatesAllocationDone(), |
1864 kDefaultTimeout, clock); | 1877 kDefaultTimeout, clock); |
1865 // Now let the endpoints connect and try exchanging some data. | 1878 // Now let the endpoints connect and try exchanging some data. |
1866 CreateChannels(); | 1879 CreateChannels(); |
1867 EXPECT_TRUE_SIMULATED_WAIT( | 1880 EXPECT_TRUE_SIMULATED_WAIT( |
1868 ep1_ch1() != NULL && ep2_ch1() != NULL && ep1_ch1()->receiving() && | 1881 ep1_ch1() != nullptr && ep2_ch1() != nullptr && ep1_ch1()->receiving() && |
1869 ep1_ch1()->writable() && ep2_ch1()->receiving() && | 1882 ep1_ch1()->writable() && ep2_ch1()->receiving() && |
1870 ep2_ch1()->writable(), | 1883 ep2_ch1()->writable(), |
1871 kMediumTimeout, clock); | 1884 kMediumTimeout, clock); |
1872 TestSendRecv(clock); | 1885 TestSendRecv(clock); |
1873 // Make sure the P2PTransportChannels are actually using ports from the | 1886 // Make sure the P2PTransportChannels are actually using ports from the |
1874 // pooled sessions. | 1887 // pooled sessions. |
1875 auto pooled_ports_1 = pooled_session_1->ReadyPorts(); | 1888 auto pooled_ports_1 = pooled_session_1->ReadyPorts(); |
1876 auto pooled_ports_2 = pooled_session_2->ReadyPorts(); | 1889 auto pooled_ports_2 = pooled_session_2->ReadyPorts(); |
1877 EXPECT_NE(pooled_ports_1.end(), | 1890 EXPECT_NE(pooled_ports_1.end(), |
1878 std::find(pooled_ports_1.begin(), pooled_ports_1.end(), | 1891 std::find(pooled_ports_1.begin(), pooled_ports_1.end(), |
(...skipping 2508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4387 | 4400 |
4388 // TCP Relay/Relay is the next. | 4401 // TCP Relay/Relay is the next. |
4389 VerifyNextPingableConnection(RELAY_PORT_TYPE, RELAY_PORT_TYPE, | 4402 VerifyNextPingableConnection(RELAY_PORT_TYPE, RELAY_PORT_TYPE, |
4390 TCP_PROTOCOL_NAME); | 4403 TCP_PROTOCOL_NAME); |
4391 | 4404 |
4392 // Finally, Local/Relay will be pinged. | 4405 // Finally, Local/Relay will be pinged. |
4393 VerifyNextPingableConnection(LOCAL_PORT_TYPE, RELAY_PORT_TYPE); | 4406 VerifyNextPingableConnection(LOCAL_PORT_TYPE, RELAY_PORT_TYPE); |
4394 } | 4407 } |
4395 | 4408 |
4396 } // namespace cricket { | 4409 } // namespace cricket { |
OLD | NEW |