OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2012 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 #if defined(WEBRTC_POSIX) | 10 #if defined(WEBRTC_POSIX) |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 static const cricket::ProtocolAddress kTurnUdpIPv6ProtoAddr( | 86 static const cricket::ProtocolAddress kTurnUdpIPv6ProtoAddr( |
87 kTurnUdpIPv6IntAddr, cricket::PROTO_UDP); | 87 kTurnUdpIPv6IntAddr, cricket::PROTO_UDP); |
88 | 88 |
89 static const unsigned int MSG_TESTFINISH = 0; | 89 static const unsigned int MSG_TESTFINISH = 0; |
90 | 90 |
91 #if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID) | 91 #if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID) |
92 static int GetFDCount() { | 92 static int GetFDCount() { |
93 struct dirent *dp; | 93 struct dirent *dp; |
94 int fd_count = 0; | 94 int fd_count = 0; |
95 DIR *dir = opendir("/proc/self/fd/"); | 95 DIR *dir = opendir("/proc/self/fd/"); |
96 while ((dp = readdir(dir)) != NULL) { | 96 while ((dp = readdir(dir)) != nullptr) { |
97 if (dp->d_name[0] == '.') | 97 if (dp->d_name[0] == '.') |
98 continue; | 98 continue; |
99 ++fd_count; | 99 ++fd_count; |
100 } | 100 } |
101 closedir(dir); | 101 closedir(dir); |
102 return fd_count; | 102 return fd_count; |
103 } | 103 } |
104 #endif | 104 #endif |
105 | 105 |
106 namespace cricket { | 106 namespace cricket { |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 } | 272 } |
273 | 273 |
274 void CreateSharedTurnPort(const std::string& username, | 274 void CreateSharedTurnPort(const std::string& username, |
275 const std::string& password, | 275 const std::string& password, |
276 const ProtocolAddress& server_address) { | 276 const ProtocolAddress& server_address) { |
277 RTC_CHECK(server_address.proto == PROTO_UDP); | 277 RTC_CHECK(server_address.proto == PROTO_UDP); |
278 | 278 |
279 if (!socket_) { | 279 if (!socket_) { |
280 socket_.reset(socket_factory_.CreateUdpSocket( | 280 socket_.reset(socket_factory_.CreateUdpSocket( |
281 rtc::SocketAddress(kLocalAddr1.ipaddr(), 0), 0, 0)); | 281 rtc::SocketAddress(kLocalAddr1.ipaddr(), 0), 0, 0)); |
282 ASSERT_TRUE(socket_ != NULL); | 282 ASSERT_TRUE(socket_ != nullptr); |
283 socket_->SignalReadPacket.connect( | 283 socket_->SignalReadPacket.connect( |
284 this, &TurnPortTest::OnSocketReadPacket); | 284 this, &TurnPortTest::OnSocketReadPacket); |
285 } | 285 } |
286 | 286 |
287 RelayCredentials credentials(username, password); | 287 RelayCredentials credentials(username, password); |
288 turn_port_.reset(TurnPort::Create( | 288 turn_port_.reset(TurnPort::Create( |
289 main_, &socket_factory_, &network_, socket_.get(), kIceUfrag1, kIcePwd1, | 289 main_, &socket_factory_, &network_, socket_.get(), kIceUfrag1, kIcePwd1, |
290 server_address, credentials, 0, std::string())); | 290 server_address, credentials, 0, std::string())); |
291 // This TURN port will be the controlling. | 291 // This TURN port will be the controlling. |
292 turn_port_->SetIceRole(ICEROLE_CONTROLLING); | 292 turn_port_->SetIceRole(ICEROLE_CONTROLLING); |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 } | 499 } |
500 } | 500 } |
501 | 501 |
502 void TestTurnConnection(ProtocolType protocol_type) { | 502 void TestTurnConnection(ProtocolType protocol_type) { |
503 // Create ports and prepare addresses. | 503 // Create ports and prepare addresses. |
504 PrepareTurnAndUdpPorts(protocol_type); | 504 PrepareTurnAndUdpPorts(protocol_type); |
505 | 505 |
506 // Send ping from UDP to TURN. | 506 // Send ping from UDP to TURN. |
507 Connection* conn1 = udp_port_->CreateConnection( | 507 Connection* conn1 = udp_port_->CreateConnection( |
508 turn_port_->Candidates()[0], Port::ORIGIN_MESSAGE); | 508 turn_port_->Candidates()[0], Port::ORIGIN_MESSAGE); |
509 ASSERT_TRUE(conn1 != NULL); | 509 ASSERT_TRUE(conn1 != nullptr); |
510 conn1->Ping(0); | 510 conn1->Ping(0); |
511 SIMULATED_WAIT(!turn_unknown_address_, kSimulatedRtt * 2, fake_clock_); | 511 SIMULATED_WAIT(!turn_unknown_address_, kSimulatedRtt * 2, fake_clock_); |
512 EXPECT_FALSE(turn_unknown_address_); | 512 EXPECT_FALSE(turn_unknown_address_); |
513 EXPECT_FALSE(conn1->receiving()); | 513 EXPECT_FALSE(conn1->receiving()); |
514 EXPECT_EQ(Connection::STATE_WRITE_INIT, conn1->write_state()); | 514 EXPECT_EQ(Connection::STATE_WRITE_INIT, conn1->write_state()); |
515 | 515 |
516 // Send ping from TURN to UDP. | 516 // Send ping from TURN to UDP. |
517 Connection* conn2 = turn_port_->CreateConnection( | 517 Connection* conn2 = turn_port_->CreateConnection( |
518 udp_port_->Candidates()[0], Port::ORIGIN_MESSAGE); | 518 udp_port_->Candidates()[0], Port::ORIGIN_MESSAGE); |
519 ASSERT_TRUE(conn2 != NULL); | 519 ASSERT_TRUE(conn2 != nullptr); |
520 ASSERT_TRUE_SIMULATED_WAIT(turn_create_permission_success_, kSimulatedRtt, | 520 ASSERT_TRUE_SIMULATED_WAIT(turn_create_permission_success_, kSimulatedRtt, |
521 fake_clock_); | 521 fake_clock_); |
522 conn2->Ping(0); | 522 conn2->Ping(0); |
523 | 523 |
524 // Two hops from TURN port to UDP port through TURN server, thus two RTTs. | 524 // Two hops from TURN port to UDP port through TURN server, thus two RTTs. |
525 EXPECT_EQ_SIMULATED_WAIT(Connection::STATE_WRITABLE, conn2->write_state(), | 525 EXPECT_EQ_SIMULATED_WAIT(Connection::STATE_WRITABLE, conn2->write_state(), |
526 kSimulatedRtt * 2, fake_clock_); | 526 kSimulatedRtt * 2, fake_clock_); |
527 EXPECT_TRUE(conn1->receiving()); | 527 EXPECT_TRUE(conn1->receiving()); |
528 EXPECT_TRUE(conn2->receiving()); | 528 EXPECT_TRUE(conn2->receiving()); |
529 EXPECT_EQ(Connection::STATE_WRITE_INIT, conn1->write_state()); | 529 EXPECT_EQ(Connection::STATE_WRITE_INIT, conn1->write_state()); |
530 | 530 |
531 // Send another ping from UDP to TURN. | 531 // Send another ping from UDP to TURN. |
532 conn1->Ping(0); | 532 conn1->Ping(0); |
533 EXPECT_EQ_SIMULATED_WAIT(Connection::STATE_WRITABLE, conn1->write_state(), | 533 EXPECT_EQ_SIMULATED_WAIT(Connection::STATE_WRITABLE, conn1->write_state(), |
534 kSimulatedRtt * 2, fake_clock_); | 534 kSimulatedRtt * 2, fake_clock_); |
535 EXPECT_TRUE(conn2->receiving()); | 535 EXPECT_TRUE(conn2->receiving()); |
536 } | 536 } |
537 | 537 |
538 void TestDestroyTurnConnection() { | 538 void TestDestroyTurnConnection() { |
539 PrepareTurnAndUdpPorts(PROTO_UDP); | 539 PrepareTurnAndUdpPorts(PROTO_UDP); |
540 | 540 |
541 // Create connections on both ends. | 541 // Create connections on both ends. |
542 Connection* conn1 = udp_port_->CreateConnection(turn_port_->Candidates()[0], | 542 Connection* conn1 = udp_port_->CreateConnection(turn_port_->Candidates()[0], |
543 Port::ORIGIN_MESSAGE); | 543 Port::ORIGIN_MESSAGE); |
544 Connection* conn2 = turn_port_->CreateConnection(udp_port_->Candidates()[0], | 544 Connection* conn2 = turn_port_->CreateConnection(udp_port_->Candidates()[0], |
545 Port::ORIGIN_MESSAGE); | 545 Port::ORIGIN_MESSAGE); |
546 ASSERT_TRUE(conn2 != NULL); | 546 ASSERT_TRUE(conn2 != nullptr); |
547 ASSERT_TRUE_SIMULATED_WAIT(turn_create_permission_success_, kSimulatedRtt, | 547 ASSERT_TRUE_SIMULATED_WAIT(turn_create_permission_success_, kSimulatedRtt, |
548 fake_clock_); | 548 fake_clock_); |
549 // Make sure turn connection can receive. | 549 // Make sure turn connection can receive. |
550 conn1->Ping(0); | 550 conn1->Ping(0); |
551 EXPECT_EQ_SIMULATED_WAIT(Connection::STATE_WRITABLE, conn1->write_state(), | 551 EXPECT_EQ_SIMULATED_WAIT(Connection::STATE_WRITABLE, conn1->write_state(), |
552 kSimulatedRtt * 2, fake_clock_); | 552 kSimulatedRtt * 2, fake_clock_); |
553 EXPECT_FALSE(turn_unknown_address_); | 553 EXPECT_FALSE(turn_unknown_address_); |
554 | 554 |
555 // Destroy the connection on the TURN port. The TurnEntry still exists, so | 555 // Destroy the connection on the TURN port. The TurnEntry still exists, so |
556 // the TURN port should still process a ping from an unknown address. | 556 // the TURN port should still process a ping from an unknown address. |
(...skipping 19 matching lines...) Expand all Loading... |
576 } | 576 } |
577 | 577 |
578 void TestTurnSendData(ProtocolType protocol_type) { | 578 void TestTurnSendData(ProtocolType protocol_type) { |
579 PrepareTurnAndUdpPorts(protocol_type); | 579 PrepareTurnAndUdpPorts(protocol_type); |
580 | 580 |
581 // Create connections and send pings. | 581 // Create connections and send pings. |
582 Connection* conn1 = turn_port_->CreateConnection( | 582 Connection* conn1 = turn_port_->CreateConnection( |
583 udp_port_->Candidates()[0], Port::ORIGIN_MESSAGE); | 583 udp_port_->Candidates()[0], Port::ORIGIN_MESSAGE); |
584 Connection* conn2 = udp_port_->CreateConnection( | 584 Connection* conn2 = udp_port_->CreateConnection( |
585 turn_port_->Candidates()[0], Port::ORIGIN_MESSAGE); | 585 turn_port_->Candidates()[0], Port::ORIGIN_MESSAGE); |
586 ASSERT_TRUE(conn1 != NULL); | 586 ASSERT_TRUE(conn1 != nullptr); |
587 ASSERT_TRUE(conn2 != NULL); | 587 ASSERT_TRUE(conn2 != nullptr); |
588 conn1->SignalReadPacket.connect(static_cast<TurnPortTest*>(this), | 588 conn1->SignalReadPacket.connect(static_cast<TurnPortTest*>(this), |
589 &TurnPortTest::OnTurnReadPacket); | 589 &TurnPortTest::OnTurnReadPacket); |
590 conn2->SignalReadPacket.connect(static_cast<TurnPortTest*>(this), | 590 conn2->SignalReadPacket.connect(static_cast<TurnPortTest*>(this), |
591 &TurnPortTest::OnUdpReadPacket); | 591 &TurnPortTest::OnUdpReadPacket); |
592 conn1->Ping(0); | 592 conn1->Ping(0); |
593 EXPECT_EQ_SIMULATED_WAIT(Connection::STATE_WRITABLE, conn1->write_state(), | 593 EXPECT_EQ_SIMULATED_WAIT(Connection::STATE_WRITABLE, conn1->write_state(), |
594 kSimulatedRtt * 2, fake_clock_); | 594 kSimulatedRtt * 2, fake_clock_); |
595 conn2->Ping(0); | 595 conn2->Ping(0); |
596 EXPECT_EQ_SIMULATED_WAIT(Connection::STATE_WRITABLE, conn2->write_state(), | 596 EXPECT_EQ_SIMULATED_WAIT(Connection::STATE_WRITABLE, conn2->write_state(), |
597 kSimulatedRtt * 2, fake_clock_); | 597 kSimulatedRtt * 2, fake_clock_); |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 | 882 |
883 // Test that TurnPort will not handle any incoming packets once it has been | 883 // Test that TurnPort will not handle any incoming packets once it has been |
884 // closed. | 884 // closed. |
885 TEST_F(TurnPortTest, TestStopProcessingPacketsAfterClosed) { | 885 TEST_F(TurnPortTest, TestStopProcessingPacketsAfterClosed) { |
886 CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr); | 886 CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr); |
887 PrepareTurnAndUdpPorts(PROTO_UDP); | 887 PrepareTurnAndUdpPorts(PROTO_UDP); |
888 Connection* conn1 = turn_port_->CreateConnection(udp_port_->Candidates()[0], | 888 Connection* conn1 = turn_port_->CreateConnection(udp_port_->Candidates()[0], |
889 Port::ORIGIN_MESSAGE); | 889 Port::ORIGIN_MESSAGE); |
890 Connection* conn2 = udp_port_->CreateConnection(turn_port_->Candidates()[0], | 890 Connection* conn2 = udp_port_->CreateConnection(turn_port_->Candidates()[0], |
891 Port::ORIGIN_MESSAGE); | 891 Port::ORIGIN_MESSAGE); |
892 ASSERT_TRUE(conn1 != NULL); | 892 ASSERT_TRUE(conn1 != nullptr); |
893 ASSERT_TRUE(conn2 != NULL); | 893 ASSERT_TRUE(conn2 != nullptr); |
894 // Make sure conn2 is writable. | 894 // Make sure conn2 is writable. |
895 conn2->Ping(0); | 895 conn2->Ping(0); |
896 EXPECT_EQ_SIMULATED_WAIT(Connection::STATE_WRITABLE, conn2->write_state(), | 896 EXPECT_EQ_SIMULATED_WAIT(Connection::STATE_WRITABLE, conn2->write_state(), |
897 kSimulatedRtt * 2, fake_clock_); | 897 kSimulatedRtt * 2, fake_clock_); |
898 | 898 |
899 turn_port_->Close(); | 899 turn_port_->Close(); |
900 SIMULATED_WAIT(false, kSimulatedRtt, fake_clock_); | 900 SIMULATED_WAIT(false, kSimulatedRtt, fake_clock_); |
901 turn_unknown_address_ = false; | 901 turn_unknown_address_ = false; |
902 conn2->Ping(0); | 902 conn2->Ping(0); |
903 SIMULATED_WAIT(false, kSimulatedRtt, fake_clock_); | 903 SIMULATED_WAIT(false, kSimulatedRtt, fake_clock_); |
904 // Since the turn port does not handle packets any more, it should not | 904 // Since the turn port does not handle packets any more, it should not |
905 // SignalUnknownAddress. | 905 // SignalUnknownAddress. |
906 EXPECT_FALSE(turn_unknown_address_); | 906 EXPECT_FALSE(turn_unknown_address_); |
907 } | 907 } |
908 | 908 |
909 // Test that CreateConnection will return null if port becomes disconnected. | 909 // Test that CreateConnection will return null if port becomes disconnected. |
910 TEST_F(TurnPortTest, TestCreateConnectionWhenSocketClosed) { | 910 TEST_F(TurnPortTest, TestCreateConnectionWhenSocketClosed) { |
911 turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP); | 911 turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP); |
912 CreateTurnPort(kTurnUsername, kTurnPassword, kTurnTcpProtoAddr); | 912 CreateTurnPort(kTurnUsername, kTurnPassword, kTurnTcpProtoAddr); |
913 PrepareTurnAndUdpPorts(PROTO_TCP); | 913 PrepareTurnAndUdpPorts(PROTO_TCP); |
914 // Create a connection. | 914 // Create a connection. |
915 Connection* conn1 = turn_port_->CreateConnection(udp_port_->Candidates()[0], | 915 Connection* conn1 = turn_port_->CreateConnection(udp_port_->Candidates()[0], |
916 Port::ORIGIN_MESSAGE); | 916 Port::ORIGIN_MESSAGE); |
917 ASSERT_TRUE(conn1 != NULL); | 917 ASSERT_TRUE(conn1 != nullptr); |
918 | 918 |
919 // Close the socket and create a connection again. | 919 // Close the socket and create a connection again. |
920 turn_port_->OnSocketClose(turn_port_->socket(), 1); | 920 turn_port_->OnSocketClose(turn_port_->socket(), 1); |
921 conn1 = turn_port_->CreateConnection(udp_port_->Candidates()[0], | 921 conn1 = turn_port_->CreateConnection(udp_port_->Candidates()[0], |
922 Port::ORIGIN_MESSAGE); | 922 Port::ORIGIN_MESSAGE); |
923 ASSERT_TRUE(conn1 == NULL); | 923 ASSERT_TRUE(conn1 == nullptr); |
924 } | 924 } |
925 | 925 |
926 // Tests that when a TCP socket is closed, the respective TURN connection will | 926 // Tests that when a TCP socket is closed, the respective TURN connection will |
927 // be destroyed. | 927 // be destroyed. |
928 TEST_F(TurnPortTest, TestSocketCloseWillDestroyConnection) { | 928 TEST_F(TurnPortTest, TestSocketCloseWillDestroyConnection) { |
929 turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP); | 929 turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP); |
930 CreateTurnPort(kTurnUsername, kTurnPassword, kTurnTcpProtoAddr); | 930 CreateTurnPort(kTurnUsername, kTurnPassword, kTurnTcpProtoAddr); |
931 PrepareTurnAndUdpPorts(PROTO_TCP); | 931 PrepareTurnAndUdpPorts(PROTO_TCP); |
932 Connection* conn = turn_port_->CreateConnection(udp_port_->Candidates()[0], | 932 Connection* conn = turn_port_->CreateConnection(udp_port_->Candidates()[0], |
933 Port::ORIGIN_MESSAGE); | 933 Port::ORIGIN_MESSAGE); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1050 | 1050 |
1051 // Test that CreatePermissionRequest will be scheduled after the success | 1051 // Test that CreatePermissionRequest will be scheduled after the success |
1052 // of the first create permission request and the request will get an | 1052 // of the first create permission request and the request will get an |
1053 // ErrorResponse if the ufrag and pwd are incorrect. | 1053 // ErrorResponse if the ufrag and pwd are incorrect. |
1054 TEST_F(TurnPortTest, TestRefreshCreatePermissionRequest) { | 1054 TEST_F(TurnPortTest, TestRefreshCreatePermissionRequest) { |
1055 CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr); | 1055 CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr); |
1056 PrepareTurnAndUdpPorts(PROTO_UDP); | 1056 PrepareTurnAndUdpPorts(PROTO_UDP); |
1057 | 1057 |
1058 Connection* conn = turn_port_->CreateConnection(udp_port_->Candidates()[0], | 1058 Connection* conn = turn_port_->CreateConnection(udp_port_->Candidates()[0], |
1059 Port::ORIGIN_MESSAGE); | 1059 Port::ORIGIN_MESSAGE); |
1060 ASSERT_TRUE(conn != NULL); | 1060 ASSERT_TRUE(conn != nullptr); |
1061 EXPECT_TRUE_SIMULATED_WAIT(turn_create_permission_success_, kSimulatedRtt, | 1061 EXPECT_TRUE_SIMULATED_WAIT(turn_create_permission_success_, kSimulatedRtt, |
1062 fake_clock_); | 1062 fake_clock_); |
1063 turn_create_permission_success_ = false; | 1063 turn_create_permission_success_ = false; |
1064 // A create-permission-request should be pending. | 1064 // A create-permission-request should be pending. |
1065 // After the next create-permission-response is received, it will schedule | 1065 // After the next create-permission-response is received, it will schedule |
1066 // another request with bad_ufrag and bad_pwd. | 1066 // another request with bad_ufrag and bad_pwd. |
1067 RelayCredentials bad_credentials("bad_user", "bad_pwd"); | 1067 RelayCredentials bad_credentials("bad_user", "bad_pwd"); |
1068 turn_port_->set_credentials(bad_credentials); | 1068 turn_port_->set_credentials(bad_credentials); |
1069 turn_port_->FlushRequests(kAllRequests); | 1069 turn_port_->FlushRequests(kAllRequests); |
1070 EXPECT_TRUE_SIMULATED_WAIT(turn_create_permission_success_, kSimulatedRtt, | 1070 EXPECT_TRUE_SIMULATED_WAIT(turn_create_permission_success_, kSimulatedRtt, |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1178 EXPECT_EQ(nullptr, conn); | 1178 EXPECT_EQ(nullptr, conn); |
1179 } | 1179 } |
1180 | 1180 |
1181 TEST_F(TurnPortTest, TestOriginHeader) { | 1181 TEST_F(TurnPortTest, TestOriginHeader) { |
1182 CreateTurnPortWithOrigin(kLocalAddr1, kTurnUsername, kTurnPassword, | 1182 CreateTurnPortWithOrigin(kLocalAddr1, kTurnUsername, kTurnPassword, |
1183 kTurnUdpProtoAddr, kTestOrigin); | 1183 kTurnUdpProtoAddr, kTestOrigin); |
1184 turn_port_->PrepareAddress(); | 1184 turn_port_->PrepareAddress(); |
1185 EXPECT_TRUE_SIMULATED_WAIT(turn_ready_, kSimulatedRtt * 2, fake_clock_); | 1185 EXPECT_TRUE_SIMULATED_WAIT(turn_ready_, kSimulatedRtt * 2, fake_clock_); |
1186 ASSERT_GT(turn_server_.server()->allocations().size(), 0U); | 1186 ASSERT_GT(turn_server_.server()->allocations().size(), 0U); |
1187 SocketAddress local_address = turn_port_->GetLocalAddress(); | 1187 SocketAddress local_address = turn_port_->GetLocalAddress(); |
1188 ASSERT_TRUE(turn_server_.FindAllocation(local_address) != NULL); | 1188 ASSERT_TRUE(turn_server_.FindAllocation(local_address) != nullptr); |
1189 EXPECT_EQ(kTestOrigin, turn_server_.FindAllocation(local_address)->origin()); | 1189 EXPECT_EQ(kTestOrigin, turn_server_.FindAllocation(local_address)->origin()); |
1190 } | 1190 } |
1191 | 1191 |
1192 // Test that a CreatePermission failure will result in the connection being | 1192 // Test that a CreatePermission failure will result in the connection being |
1193 // pruned and failed. | 1193 // pruned and failed. |
1194 TEST_F(TurnPortTest, TestConnectionFailedAndPrunedOnCreatePermissionFailure) { | 1194 TEST_F(TurnPortTest, TestConnectionFailedAndPrunedOnCreatePermissionFailure) { |
1195 turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP); | 1195 turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP); |
1196 turn_server_.server()->set_reject_private_addresses(true); | 1196 turn_server_.server()->set_reject_private_addresses(true); |
1197 CreateTurnPort(kTurnUsername, kTurnPassword, kTurnTcpProtoAddr); | 1197 CreateTurnPort(kTurnUsername, kTurnPassword, kTurnTcpProtoAddr); |
1198 turn_port_->PrepareAddress(); | 1198 turn_port_->PrepareAddress(); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1259 EXPECT_TRUE(turn_port_->Candidates().empty()); | 1259 EXPECT_TRUE(turn_port_->Candidates().empty()); |
1260 turn_port_.reset(); | 1260 turn_port_.reset(); |
1261 rtc::Thread::Current()->Post(RTC_FROM_HERE, this, MSG_TESTFINISH); | 1261 rtc::Thread::Current()->Post(RTC_FROM_HERE, this, MSG_TESTFINISH); |
1262 // Waiting for above message to be processed. | 1262 // Waiting for above message to be processed. |
1263 ASSERT_TRUE_SIMULATED_WAIT(test_finish_, 1, fake_clock_); | 1263 ASSERT_TRUE_SIMULATED_WAIT(test_finish_, 1, fake_clock_); |
1264 EXPECT_EQ(last_fd_count, GetFDCount()); | 1264 EXPECT_EQ(last_fd_count, GetFDCount()); |
1265 } | 1265 } |
1266 #endif | 1266 #endif |
1267 | 1267 |
1268 } // namespace cricket | 1268 } // namespace cricket |
OLD | NEW |