| 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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 } | 290 } |
| 291 cricket::P2PTransportChannel* CreateChannel( | 291 cricket::P2PTransportChannel* CreateChannel( |
| 292 int endpoint, | 292 int endpoint, |
| 293 int component, | 293 int component, |
| 294 const std::string& local_ice_ufrag, | 294 const std::string& local_ice_ufrag, |
| 295 const std::string& local_ice_pwd, | 295 const std::string& local_ice_pwd, |
| 296 const std::string& remote_ice_ufrag, | 296 const std::string& remote_ice_ufrag, |
| 297 const std::string& remote_ice_pwd) { | 297 const std::string& remote_ice_pwd) { |
| 298 cricket::P2PTransportChannel* channel = new cricket::P2PTransportChannel( | 298 cricket::P2PTransportChannel* channel = new cricket::P2PTransportChannel( |
| 299 "test content name", component, NULL, GetAllocator(endpoint)); | 299 "test content name", component, NULL, GetAllocator(endpoint)); |
| 300 channel->SignalRequestSignaling.connect( | 300 channel->SignalCandidateGathered.connect( |
| 301 this, &P2PTransportChannelTestBase::OnChannelRequestSignaling); | 301 this, &P2PTransportChannelTestBase::OnCandidate); |
| 302 channel->SignalCandidateReady.connect(this, | |
| 303 &P2PTransportChannelTestBase::OnCandidate); | |
| 304 channel->SignalReadPacket.connect( | 302 channel->SignalReadPacket.connect( |
| 305 this, &P2PTransportChannelTestBase::OnReadPacket); | 303 this, &P2PTransportChannelTestBase::OnReadPacket); |
| 306 channel->SignalRoleConflict.connect( | 304 channel->SignalRoleConflict.connect( |
| 307 this, &P2PTransportChannelTestBase::OnRoleConflict); | 305 this, &P2PTransportChannelTestBase::OnRoleConflict); |
| 308 channel->SetIceCredentials(local_ice_ufrag, local_ice_pwd); | 306 channel->SetIceCredentials(local_ice_ufrag, local_ice_pwd); |
| 309 if (clear_remote_candidates_ufrag_pwd_) { | 307 if (clear_remote_candidates_ufrag_pwd_) { |
| 310 // This only needs to be set if we're clearing them from the | 308 // This only needs to be set if we're clearing them from the |
| 311 // candidates. Some unit tests rely on this not being set. | 309 // candidates. Some unit tests rely on this not being set. |
| 312 channel->SetRemoteIceCredentials(remote_ice_ufrag, remote_ice_pwd); | 310 channel->SetRemoteIceCredentials(remote_ice_ufrag, remote_ice_pwd); |
| 313 } | 311 } |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 return GetEndpoint(endpoint)->role_conflict(); | 380 return GetEndpoint(endpoint)->role_conflict(); |
| 383 } | 381 } |
| 384 void SetAllocationStepDelay(int endpoint, uint32 delay) { | 382 void SetAllocationStepDelay(int endpoint, uint32 delay) { |
| 385 return GetEndpoint(endpoint)->SetAllocationStepDelay(delay); | 383 return GetEndpoint(endpoint)->SetAllocationStepDelay(delay); |
| 386 } | 384 } |
| 387 void SetAllowTcpListen(int endpoint, bool allow_tcp_listen) { | 385 void SetAllowTcpListen(int endpoint, bool allow_tcp_listen) { |
| 388 return GetEndpoint(endpoint)->SetAllowTcpListen(allow_tcp_listen); | 386 return GetEndpoint(endpoint)->SetAllowTcpListen(allow_tcp_listen); |
| 389 } | 387 } |
| 390 | 388 |
| 391 bool IsLocalToPrflxOrTheReverse(const Result& expected) { | 389 bool IsLocalToPrflxOrTheReverse(const Result& expected) { |
| 392 return ((expected.local_type == "local" && | 390 return ( |
| 393 expected.remote_type == "prflx") || | 391 (expected.local_type == "local" && expected.remote_type == "prflx") || |
| 394 (expected.local_type == "prflx" && | 392 (expected.local_type == "prflx" && expected.remote_type == "local")); |
| 395 expected.remote_type == "local")); | |
| 396 } | 393 } |
| 397 | 394 |
| 398 // Return true if the approprite parts of the expected Result, based | 395 // Return true if the approprite parts of the expected Result, based |
| 399 // on the local and remote candidate of ep1_ch1, match. This can be | 396 // on the local and remote candidate of ep1_ch1, match. This can be |
| 400 // used in an EXPECT_TRUE_WAIT. | 397 // used in an EXPECT_TRUE_WAIT. |
| 401 bool CheckCandidate1(const Result& expected) { | 398 bool CheckCandidate1(const Result& expected) { |
| 402 const std::string& local_type = LocalCandidate(ep1_ch1())->type(); | 399 const std::string& local_type = LocalCandidate(ep1_ch1())->type(); |
| 403 const std::string& local_proto = LocalCandidate(ep1_ch1())->protocol(); | 400 const std::string& local_proto = LocalCandidate(ep1_ch1())->protocol(); |
| 404 const std::string& remote_type = RemoteCandidate(ep1_ch1())->type(); | 401 const std::string& remote_type = RemoteCandidate(ep1_ch1())->type(); |
| 405 const std::string& remote_proto = RemoteCandidate(ep1_ch1())->protocol(); | 402 const std::string& remote_proto = RemoteCandidate(ep1_ch1())->protocol(); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 LOG(LS_INFO) << "Connect time: " << "TIMEOUT (" | 502 LOG(LS_INFO) << "Connect time: " << "TIMEOUT (" |
| 506 << expected.connect_wait << " ms)"; | 503 << expected.connect_wait << " ms)"; |
| 507 } | 504 } |
| 508 | 505 |
| 509 // Allow a few turns of the crank for the best connections to emerge. | 506 // Allow a few turns of the crank for the best connections to emerge. |
| 510 // This may take up to 2 seconds. | 507 // This may take up to 2 seconds. |
| 511 if (ep1_ch1()->best_connection() && | 508 if (ep1_ch1()->best_connection() && |
| 512 ep2_ch1()->best_connection()) { | 509 ep2_ch1()->best_connection()) { |
| 513 int32 converge_start = rtc::Time(), converge_time; | 510 int32 converge_start = rtc::Time(), converge_time; |
| 514 int converge_wait = 2000; | 511 int converge_wait = 2000; |
| 515 EXPECT_TRUE_WAIT_MARGIN(CheckCandidate1(expected), | 512 EXPECT_TRUE_WAIT_MARGIN(CheckCandidate1(expected), converge_wait, |
| 516 converge_wait, converge_wait); | 513 converge_wait); |
| 517 // Also do EXPECT_EQ on each part so that failures are more verbose. | 514 // Also do EXPECT_EQ on each part so that failures are more verbose. |
| 518 ExpectCandidate1(expected); | 515 ExpectCandidate1(expected); |
| 519 | 516 |
| 520 // Verifying remote channel best connection information. This is done | 517 // Verifying remote channel best connection information. This is done |
| 521 // only for the RFC 5245 as controlled agent will use USE-CANDIDATE | 518 // only for the RFC 5245 as controlled agent will use USE-CANDIDATE |
| 522 // from controlling (ep1) agent. We can easily predict from EP1 result | 519 // from controlling (ep1) agent. We can easily predict from EP1 result |
| 523 // matrix. | 520 // matrix. |
| 524 | 521 |
| 525 // Checking for best connection candidates information at remote. | 522 // Checking for best connection candidates information at remote. |
| 526 EXPECT_TRUE_WAIT(CheckCandidate2(expected), kDefaultTimeout); | 523 EXPECT_TRUE_WAIT(CheckCandidate2(expected), kDefaultTimeout); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 ep2_ch1()->readable() && | 616 ep2_ch1()->readable() && |
| 620 ep2_ch1()->writable(), | 617 ep2_ch1()->writable(), |
| 621 1000); | 618 1000); |
| 622 | 619 |
| 623 EXPECT_TRUE(ep1_ch1()->best_connection() && | 620 EXPECT_TRUE(ep1_ch1()->best_connection() && |
| 624 ep2_ch1()->best_connection()); | 621 ep2_ch1()->best_connection()); |
| 625 | 622 |
| 626 TestSendRecv(1); | 623 TestSendRecv(1); |
| 627 } | 624 } |
| 628 | 625 |
| 629 void OnChannelRequestSignaling(cricket::TransportChannelImpl* channel) { | |
| 630 channel->OnSignalingReady(); | |
| 631 } | |
| 632 // We pass the candidates directly to the other side. | 626 // We pass the candidates directly to the other side. |
| 633 void OnCandidate(cricket::TransportChannelImpl* ch, | 627 void OnCandidate(cricket::TransportChannelImpl* ch, |
| 634 const cricket::Candidate& c) { | 628 const cricket::Candidate& c) { |
| 635 if (force_relay_ && c.type() != cricket::RELAY_PORT_TYPE) | 629 if (force_relay_ && c.type() != cricket::RELAY_PORT_TYPE) |
| 636 return; | 630 return; |
| 637 | 631 |
| 638 if (GetEndpoint(ch)->save_candidates_) { | 632 if (GetEndpoint(ch)->save_candidates_) { |
| 639 GetEndpoint(ch)->saved_candidates_.push_back(new CandidateData(ch, c)); | 633 GetEndpoint(ch)->saved_candidates_.push_back(new CandidateData(ch, c)); |
| 640 } else { | 634 } else { |
| 641 main_->Post(this, MSG_CANDIDATE, new CandidateData(ch, c)); | 635 main_->Post(this, MSG_CANDIDATE, new CandidateData(ch, c)); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 662 rtc::scoped_ptr<CandidateData> data( | 656 rtc::scoped_ptr<CandidateData> data( |
| 663 static_cast<CandidateData*>(msg->pdata)); | 657 static_cast<CandidateData*>(msg->pdata)); |
| 664 cricket::P2PTransportChannel* rch = GetRemoteChannel(data->channel); | 658 cricket::P2PTransportChannel* rch = GetRemoteChannel(data->channel); |
| 665 cricket::Candidate c = data->candidate; | 659 cricket::Candidate c = data->candidate; |
| 666 if (clear_remote_candidates_ufrag_pwd_) { | 660 if (clear_remote_candidates_ufrag_pwd_) { |
| 667 c.set_username(""); | 661 c.set_username(""); |
| 668 c.set_password(""); | 662 c.set_password(""); |
| 669 } | 663 } |
| 670 LOG(LS_INFO) << "Candidate(" << data->channel->component() << "->" | 664 LOG(LS_INFO) << "Candidate(" << data->channel->component() << "->" |
| 671 << rch->component() << "): " << c.ToString(); | 665 << rch->component() << "): " << c.ToString(); |
| 672 rch->OnCandidate(c); | 666 rch->AddRemoteCandidate(c); |
| 673 break; | 667 break; |
| 674 } | 668 } |
| 675 } | 669 } |
| 676 } | 670 } |
| 677 void OnReadPacket(cricket::TransportChannel* channel, const char* data, | 671 void OnReadPacket(cricket::TransportChannel* channel, const char* data, |
| 678 size_t len, const rtc::PacketTime& packet_time, | 672 size_t len, const rtc::PacketTime& packet_time, |
| 679 int flags) { | 673 int flags) { |
| 680 std::list<std::string>& packets = GetPacketList(channel); | 674 std::list<std::string>& packets = GetPacketList(channel); |
| 681 packets.push_front(std::string(data, len)); | 675 packets.push_front(std::string(data, len)); |
| 682 } | 676 } |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 "local", "tcp", "prflx", "tcp", 3000); | 791 "local", "tcp", "prflx", "tcp", 3000); |
| 798 | 792 |
| 799 // Test the matrix of all the connectivity types we expect to see in the wild. | 793 // Test the matrix of all the connectivity types we expect to see in the wild. |
| 800 // Just test every combination of the configs in the Config enum. | 794 // Just test every combination of the configs in the Config enum. |
| 801 class P2PTransportChannelTest : public P2PTransportChannelTestBase { | 795 class P2PTransportChannelTest : public P2PTransportChannelTestBase { |
| 802 protected: | 796 protected: |
| 803 static const Result* kMatrix[NUM_CONFIGS][NUM_CONFIGS]; | 797 static const Result* kMatrix[NUM_CONFIGS][NUM_CONFIGS]; |
| 804 static const Result* kMatrixSharedUfrag[NUM_CONFIGS][NUM_CONFIGS]; | 798 static const Result* kMatrixSharedUfrag[NUM_CONFIGS][NUM_CONFIGS]; |
| 805 static const Result* kMatrixSharedSocketAsGice[NUM_CONFIGS][NUM_CONFIGS]; | 799 static const Result* kMatrixSharedSocketAsGice[NUM_CONFIGS][NUM_CONFIGS]; |
| 806 static const Result* kMatrixSharedSocketAsIce[NUM_CONFIGS][NUM_CONFIGS]; | 800 static const Result* kMatrixSharedSocketAsIce[NUM_CONFIGS][NUM_CONFIGS]; |
| 807 void ConfigureEndpoints(Config config1, Config config2, | 801 void ConfigureEndpoints(Config config1, |
| 808 int allocator_flags1, int allocator_flags2) { | 802 Config config2, |
| 803 int allocator_flags1, |
| 804 int allocator_flags2) { |
| 809 ServerAddresses stun_servers; | 805 ServerAddresses stun_servers; |
| 810 stun_servers.insert(kStunAddr); | 806 stun_servers.insert(kStunAddr); |
| 811 GetEndpoint(0)->allocator_.reset( | 807 GetEndpoint(0)->allocator_.reset( |
| 812 new cricket::BasicPortAllocator(&(GetEndpoint(0)->network_manager_), | 808 new cricket::BasicPortAllocator(&(GetEndpoint(0)->network_manager_), |
| 813 stun_servers, | 809 stun_servers, |
| 814 rtc::SocketAddress(), rtc::SocketAddress(), | 810 rtc::SocketAddress(), rtc::SocketAddress(), |
| 815 rtc::SocketAddress())); | 811 rtc::SocketAddress())); |
| 816 GetEndpoint(1)->allocator_.reset( | 812 GetEndpoint(1)->allocator_.reset( |
| 817 new cricket::BasicPortAllocator(&(GetEndpoint(1)->network_manager_), | 813 new cricket::BasicPortAllocator(&(GetEndpoint(1)->network_manager_), |
| 818 stun_servers, | 814 stun_servers, |
| 819 rtc::SocketAddress(), rtc::SocketAddress(), | 815 rtc::SocketAddress(), rtc::SocketAddress(), |
| 820 rtc::SocketAddress())); | 816 rtc::SocketAddress())); |
| 821 | 817 |
| 822 cricket::RelayServerConfig relay_server(cricket::RELAY_TURN); | 818 cricket::RelayServerConfig relay_server(cricket::RELAY_TURN); |
| 823 relay_server.credentials = kRelayCredentials; | 819 relay_server.credentials = kRelayCredentials; |
| 824 relay_server.ports.push_back(cricket::ProtocolAddress( | 820 relay_server.ports.push_back( |
| 825 kTurnUdpIntAddr, cricket::PROTO_UDP, false)); | 821 cricket::ProtocolAddress(kTurnUdpIntAddr, cricket::PROTO_UDP, false)); |
| 826 GetEndpoint(0)->allocator_->AddRelay(relay_server); | 822 GetEndpoint(0)->allocator_->AddRelay(relay_server); |
| 827 GetEndpoint(1)->allocator_->AddRelay(relay_server); | 823 GetEndpoint(1)->allocator_->AddRelay(relay_server); |
| 828 | 824 |
| 829 int delay = kMinimumStepDelay; | 825 int delay = kMinimumStepDelay; |
| 830 ConfigureEndpoint(0, config1); | 826 ConfigureEndpoint(0, config1); |
| 831 SetAllocatorFlags(0, allocator_flags1); | 827 SetAllocatorFlags(0, allocator_flags1); |
| 832 SetAllocationStepDelay(0, delay); | 828 SetAllocationStepDelay(0, delay); |
| 833 ConfigureEndpoint(1, config2); | 829 ConfigureEndpoint(1, config2); |
| 834 SetAllocatorFlags(1, allocator_flags2); | 830 SetAllocatorFlags(1, allocator_flags2); |
| 835 SetAllocationStepDelay(1, delay); | 831 SetAllocationStepDelay(1, delay); |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1019 /*SC*/ {PULU, PUSU, PUSU, PURU, PURU, PUSU, PURU, NULL, NULL, LSRS, NULL, LTRT}, | 1015 /*SC*/ {PULU, PUSU, PUSU, PURU, PURU, PUSU, PURU, NULL, NULL, LSRS, NULL, LTRT}, |
| 1020 /*!U*/ {PTLT, NULL, NULL, NULL, NULL, NULL, NULL, PTLT, LTPT, LSRS, NULL, LTRT}, | 1016 /*!U*/ {PTLT, NULL, NULL, NULL, NULL, NULL, NULL, PTLT, LTPT, LSRS, NULL, LTRT}, |
| 1021 /*!T*/ {LTRT, NULL, NULL, NULL, NULL, NULL, NULL, PTLT, LTRT, LSRS, NULL, LTRT}, | 1017 /*!T*/ {LTRT, NULL, NULL, NULL, NULL, NULL, NULL, PTLT, LTRT, LSRS, NULL, LTRT}, |
| 1022 /*HT*/ {LSRS, LSRS, LSRS, LSRS, LSRS, LSRS, LSRS, LSRS, LSRS, LSRS, NULL, LSRS}, | 1018 /*HT*/ {LSRS, LSRS, LSRS, LSRS, LSRS, LSRS, LSRS, LSRS, LSRS, LSRS, NULL, LSRS}, |
| 1023 /*PR*/ {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, | 1019 /*PR*/ {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, |
| 1024 /*PR*/ {LTRT, LTRT, LTRT, LTRT, LTRT, LTRT, LTRT, LTRT, LTRT, LSRS, NULL, LTRT}, | 1020 /*PR*/ {LTRT, LTRT, LTRT, LTRT, LTRT, LTRT, LTRT, LTRT, LTRT, LSRS, NULL, LTRT}, |
| 1025 }; | 1021 }; |
| 1026 | 1022 |
| 1027 // The actual tests that exercise all the various configurations. | 1023 // The actual tests that exercise all the various configurations. |
| 1028 // Test names are of the form P2PTransportChannelTest_TestOPENToNAT_FULL_CONE | 1024 // Test names are of the form P2PTransportChannelTest_TestOPENToNAT_FULL_CONE |
| 1029 #define P2P_TEST_DECLARATION(x, y, z) \ | 1025 #define P2P_TEST_DECLARATION(x, y, z) \ |
| 1030 TEST_F(P2PTransportChannelTest, z##Test##x##To##y) { \ | 1026 TEST_F(P2PTransportChannelTest, z##Test##x##To##y) { \ |
| 1031 ConfigureEndpoints(x, y, \ | 1027 ConfigureEndpoints(x, y, PORTALLOCATOR_ENABLE_SHARED_SOCKET, \ |
| 1032 PORTALLOCATOR_ENABLE_SHARED_SOCKET, \ | 1028 PORTALLOCATOR_ENABLE_SHARED_SOCKET); \ |
| 1033 PORTALLOCATOR_ENABLE_SHARED_SOCKET); \ | 1029 if (kMatrixSharedSocketAsIce[x][y] != NULL) \ |
| 1034 if (kMatrixSharedSocketAsIce[x][y] != NULL) \ | 1030 Test(*kMatrixSharedSocketAsIce[x][y]); \ |
| 1035 Test(*kMatrixSharedSocketAsIce[x][y]); \ | 1031 else \ |
| 1036 else \ | 1032 LOG(LS_WARNING) << "Not yet implemented"; \ |
| 1037 LOG(LS_WARNING) << "Not yet implemented"; \ | |
| 1038 } | 1033 } |
| 1039 | 1034 |
| 1040 #define P2P_TEST(x, y) \ | 1035 #define P2P_TEST(x, y) \ |
| 1041 P2P_TEST_DECLARATION(x, y,) | 1036 P2P_TEST_DECLARATION(x, y,) |
| 1042 | 1037 |
| 1043 #define FLAKY_P2P_TEST(x, y) \ | 1038 #define FLAKY_P2P_TEST(x, y) \ |
| 1044 P2P_TEST_DECLARATION(x, y, DISABLED_) | 1039 P2P_TEST_DECLARATION(x, y, DISABLED_) |
| 1045 | 1040 |
| 1046 // TODO(holmer): Disabled due to randomly failing on webrtc buildbots. | 1041 // TODO(holmer): Disabled due to randomly failing on webrtc buildbots. |
| 1047 // Issue: webrtc/2383 | 1042 // Issue: webrtc/2383 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1082 P2P_TEST_SET(NAT_SYMMETRIC_THEN_CONE) | 1077 P2P_TEST_SET(NAT_SYMMETRIC_THEN_CONE) |
| 1083 P2P_TEST_SET(BLOCK_UDP) | 1078 P2P_TEST_SET(BLOCK_UDP) |
| 1084 P2P_TEST_SET(BLOCK_UDP_AND_INCOMING_TCP) | 1079 P2P_TEST_SET(BLOCK_UDP_AND_INCOMING_TCP) |
| 1085 P2P_TEST_SET(BLOCK_ALL_BUT_OUTGOING_HTTP) | 1080 P2P_TEST_SET(BLOCK_ALL_BUT_OUTGOING_HTTP) |
| 1086 P2P_TEST_SET(PROXY_HTTPS) | 1081 P2P_TEST_SET(PROXY_HTTPS) |
| 1087 P2P_TEST_SET(PROXY_SOCKS) | 1082 P2P_TEST_SET(PROXY_SOCKS) |
| 1088 | 1083 |
| 1089 // Test that we restart candidate allocation when local ufrag&pwd changed. | 1084 // Test that we restart candidate allocation when local ufrag&pwd changed. |
| 1090 // Standard Ice protocol is used. | 1085 // Standard Ice protocol is used. |
| 1091 TEST_F(P2PTransportChannelTest, HandleUfragPwdChange) { | 1086 TEST_F(P2PTransportChannelTest, HandleUfragPwdChange) { |
| 1092 ConfigureEndpoints(OPEN, OPEN, | 1087 ConfigureEndpoints(OPEN, OPEN, kDefaultPortAllocatorFlags, |
| 1093 kDefaultPortAllocatorFlags, | |
| 1094 kDefaultPortAllocatorFlags); | 1088 kDefaultPortAllocatorFlags); |
| 1095 CreateChannels(1); | 1089 CreateChannels(1); |
| 1096 TestHandleIceUfragPasswordChanged(); | 1090 TestHandleIceUfragPasswordChanged(); |
| 1097 DestroyChannels(); | 1091 DestroyChannels(); |
| 1098 } | 1092 } |
| 1099 | 1093 |
| 1100 // Test the operation of GetStats. | 1094 // Test the operation of GetStats. |
| 1101 TEST_F(P2PTransportChannelTest, GetStats) { | 1095 TEST_F(P2PTransportChannelTest, GetStats) { |
| 1102 ConfigureEndpoints(OPEN, OPEN, | 1096 ConfigureEndpoints(OPEN, OPEN, kDefaultPortAllocatorFlags, |
| 1103 kDefaultPortAllocatorFlags, | |
| 1104 kDefaultPortAllocatorFlags); | 1097 kDefaultPortAllocatorFlags); |
| 1105 CreateChannels(1); | 1098 CreateChannels(1); |
| 1106 EXPECT_TRUE_WAIT_MARGIN(ep1_ch1()->readable() && ep1_ch1()->writable() && | 1099 EXPECT_TRUE_WAIT_MARGIN(ep1_ch1()->readable() && ep1_ch1()->writable() && |
| 1107 ep2_ch1()->readable() && ep2_ch1()->writable(), | 1100 ep2_ch1()->readable() && ep2_ch1()->writable(), |
| 1108 1000, 1000); | 1101 1000, 1000); |
| 1109 TestSendRecv(1); | 1102 TestSendRecv(1); |
| 1110 cricket::ConnectionInfos infos; | 1103 cricket::ConnectionInfos infos; |
| 1111 ASSERT_TRUE(ep1_ch1()->GetStats(&infos)); | 1104 ASSERT_TRUE(ep1_ch1()->GetStats(&infos)); |
| 1112 ASSERT_EQ(1U, infos.size()); | 1105 ASSERT_EQ(1U, infos.size()); |
| 1113 EXPECT_TRUE(infos[0].new_connection); | 1106 EXPECT_TRUE(infos[0].new_connection); |
| 1114 EXPECT_TRUE(infos[0].best_connection); | 1107 EXPECT_TRUE(infos[0].best_connection); |
| 1115 EXPECT_TRUE(infos[0].readable); | 1108 EXPECT_TRUE(infos[0].readable); |
| 1116 EXPECT_TRUE(infos[0].writable); | 1109 EXPECT_TRUE(infos[0].writable); |
| 1117 EXPECT_FALSE(infos[0].timeout); | 1110 EXPECT_FALSE(infos[0].timeout); |
| 1118 EXPECT_EQ(10U, infos[0].sent_total_packets); | 1111 EXPECT_EQ(10U, infos[0].sent_total_packets); |
| 1119 EXPECT_EQ(0U, infos[0].sent_discarded_packets); | 1112 EXPECT_EQ(0U, infos[0].sent_discarded_packets); |
| 1120 EXPECT_EQ(10 * 36U, infos[0].sent_total_bytes); | 1113 EXPECT_EQ(10 * 36U, infos[0].sent_total_bytes); |
| 1121 EXPECT_EQ(10 * 36U, infos[0].recv_total_bytes); | 1114 EXPECT_EQ(10 * 36U, infos[0].recv_total_bytes); |
| 1122 EXPECT_GT(infos[0].rtt, 0U); | 1115 EXPECT_GT(infos[0].rtt, 0U); |
| 1123 DestroyChannels(); | 1116 DestroyChannels(); |
| 1124 } | 1117 } |
| 1125 | 1118 |
| 1126 // Test that we properly create a connection on a STUN ping from unknown address | 1119 // Test that we properly create a connection on a STUN ping from unknown address |
| 1127 // when the signaling is slow. | 1120 // when the signaling is slow. |
| 1128 TEST_F(P2PTransportChannelTest, PeerReflexiveCandidateBeforeSignaling) { | 1121 TEST_F(P2PTransportChannelTest, PeerReflexiveCandidateBeforeSignaling) { |
| 1129 ConfigureEndpoints(OPEN, OPEN, | 1122 ConfigureEndpoints(OPEN, OPEN, kDefaultPortAllocatorFlags, |
| 1130 kDefaultPortAllocatorFlags, | |
| 1131 kDefaultPortAllocatorFlags); | 1123 kDefaultPortAllocatorFlags); |
| 1132 // Emulate no remote credentials coming in. | 1124 // Emulate no remote credentials coming in. |
| 1133 set_clear_remote_candidates_ufrag_pwd(false); | 1125 set_clear_remote_candidates_ufrag_pwd(false); |
| 1134 CreateChannels(1); | 1126 CreateChannels(1); |
| 1135 // Only have remote credentials come in for ep2, not ep1. | 1127 // Only have remote credentials come in for ep2, not ep1. |
| 1136 ep2_ch1()->SetRemoteIceCredentials(kIceUfrag[3], kIcePwd[3]); | 1128 ep2_ch1()->SetRemoteIceCredentials(kIceUfrag[3], kIcePwd[3]); |
| 1137 | 1129 |
| 1138 // Pause sending ep2's candidates to ep1 until ep1 receives the peer reflexive | 1130 // Pause sending ep2's candidates to ep1 until ep1 receives the peer reflexive |
| 1139 // candidate. | 1131 // candidate. |
| 1140 PauseCandidates(1); | 1132 PauseCandidates(1); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1164 "local", | 1156 "local", |
| 1165 ep1_ch1()->best_connection()->remote_candidate().type(), | 1157 ep1_ch1()->best_connection()->remote_candidate().type(), |
| 1166 2000); | 1158 2000); |
| 1167 EXPECT_EQ(best_connection, ep1_ch1()->best_connection()); | 1159 EXPECT_EQ(best_connection, ep1_ch1()->best_connection()); |
| 1168 DestroyChannels(); | 1160 DestroyChannels(); |
| 1169 } | 1161 } |
| 1170 | 1162 |
| 1171 // Test that we properly create a connection on a STUN ping from unknown address | 1163 // Test that we properly create a connection on a STUN ping from unknown address |
| 1172 // when the signaling is slow and the end points are behind NAT. | 1164 // when the signaling is slow and the end points are behind NAT. |
| 1173 TEST_F(P2PTransportChannelTest, PeerReflexiveCandidateBeforeSignalingWithNAT) { | 1165 TEST_F(P2PTransportChannelTest, PeerReflexiveCandidateBeforeSignalingWithNAT) { |
| 1174 ConfigureEndpoints(OPEN, NAT_SYMMETRIC, | 1166 ConfigureEndpoints(OPEN, NAT_SYMMETRIC, kDefaultPortAllocatorFlags, |
| 1175 kDefaultPortAllocatorFlags, | |
| 1176 kDefaultPortAllocatorFlags); | 1167 kDefaultPortAllocatorFlags); |
| 1177 // Emulate no remote credentials coming in. | 1168 // Emulate no remote credentials coming in. |
| 1178 set_clear_remote_candidates_ufrag_pwd(false); | 1169 set_clear_remote_candidates_ufrag_pwd(false); |
| 1179 CreateChannels(1); | 1170 CreateChannels(1); |
| 1180 // Only have remote credentials come in for ep2, not ep1. | 1171 // Only have remote credentials come in for ep2, not ep1. |
| 1181 ep2_ch1()->SetRemoteIceCredentials(kIceUfrag[3], kIcePwd[3]); | 1172 ep2_ch1()->SetRemoteIceCredentials(kIceUfrag[3], kIcePwd[3]); |
| 1182 // Pause sending ep2's candidates to ep1 until ep1 receives the peer reflexive | 1173 // Pause sending ep2's candidates to ep1 until ep1 receives the peer reflexive |
| 1183 // candidate. | 1174 // candidate. |
| 1184 PauseCandidates(1); | 1175 PauseCandidates(1); |
| 1185 | 1176 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1207 // Wait to verify the connection is not culled. | 1198 // Wait to verify the connection is not culled. |
| 1208 WAIT(ep1_ch1()->writable(), 2000); | 1199 WAIT(ep1_ch1()->writable(), 2000); |
| 1209 EXPECT_EQ(ep2_ch1()->best_connection(), best_connection); | 1200 EXPECT_EQ(ep2_ch1()->best_connection(), best_connection); |
| 1210 EXPECT_EQ("prflx", ep1_ch1()->best_connection()->remote_candidate().type()); | 1201 EXPECT_EQ("prflx", ep1_ch1()->best_connection()->remote_candidate().type()); |
| 1211 DestroyChannels(); | 1202 DestroyChannels(); |
| 1212 } | 1203 } |
| 1213 | 1204 |
| 1214 // Test that if remote candidates don't have ufrag and pwd, we still work. | 1205 // Test that if remote candidates don't have ufrag and pwd, we still work. |
| 1215 TEST_F(P2PTransportChannelTest, RemoteCandidatesWithoutUfragPwd) { | 1206 TEST_F(P2PTransportChannelTest, RemoteCandidatesWithoutUfragPwd) { |
| 1216 set_clear_remote_candidates_ufrag_pwd(true); | 1207 set_clear_remote_candidates_ufrag_pwd(true); |
| 1217 ConfigureEndpoints(OPEN, OPEN, | 1208 ConfigureEndpoints(OPEN, OPEN, kDefaultPortAllocatorFlags, |
| 1218 kDefaultPortAllocatorFlags, | |
| 1219 kDefaultPortAllocatorFlags); | 1209 kDefaultPortAllocatorFlags); |
| 1220 CreateChannels(1); | 1210 CreateChannels(1); |
| 1221 const cricket::Connection* best_connection = NULL; | 1211 const cricket::Connection* best_connection = NULL; |
| 1222 // Wait until the callee's connections are created. | 1212 // Wait until the callee's connections are created. |
| 1223 WAIT((best_connection = ep2_ch1()->best_connection()) != NULL, 1000); | 1213 WAIT((best_connection = ep2_ch1()->best_connection()) != NULL, 1000); |
| 1224 // Wait to see if they get culled; they shouldn't. | 1214 // Wait to see if they get culled; they shouldn't. |
| 1225 WAIT(ep2_ch1()->best_connection() != best_connection, 1000); | 1215 WAIT(ep2_ch1()->best_connection() != best_connection, 1000); |
| 1226 EXPECT_TRUE(ep2_ch1()->best_connection() == best_connection); | 1216 EXPECT_TRUE(ep2_ch1()->best_connection() == best_connection); |
| 1227 DestroyChannels(); | 1217 DestroyChannels(); |
| 1228 } | 1218 } |
| 1229 | 1219 |
| 1230 // Test that a host behind NAT cannot be reached when incoming_only | 1220 // Test that a host behind NAT cannot be reached when incoming_only |
| 1231 // is set to true. | 1221 // is set to true. |
| 1232 TEST_F(P2PTransportChannelTest, IncomingOnlyBlocked) { | 1222 TEST_F(P2PTransportChannelTest, IncomingOnlyBlocked) { |
| 1233 ConfigureEndpoints(NAT_FULL_CONE, OPEN, | 1223 ConfigureEndpoints(NAT_FULL_CONE, OPEN, kDefaultPortAllocatorFlags, |
| 1234 kDefaultPortAllocatorFlags, | |
| 1235 kDefaultPortAllocatorFlags); | 1224 kDefaultPortAllocatorFlags); |
| 1236 | 1225 |
| 1237 SetAllocatorFlags(0, kOnlyLocalPorts); | 1226 SetAllocatorFlags(0, kOnlyLocalPorts); |
| 1238 CreateChannels(1); | 1227 CreateChannels(1); |
| 1239 ep1_ch1()->set_incoming_only(true); | 1228 ep1_ch1()->set_incoming_only(true); |
| 1240 | 1229 |
| 1241 // Pump for 1 second and verify that the channels are not connected. | 1230 // Pump for 1 second and verify that the channels are not connected. |
| 1242 rtc::Thread::Current()->ProcessMessages(1000); | 1231 rtc::Thread::Current()->ProcessMessages(1000); |
| 1243 | 1232 |
| 1244 EXPECT_FALSE(ep1_ch1()->readable()); | 1233 EXPECT_FALSE(ep1_ch1()->readable()); |
| 1245 EXPECT_FALSE(ep1_ch1()->writable()); | 1234 EXPECT_FALSE(ep1_ch1()->writable()); |
| 1246 EXPECT_FALSE(ep2_ch1()->readable()); | 1235 EXPECT_FALSE(ep2_ch1()->readable()); |
| 1247 EXPECT_FALSE(ep2_ch1()->writable()); | 1236 EXPECT_FALSE(ep2_ch1()->writable()); |
| 1248 | 1237 |
| 1249 DestroyChannels(); | 1238 DestroyChannels(); |
| 1250 } | 1239 } |
| 1251 | 1240 |
| 1252 // Test that a peer behind NAT can connect to a peer that has | 1241 // Test that a peer behind NAT can connect to a peer that has |
| 1253 // incoming_only flag set. | 1242 // incoming_only flag set. |
| 1254 TEST_F(P2PTransportChannelTest, IncomingOnlyOpen) { | 1243 TEST_F(P2PTransportChannelTest, IncomingOnlyOpen) { |
| 1255 ConfigureEndpoints(OPEN, NAT_FULL_CONE, | 1244 ConfigureEndpoints(OPEN, NAT_FULL_CONE, kDefaultPortAllocatorFlags, |
| 1256 kDefaultPortAllocatorFlags, | |
| 1257 kDefaultPortAllocatorFlags); | 1245 kDefaultPortAllocatorFlags); |
| 1258 | 1246 |
| 1259 SetAllocatorFlags(0, kOnlyLocalPorts); | 1247 SetAllocatorFlags(0, kOnlyLocalPorts); |
| 1260 CreateChannels(1); | 1248 CreateChannels(1); |
| 1261 ep1_ch1()->set_incoming_only(true); | 1249 ep1_ch1()->set_incoming_only(true); |
| 1262 | 1250 |
| 1263 EXPECT_TRUE_WAIT_MARGIN(ep1_ch1() != NULL && ep2_ch1() != NULL && | 1251 EXPECT_TRUE_WAIT_MARGIN(ep1_ch1() != NULL && ep2_ch1() != NULL && |
| 1264 ep1_ch1()->readable() && ep1_ch1()->writable() && | 1252 ep1_ch1()->readable() && ep1_ch1()->writable() && |
| 1265 ep2_ch1()->readable() && ep2_ch1()->writable(), | 1253 ep2_ch1()->readable() && ep2_ch1()->writable(), |
| 1266 1000, 1000); | 1254 1000, 1000); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1407 ep1_ch1()->best_connection() && ep2_ch1()->best_connection() && | 1395 ep1_ch1()->best_connection() && ep2_ch1()->best_connection() && |
| 1408 LocalCandidate(ep1_ch1())->address().EqualIPs(kIPv6PublicAddrs[0]) && | 1396 LocalCandidate(ep1_ch1())->address().EqualIPs(kIPv6PublicAddrs[0]) && |
| 1409 RemoteCandidate(ep1_ch1())->address().EqualIPs(kIPv6PublicAddrs[1])); | 1397 RemoteCandidate(ep1_ch1())->address().EqualIPs(kIPv6PublicAddrs[1])); |
| 1410 | 1398 |
| 1411 TestSendRecv(1); | 1399 TestSendRecv(1); |
| 1412 DestroyChannels(); | 1400 DestroyChannels(); |
| 1413 } | 1401 } |
| 1414 | 1402 |
| 1415 // Testing forceful TURN connections. | 1403 // Testing forceful TURN connections. |
| 1416 TEST_F(P2PTransportChannelTest, TestForceTurn) { | 1404 TEST_F(P2PTransportChannelTest, TestForceTurn) { |
| 1417 ConfigureEndpoints(NAT_PORT_RESTRICTED, NAT_SYMMETRIC, | 1405 ConfigureEndpoints( |
| 1418 kDefaultPortAllocatorFlags | | 1406 NAT_PORT_RESTRICTED, NAT_SYMMETRIC, |
| 1419 cricket::PORTALLOCATOR_ENABLE_SHARED_SOCKET, | 1407 kDefaultPortAllocatorFlags | cricket::PORTALLOCATOR_ENABLE_SHARED_SOCKET, |
| 1420 kDefaultPortAllocatorFlags | | 1408 kDefaultPortAllocatorFlags | cricket::PORTALLOCATOR_ENABLE_SHARED_SOCKET); |
| 1421 cricket::PORTALLOCATOR_ENABLE_SHARED_SOCKET); | |
| 1422 set_force_relay(true); | 1409 set_force_relay(true); |
| 1423 | 1410 |
| 1424 SetAllocationStepDelay(0, kMinimumStepDelay); | 1411 SetAllocationStepDelay(0, kMinimumStepDelay); |
| 1425 SetAllocationStepDelay(1, kMinimumStepDelay); | 1412 SetAllocationStepDelay(1, kMinimumStepDelay); |
| 1426 | 1413 |
| 1427 CreateChannels(1); | 1414 CreateChannels(1); |
| 1428 | 1415 |
| 1429 EXPECT_TRUE_WAIT(ep1_ch1()->readable() && | 1416 EXPECT_TRUE_WAIT(ep1_ch1()->readable() && ep1_ch1()->writable() && |
| 1430 ep1_ch1()->writable() && | 1417 ep2_ch1()->readable() && ep2_ch1()->writable(), |
| 1431 ep2_ch1()->readable() && | |
| 1432 ep2_ch1()->writable(), | |
| 1433 2000); | 1418 2000); |
| 1434 | 1419 |
| 1435 EXPECT_TRUE(ep1_ch1()->best_connection() && | 1420 EXPECT_TRUE(ep1_ch1()->best_connection() && |
| 1436 ep2_ch1()->best_connection()); | 1421 ep2_ch1()->best_connection()); |
| 1437 | 1422 |
| 1438 EXPECT_EQ("relay", RemoteCandidate(ep1_ch1())->type()); | 1423 EXPECT_EQ("relay", RemoteCandidate(ep1_ch1())->type()); |
| 1439 EXPECT_EQ("relay", LocalCandidate(ep1_ch1())->type()); | 1424 EXPECT_EQ("relay", LocalCandidate(ep1_ch1())->type()); |
| 1440 EXPECT_EQ("relay", RemoteCandidate(ep2_ch1())->type()); | 1425 EXPECT_EQ("relay", RemoteCandidate(ep2_ch1())->type()); |
| 1441 EXPECT_EQ("relay", LocalCandidate(ep2_ch1())->type()); | 1426 EXPECT_EQ("relay", LocalCandidate(ep2_ch1())->type()); |
| 1442 | 1427 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1468 nat->AddTranslator(kPrivateAddrs[endpoint], kCascadedNatAddrs[endpoint], | 1453 nat->AddTranslator(kPrivateAddrs[endpoint], kCascadedNatAddrs[endpoint], |
| 1469 static_cast<rtc::NATType>(config - NAT_FULL_CONE))->AddClient( | 1454 static_cast<rtc::NATType>(config - NAT_FULL_CONE))->AddClient( |
| 1470 kCascadedPrivateAddrs[endpoint]); | 1455 kCascadedPrivateAddrs[endpoint]); |
| 1471 } | 1456 } |
| 1472 } | 1457 } |
| 1473 }; | 1458 }; |
| 1474 | 1459 |
| 1475 TEST_F(P2PTransportChannelSameNatTest, TestConesBehindSameCone) { | 1460 TEST_F(P2PTransportChannelSameNatTest, TestConesBehindSameCone) { |
| 1476 ConfigureEndpoints(NAT_FULL_CONE, NAT_FULL_CONE, NAT_FULL_CONE); | 1461 ConfigureEndpoints(NAT_FULL_CONE, NAT_FULL_CONE, NAT_FULL_CONE); |
| 1477 Test(P2PTransportChannelTestBase::Result( | 1462 Test(P2PTransportChannelTestBase::Result( |
| 1478 "prflx", "udp", "stun", "udp", | 1463 "prflx", "udp", "stun", "udp", "stun", "udp", "prflx", "udp", 1000)); |
| 1479 "stun", "udp", "prflx", "udp", 1000)); | |
| 1480 } | 1464 } |
| 1481 | 1465 |
| 1482 // Test what happens when we have multiple available pathways. | 1466 // Test what happens when we have multiple available pathways. |
| 1483 // In the future we will try different RTTs and configs for the different | 1467 // In the future we will try different RTTs and configs for the different |
| 1484 // interfaces, so that we can simulate a user with Ethernet and VPN networks. | 1468 // interfaces, so that we can simulate a user with Ethernet and VPN networks. |
| 1485 class P2PTransportChannelMultihomedTest : public P2PTransportChannelTestBase { | 1469 class P2PTransportChannelMultihomedTest : public P2PTransportChannelTestBase { |
| 1486 }; | 1470 }; |
| 1487 | 1471 |
| 1488 // Test that we can establish connectivity when both peers are multihomed. | 1472 // Test that we can establish connectivity when both peers are multihomed. |
| 1489 TEST_F(P2PTransportChannelMultihomedTest, DISABLED_TestBasic) { | 1473 TEST_F(P2PTransportChannelMultihomedTest, DISABLED_TestBasic) { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1586 class P2PTransportChannelPingTest : public testing::Test, | 1570 class P2PTransportChannelPingTest : public testing::Test, |
| 1587 public sigslot::has_slots<> { | 1571 public sigslot::has_slots<> { |
| 1588 public: | 1572 public: |
| 1589 P2PTransportChannelPingTest() | 1573 P2PTransportChannelPingTest() |
| 1590 : pss_(new rtc::PhysicalSocketServer), | 1574 : pss_(new rtc::PhysicalSocketServer), |
| 1591 vss_(new rtc::VirtualSocketServer(pss_.get())), | 1575 vss_(new rtc::VirtualSocketServer(pss_.get())), |
| 1592 ss_scope_(vss_.get()) {} | 1576 ss_scope_(vss_.get()) {} |
| 1593 | 1577 |
| 1594 protected: | 1578 protected: |
| 1595 void PrepareChannel(cricket::P2PTransportChannel* ch) { | 1579 void PrepareChannel(cricket::P2PTransportChannel* ch) { |
| 1596 ch->SignalRequestSignaling.connect( | |
| 1597 this, &P2PTransportChannelPingTest::OnChannelRequestSignaling); | |
| 1598 ch->SetIceRole(cricket::ICEROLE_CONTROLLING); | 1580 ch->SetIceRole(cricket::ICEROLE_CONTROLLING); |
| 1599 ch->SetIceCredentials(kIceUfrag[0], kIcePwd[0]); | 1581 ch->SetIceCredentials(kIceUfrag[0], kIcePwd[0]); |
| 1600 ch->SetRemoteIceCredentials(kIceUfrag[1], kIcePwd[1]); | 1582 ch->SetRemoteIceCredentials(kIceUfrag[1], kIcePwd[1]); |
| 1601 } | 1583 } |
| 1602 | 1584 |
| 1603 void OnChannelRequestSignaling(cricket::TransportChannelImpl* channel) { | |
| 1604 channel->OnSignalingReady(); | |
| 1605 } | |
| 1606 | |
| 1607 cricket::Candidate CreateCandidate(const std::string& ip, | 1585 cricket::Candidate CreateCandidate(const std::string& ip, |
| 1608 int port, | 1586 int port, |
| 1609 int priority) { | 1587 int priority) { |
| 1610 cricket::Candidate c; | 1588 cricket::Candidate c; |
| 1611 c.set_address(rtc::SocketAddress(ip, port)); | 1589 c.set_address(rtc::SocketAddress(ip, port)); |
| 1612 c.set_component(1); | 1590 c.set_component(1); |
| 1613 c.set_protocol(cricket::UDP_PROTOCOL_NAME); | 1591 c.set_protocol(cricket::UDP_PROTOCOL_NAME); |
| 1614 c.set_priority(priority); | 1592 c.set_priority(priority); |
| 1615 return c; | 1593 return c; |
| 1616 } | 1594 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1643 rtc::scoped_ptr<rtc::PhysicalSocketServer> pss_; | 1621 rtc::scoped_ptr<rtc::PhysicalSocketServer> pss_; |
| 1644 rtc::scoped_ptr<rtc::VirtualSocketServer> vss_; | 1622 rtc::scoped_ptr<rtc::VirtualSocketServer> vss_; |
| 1645 rtc::SocketServerScope ss_scope_; | 1623 rtc::SocketServerScope ss_scope_; |
| 1646 }; | 1624 }; |
| 1647 | 1625 |
| 1648 TEST_F(P2PTransportChannelPingTest, TestTriggeredChecks) { | 1626 TEST_F(P2PTransportChannelPingTest, TestTriggeredChecks) { |
| 1649 cricket::FakePortAllocator pa(rtc::Thread::Current(), nullptr); | 1627 cricket::FakePortAllocator pa(rtc::Thread::Current(), nullptr); |
| 1650 cricket::P2PTransportChannel ch("trigger checks", 1, nullptr, &pa); | 1628 cricket::P2PTransportChannel ch("trigger checks", 1, nullptr, &pa); |
| 1651 PrepareChannel(&ch); | 1629 PrepareChannel(&ch); |
| 1652 ch.Connect(); | 1630 ch.Connect(); |
| 1653 ch.OnCandidate(CreateCandidate("1.1.1.1", 1, 1)); | 1631 ch.AddRemoteCandidate(CreateCandidate("1.1.1.1", 1, 1)); |
| 1654 ch.OnCandidate(CreateCandidate("2.2.2.2", 2, 2)); | 1632 ch.AddRemoteCandidate(CreateCandidate("2.2.2.2", 2, 2)); |
| 1655 | 1633 |
| 1656 cricket::Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1); | 1634 cricket::Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1); |
| 1657 cricket::Connection* conn2 = WaitForConnectionTo(&ch, "2.2.2.2", 2); | 1635 cricket::Connection* conn2 = WaitForConnectionTo(&ch, "2.2.2.2", 2); |
| 1658 ASSERT_TRUE(conn1 != nullptr); | 1636 ASSERT_TRUE(conn1 != nullptr); |
| 1659 ASSERT_TRUE(conn2 != nullptr); | 1637 ASSERT_TRUE(conn2 != nullptr); |
| 1660 | 1638 |
| 1661 // Before a triggered check, the first connection to ping is the | 1639 // Before a triggered check, the first connection to ping is the |
| 1662 // highest priority one. | 1640 // highest priority one. |
| 1663 EXPECT_EQ(conn2, ch.FindNextPingableConnection()); | 1641 EXPECT_EQ(conn2, ch.FindNextPingableConnection()); |
| 1664 | 1642 |
| 1665 // Receiving a ping causes a triggered check which should make conn1 | 1643 // Receiving a ping causes a triggered check which should make conn1 |
| 1666 // be pinged first instead of conn2, even though conn2 has a higher | 1644 // be pinged first instead of conn2, even though conn2 has a higher |
| 1667 // priority. | 1645 // priority. |
| 1668 conn1->ReceivedPing(); | 1646 conn1->ReceivedPing(); |
| 1669 EXPECT_EQ(conn1, ch.FindNextPingableConnection()); | 1647 EXPECT_EQ(conn1, ch.FindNextPingableConnection()); |
| 1670 } | 1648 } |
| 1671 | 1649 |
| 1672 TEST_F(P2PTransportChannelPingTest, TestNoTriggeredChecksWhenWritable) { | 1650 TEST_F(P2PTransportChannelPingTest, TestNoTriggeredChecksWhenWritable) { |
| 1673 cricket::FakePortAllocator pa(rtc::Thread::Current(), nullptr); | 1651 cricket::FakePortAllocator pa(rtc::Thread::Current(), nullptr); |
| 1674 cricket::P2PTransportChannel ch("trigger checks", 1, nullptr, &pa); | 1652 cricket::P2PTransportChannel ch("trigger checks", 1, nullptr, &pa); |
| 1675 PrepareChannel(&ch); | 1653 PrepareChannel(&ch); |
| 1676 ch.Connect(); | 1654 ch.Connect(); |
| 1677 ch.OnCandidate(CreateCandidate("1.1.1.1", 1, 1)); | 1655 ch.AddRemoteCandidate(CreateCandidate("1.1.1.1", 1, 1)); |
| 1678 ch.OnCandidate(CreateCandidate("2.2.2.2", 2, 2)); | 1656 ch.AddRemoteCandidate(CreateCandidate("2.2.2.2", 2, 2)); |
| 1679 | 1657 |
| 1680 cricket::Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1); | 1658 cricket::Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1); |
| 1681 cricket::Connection* conn2 = WaitForConnectionTo(&ch, "2.2.2.2", 2); | 1659 cricket::Connection* conn2 = WaitForConnectionTo(&ch, "2.2.2.2", 2); |
| 1682 ASSERT_TRUE(conn1 != nullptr); | 1660 ASSERT_TRUE(conn1 != nullptr); |
| 1683 ASSERT_TRUE(conn2 != nullptr); | 1661 ASSERT_TRUE(conn2 != nullptr); |
| 1684 | 1662 |
| 1685 EXPECT_EQ(conn2, ch.FindNextPingableConnection()); | 1663 EXPECT_EQ(conn2, ch.FindNextPingableConnection()); |
| 1686 conn1->ReceivedPingResponse(); | 1664 conn1->ReceivedPingResponse(); |
| 1687 ASSERT_TRUE(conn1->writable()); | 1665 ASSERT_TRUE(conn1->writable()); |
| 1688 conn1->ReceivedPing(); | 1666 conn1->ReceivedPing(); |
| 1689 | 1667 |
| 1690 // Ping received, but the connection is already writable, so no | 1668 // Ping received, but the connection is already writable, so no |
| 1691 // "triggered check" and conn2 is pinged before conn1 because it has | 1669 // "triggered check" and conn2 is pinged before conn1 because it has |
| 1692 // a higher priority. | 1670 // a higher priority. |
| 1693 EXPECT_EQ(conn2, ch.FindNextPingableConnection()); | 1671 EXPECT_EQ(conn2, ch.FindNextPingableConnection()); |
| 1694 } | 1672 } |
| 1695 | 1673 |
| 1696 TEST_F(P2PTransportChannelPingTest, ConnectionResurrection) { | 1674 TEST_F(P2PTransportChannelPingTest, ConnectionResurrection) { |
| 1697 cricket::FakePortAllocator pa(rtc::Thread::Current(), nullptr); | 1675 cricket::FakePortAllocator pa(rtc::Thread::Current(), nullptr); |
| 1698 cricket::P2PTransportChannel ch("connection resurrection", 1, nullptr, &pa); | 1676 cricket::P2PTransportChannel ch("connection resurrection", 1, nullptr, &pa); |
| 1699 PrepareChannel(&ch); | 1677 PrepareChannel(&ch); |
| 1700 ch.Connect(); | 1678 ch.Connect(); |
| 1701 | 1679 |
| 1702 // Create conn1 and keep track of original candidate priority. | 1680 // Create conn1 and keep track of original candidate priority. |
| 1703 ch.OnCandidate(CreateCandidate("1.1.1.1", 1, 1)); | 1681 ch.AddRemoteCandidate(CreateCandidate("1.1.1.1", 1, 1)); |
| 1704 cricket::Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1); | 1682 cricket::Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1); |
| 1705 ASSERT_TRUE(conn1 != nullptr); | 1683 ASSERT_TRUE(conn1 != nullptr); |
| 1706 uint32 remote_priority = conn1->remote_candidate().priority(); | 1684 uint32 remote_priority = conn1->remote_candidate().priority(); |
| 1707 | 1685 |
| 1708 // Create a higher priority candidate and make the connection | 1686 // Create a higher priority candidate and make the connection |
| 1709 // readable/writable. This will prune conn1. | 1687 // readable/writable. This will prune conn1. |
| 1710 ch.OnCandidate(CreateCandidate("2.2.2.2", 2, 2)); | 1688 ch.AddRemoteCandidate(CreateCandidate("2.2.2.2", 2, 2)); |
| 1711 cricket::Connection* conn2 = WaitForConnectionTo(&ch, "2.2.2.2", 2); | 1689 cricket::Connection* conn2 = WaitForConnectionTo(&ch, "2.2.2.2", 2); |
| 1712 ASSERT_TRUE(conn2 != nullptr); | 1690 ASSERT_TRUE(conn2 != nullptr); |
| 1713 conn2->ReceivedPing(); | 1691 conn2->ReceivedPing(); |
| 1714 conn2->ReceivedPingResponse(); | 1692 conn2->ReceivedPingResponse(); |
| 1715 | 1693 |
| 1716 // Wait for conn1 being destroyed. | 1694 // Wait for conn1 being destroyed. |
| 1717 EXPECT_TRUE_WAIT(GetConnectionTo(&ch, "1.1.1.1", 1) == nullptr, 3000); | 1695 EXPECT_TRUE_WAIT(GetConnectionTo(&ch, "1.1.1.1", 1) == nullptr, 3000); |
| 1718 cricket::Port* port = GetPort(&ch); | 1696 cricket::Port* port = GetPort(&ch); |
| 1719 | 1697 |
| 1720 // Create a minimal STUN message with prflx priority. | 1698 // Create a minimal STUN message with prflx priority. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1747 cricket::P2PTransportChannel ch("receiving state change", 1, nullptr, &pa); | 1725 cricket::P2PTransportChannel ch("receiving state change", 1, nullptr, &pa); |
| 1748 PrepareChannel(&ch); | 1726 PrepareChannel(&ch); |
| 1749 // Default receiving timeout and checking receiving delay should not be too | 1727 // Default receiving timeout and checking receiving delay should not be too |
| 1750 // small. | 1728 // small. |
| 1751 EXPECT_LE(1000, ch.receiving_timeout()); | 1729 EXPECT_LE(1000, ch.receiving_timeout()); |
| 1752 EXPECT_LE(200, ch.check_receiving_delay()); | 1730 EXPECT_LE(200, ch.check_receiving_delay()); |
| 1753 ch.SetReceivingTimeout(500); | 1731 ch.SetReceivingTimeout(500); |
| 1754 EXPECT_EQ(500, ch.receiving_timeout()); | 1732 EXPECT_EQ(500, ch.receiving_timeout()); |
| 1755 EXPECT_EQ(50, ch.check_receiving_delay()); | 1733 EXPECT_EQ(50, ch.check_receiving_delay()); |
| 1756 ch.Connect(); | 1734 ch.Connect(); |
| 1757 ch.OnCandidate(CreateCandidate("1.1.1.1", 1, 1)); | 1735 ch.AddRemoteCandidate(CreateCandidate("1.1.1.1", 1, 1)); |
| 1758 cricket::Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1); | 1736 cricket::Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1); |
| 1759 ASSERT_TRUE(conn1 != nullptr); | 1737 ASSERT_TRUE(conn1 != nullptr); |
| 1760 | 1738 |
| 1761 conn1->ReceivedPing(); | 1739 conn1->ReceivedPing(); |
| 1762 conn1->OnReadPacket("ABC", 3, rtc::CreatePacketTime(0)); | 1740 conn1->OnReadPacket("ABC", 3, rtc::CreatePacketTime(0)); |
| 1763 EXPECT_TRUE_WAIT(ch.best_connection() != nullptr, 1000) | 1741 EXPECT_TRUE_WAIT(ch.best_connection() != nullptr, 1000) |
| 1764 EXPECT_TRUE_WAIT(ch.receiving(), 1000); | 1742 EXPECT_TRUE_WAIT(ch.receiving(), 1000); |
| 1765 EXPECT_TRUE_WAIT(!ch.receiving(), 1000); | 1743 EXPECT_TRUE_WAIT(!ch.receiving(), 1000); |
| 1766 } | 1744 } |
| 1767 | 1745 |
| 1768 // The controlled side will select a connection as the "best connection" based | 1746 // The controlled side will select a connection as the "best connection" based |
| 1769 // on priority until the controlling side nominates a connection, at which | 1747 // on priority until the controlling side nominates a connection, at which |
| 1770 // point the controlled side will select that connection as the | 1748 // point the controlled side will select that connection as the |
| 1771 // "best connection". | 1749 // "best connection". |
| 1772 TEST_F(P2PTransportChannelPingTest, TestSelectConnectionBeforeNomination) { | 1750 TEST_F(P2PTransportChannelPingTest, TestSelectConnectionBeforeNomination) { |
| 1773 cricket::FakePortAllocator pa(rtc::Thread::Current(), nullptr); | 1751 cricket::FakePortAllocator pa(rtc::Thread::Current(), nullptr); |
| 1774 cricket::P2PTransportChannel ch("receiving state change", 1, nullptr, &pa); | 1752 cricket::P2PTransportChannel ch("receiving state change", 1, nullptr, &pa); |
| 1775 PrepareChannel(&ch); | 1753 PrepareChannel(&ch); |
| 1776 ch.SetIceRole(cricket::ICEROLE_CONTROLLED); | 1754 ch.SetIceRole(cricket::ICEROLE_CONTROLLED); |
| 1777 ch.Connect(); | 1755 ch.Connect(); |
| 1778 ch.OnCandidate(CreateCandidate("1.1.1.1", 1, 1)); | 1756 ch.AddRemoteCandidate(CreateCandidate("1.1.1.1", 1, 1)); |
| 1779 cricket::Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1); | 1757 cricket::Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1); |
| 1780 ASSERT_TRUE(conn1 != nullptr); | 1758 ASSERT_TRUE(conn1 != nullptr); |
| 1781 EXPECT_EQ(conn1, ch.best_connection()); | 1759 EXPECT_EQ(conn1, ch.best_connection()); |
| 1782 | 1760 |
| 1783 // When a higher priority candidate comes in, the new connection is chosen | 1761 // When a higher priority candidate comes in, the new connection is chosen |
| 1784 // as the best connection. | 1762 // as the best connection. |
| 1785 ch.OnCandidate(CreateCandidate("2.2.2.2", 2, 10)); | 1763 ch.AddRemoteCandidate(CreateCandidate("2.2.2.2", 2, 10)); |
| 1786 cricket::Connection* conn2 = WaitForConnectionTo(&ch, "2.2.2.2", 2); | 1764 cricket::Connection* conn2 = WaitForConnectionTo(&ch, "2.2.2.2", 2); |
| 1787 ASSERT_TRUE(conn1 != nullptr); | 1765 ASSERT_TRUE(conn1 != nullptr); |
| 1788 EXPECT_EQ(conn2, ch.best_connection()); | 1766 EXPECT_EQ(conn2, ch.best_connection()); |
| 1789 | 1767 |
| 1790 // If a stun request with use-candidate attribute arrives, the receiving | 1768 // If a stun request with use-candidate attribute arrives, the receiving |
| 1791 // connection will be set as the best connection, even though | 1769 // connection will be set as the best connection, even though |
| 1792 // its priority is lower. | 1770 // its priority is lower. |
| 1793 ch.OnCandidate(CreateCandidate("3.3.3.3", 3, 1)); | 1771 ch.AddRemoteCandidate(CreateCandidate("3.3.3.3", 3, 1)); |
| 1794 cricket::Connection* conn3 = WaitForConnectionTo(&ch, "3.3.3.3", 3); | 1772 cricket::Connection* conn3 = WaitForConnectionTo(&ch, "3.3.3.3", 3); |
| 1795 ASSERT_TRUE(conn3 != nullptr); | 1773 ASSERT_TRUE(conn3 != nullptr); |
| 1796 // Because it has a lower priority, the best connection is still conn2. | 1774 // Because it has a lower priority, the best connection is still conn2. |
| 1797 EXPECT_EQ(conn2, ch.best_connection()); | 1775 EXPECT_EQ(conn2, ch.best_connection()); |
| 1798 conn3->ReceivedPingResponse(); // Become writable. | 1776 conn3->ReceivedPingResponse(); // Become writable. |
| 1799 // But if it is nominated via use_candidate, it is chosen as the best | 1777 // But if it is nominated via use_candidate, it is chosen as the best |
| 1800 // connection. | 1778 // connection. |
| 1801 conn3->set_nominated(true); | 1779 conn3->set_nominated(true); |
| 1802 conn3->SignalNominated(conn3); | 1780 conn3->SignalNominated(conn3); |
| 1803 EXPECT_EQ(conn3, ch.best_connection()); | 1781 EXPECT_EQ(conn3, ch.best_connection()); |
| 1804 | 1782 |
| 1805 // Even if another higher priority candidate arrives, | 1783 // Even if another higher priority candidate arrives, |
| 1806 // it will not be set as the best connection because the best connection | 1784 // it will not be set as the best connection because the best connection |
| 1807 // is nominated by the controlling side. | 1785 // is nominated by the controlling side. |
| 1808 ch.OnCandidate(CreateCandidate("4.4.4.4", 4, 100)); | 1786 ch.AddRemoteCandidate(CreateCandidate("4.4.4.4", 4, 100)); |
| 1809 cricket::Connection* conn4 = WaitForConnectionTo(&ch, "4.4.4.4", 4); | 1787 cricket::Connection* conn4 = WaitForConnectionTo(&ch, "4.4.4.4", 4); |
| 1810 ASSERT_TRUE(conn4 != nullptr); | 1788 ASSERT_TRUE(conn4 != nullptr); |
| 1811 EXPECT_EQ(conn3, ch.best_connection()); | 1789 EXPECT_EQ(conn3, ch.best_connection()); |
| 1812 // But if it is nominated via use_candidate and writable, it will be set as | 1790 // But if it is nominated via use_candidate and writable, it will be set as |
| 1813 // the best connection. | 1791 // the best connection. |
| 1814 conn4->set_nominated(true); | 1792 conn4->set_nominated(true); |
| 1815 conn4->SignalNominated(conn4); | 1793 conn4->SignalNominated(conn4); |
| 1816 // Not switched yet because conn4 is not writable. | 1794 // Not switched yet because conn4 is not writable. |
| 1817 EXPECT_EQ(conn3, ch.best_connection()); | 1795 EXPECT_EQ(conn3, ch.best_connection()); |
| 1818 // The best connection switches after conn4 becomes writable. | 1796 // The best connection switches after conn4 becomes writable. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1841 cricket::Port* port = GetPort(&ch); | 1819 cricket::Port* port = GetPort(&ch); |
| 1842 port->SignalUnknownAddress(port, rtc::SocketAddress("1.1.1.1", 1), | 1820 port->SignalUnknownAddress(port, rtc::SocketAddress("1.1.1.1", 1), |
| 1843 cricket::PROTO_UDP, &request, kIceUfrag[1], false); | 1821 cricket::PROTO_UDP, &request, kIceUfrag[1], false); |
| 1844 cricket::Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1); | 1822 cricket::Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1); |
| 1845 ASSERT_TRUE(conn1 != nullptr); | 1823 ASSERT_TRUE(conn1 != nullptr); |
| 1846 EXPECT_EQ(conn1, ch.best_connection()); | 1824 EXPECT_EQ(conn1, ch.best_connection()); |
| 1847 conn1->ReceivedPingResponse(); | 1825 conn1->ReceivedPingResponse(); |
| 1848 EXPECT_EQ(conn1, ch.best_connection()); | 1826 EXPECT_EQ(conn1, ch.best_connection()); |
| 1849 | 1827 |
| 1850 // Another connection is nominated via use_candidate. | 1828 // Another connection is nominated via use_candidate. |
| 1851 ch.OnCandidate(CreateCandidate("2.2.2.2", 2, 1)); | 1829 ch.AddRemoteCandidate(CreateCandidate("2.2.2.2", 2, 1)); |
| 1852 cricket::Connection* conn2 = WaitForConnectionTo(&ch, "2.2.2.2", 2); | 1830 cricket::Connection* conn2 = WaitForConnectionTo(&ch, "2.2.2.2", 2); |
| 1853 ASSERT_TRUE(conn2 != nullptr); | 1831 ASSERT_TRUE(conn2 != nullptr); |
| 1854 // Because it has a lower priority, the best connection is still conn1. | 1832 // Because it has a lower priority, the best connection is still conn1. |
| 1855 EXPECT_EQ(conn1, ch.best_connection()); | 1833 EXPECT_EQ(conn1, ch.best_connection()); |
| 1856 // When it is nominated via use_candidate and writable, it is chosen as the | 1834 // When it is nominated via use_candidate and writable, it is chosen as the |
| 1857 // best connection. | 1835 // best connection. |
| 1858 conn2->ReceivedPingResponse(); // Become writable. | 1836 conn2->ReceivedPingResponse(); // Become writable. |
| 1859 conn2->set_nominated(true); | 1837 conn2->set_nominated(true); |
| 1860 conn2->SignalNominated(conn2); | 1838 conn2->SignalNominated(conn2); |
| 1861 EXPECT_EQ(conn2, ch.best_connection()); | 1839 EXPECT_EQ(conn2, ch.best_connection()); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1887 // The controlled side will select a connection as the "best connection" | 1865 // The controlled side will select a connection as the "best connection" |
| 1888 // based on media received until the controlling side nominates a connection, | 1866 // based on media received until the controlling side nominates a connection, |
| 1889 // at which point the controlled side will select that connection as | 1867 // at which point the controlled side will select that connection as |
| 1890 // the "best connection". | 1868 // the "best connection". |
| 1891 TEST_F(P2PTransportChannelPingTest, TestSelectConnectionBasedOnMediaReceived) { | 1869 TEST_F(P2PTransportChannelPingTest, TestSelectConnectionBasedOnMediaReceived) { |
| 1892 cricket::FakePortAllocator pa(rtc::Thread::Current(), nullptr); | 1870 cricket::FakePortAllocator pa(rtc::Thread::Current(), nullptr); |
| 1893 cricket::P2PTransportChannel ch("receiving state change", 1, nullptr, &pa); | 1871 cricket::P2PTransportChannel ch("receiving state change", 1, nullptr, &pa); |
| 1894 PrepareChannel(&ch); | 1872 PrepareChannel(&ch); |
| 1895 ch.SetIceRole(cricket::ICEROLE_CONTROLLED); | 1873 ch.SetIceRole(cricket::ICEROLE_CONTROLLED); |
| 1896 ch.Connect(); | 1874 ch.Connect(); |
| 1897 ch.OnCandidate(CreateCandidate("1.1.1.1", 1, 10)); | 1875 ch.AddRemoteCandidate(CreateCandidate("1.1.1.1", 1, 10)); |
| 1898 cricket::Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1); | 1876 cricket::Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1); |
| 1899 ASSERT_TRUE(conn1 != nullptr); | 1877 ASSERT_TRUE(conn1 != nullptr); |
| 1900 EXPECT_EQ(conn1, ch.best_connection()); | 1878 EXPECT_EQ(conn1, ch.best_connection()); |
| 1901 | 1879 |
| 1902 // If a data packet is received on conn2, the best connection should | 1880 // If a data packet is received on conn2, the best connection should |
| 1903 // switch to conn2 because the controlled side must mirror the media path | 1881 // switch to conn2 because the controlled side must mirror the media path |
| 1904 // chosen by the controlling side. | 1882 // chosen by the controlling side. |
| 1905 ch.OnCandidate(CreateCandidate("2.2.2.2", 2, 1)); | 1883 ch.AddRemoteCandidate(CreateCandidate("2.2.2.2", 2, 1)); |
| 1906 cricket::Connection* conn2 = WaitForConnectionTo(&ch, "2.2.2.2", 2); | 1884 cricket::Connection* conn2 = WaitForConnectionTo(&ch, "2.2.2.2", 2); |
| 1907 ASSERT_TRUE(conn2 != nullptr); | 1885 ASSERT_TRUE(conn2 != nullptr); |
| 1908 conn2->ReceivedPing(); // Become readable. | 1886 conn2->ReceivedPing(); // Become readable. |
| 1909 // Do not switch because it is not writable. | 1887 // Do not switch because it is not writable. |
| 1910 conn2->OnReadPacket("ABC", 3, rtc::CreatePacketTime(0)); | 1888 conn2->OnReadPacket("ABC", 3, rtc::CreatePacketTime(0)); |
| 1911 EXPECT_EQ(conn1, ch.best_connection()); | 1889 EXPECT_EQ(conn1, ch.best_connection()); |
| 1912 | 1890 |
| 1913 conn2->ReceivedPingResponse(); // Become writable. | 1891 conn2->ReceivedPingResponse(); // Become writable. |
| 1914 // Switch because it is writable. | 1892 // Switch because it is writable. |
| 1915 conn2->OnReadPacket("DEF", 3, rtc::CreatePacketTime(0)); | 1893 conn2->OnReadPacket("DEF", 3, rtc::CreatePacketTime(0)); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1935 conn3->ReceivedPingResponse(); // Become writable. | 1913 conn3->ReceivedPingResponse(); // Become writable. |
| 1936 EXPECT_EQ(conn3, ch.best_connection()); | 1914 EXPECT_EQ(conn3, ch.best_connection()); |
| 1937 | 1915 |
| 1938 // Now another data packet will not switch the best connection because the | 1916 // Now another data packet will not switch the best connection because the |
| 1939 // best connection was nominated by the controlling side. | 1917 // best connection was nominated by the controlling side. |
| 1940 conn2->ReceivedPing(); | 1918 conn2->ReceivedPing(); |
| 1941 conn2->ReceivedPingResponse(); | 1919 conn2->ReceivedPingResponse(); |
| 1942 conn2->OnReadPacket("XYZ", 3, rtc::CreatePacketTime(0)); | 1920 conn2->OnReadPacket("XYZ", 3, rtc::CreatePacketTime(0)); |
| 1943 EXPECT_EQ(conn3, ch.best_connection()); | 1921 EXPECT_EQ(conn3, ch.best_connection()); |
| 1944 } | 1922 } |
| OLD | NEW |