| 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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 // candidate since we bind to any address (i.e. all 0s). | 465 // candidate since we bind to any address (i.e. all 0s). |
| 466 TEST_F(PortAllocatorTest, TestDisableAdapterEnumerationMultipleInterfaces) { | 466 TEST_F(PortAllocatorTest, TestDisableAdapterEnumerationMultipleInterfaces) { |
| 467 AddInterface(kPrivateAddr); | 467 AddInterface(kPrivateAddr); |
| 468 AddInterface(kPrivateAddr2); | 468 AddInterface(kPrivateAddr2); |
| 469 ResetWithNatServer(kStunAddr); | 469 ResetWithNatServer(kStunAddr); |
| 470 AddTurnServers(kTurnUdpIntAddr, rtc::SocketAddress()); | 470 AddTurnServers(kTurnUdpIntAddr, rtc::SocketAddress()); |
| 471 | 471 |
| 472 CheckDisableAdapterEnumeration(); | 472 CheckDisableAdapterEnumeration(); |
| 473 } | 473 } |
| 474 | 474 |
| 475 // Disable for TSan v2, see | |
| 476 // https://code.google.com/p/webrtc/issues/detail?id=4743 for details. | |
| 477 #if !defined(THREAD_SANITIZER) | |
| 478 | |
| 479 // Test that we can get OnCandidatesAllocationDone callback when all the ports | 475 // Test that we can get OnCandidatesAllocationDone callback when all the ports |
| 480 // are disabled. | 476 // are disabled. |
| 481 TEST_F(PortAllocatorTest, TestDisableAllPorts) { | 477 TEST_F(PortAllocatorTest, TestDisableAllPorts) { |
| 482 AddInterface(kClientAddr); | 478 AddInterface(kClientAddr); |
| 483 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP)); | 479 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP)); |
| 484 session_->set_flags(cricket::PORTALLOCATOR_DISABLE_UDP | | 480 session_->set_flags(cricket::PORTALLOCATOR_DISABLE_UDP | |
| 485 cricket::PORTALLOCATOR_DISABLE_STUN | | 481 cricket::PORTALLOCATOR_DISABLE_STUN | |
| 486 cricket::PORTALLOCATOR_DISABLE_RELAY | | 482 cricket::PORTALLOCATOR_DISABLE_RELAY | |
| 487 cricket::PORTALLOCATOR_DISABLE_TCP); | 483 cricket::PORTALLOCATOR_DISABLE_TCP); |
| 488 session_->StartGettingPorts(); | 484 session_->StartGettingPorts(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 506 EXPECT_PRED5(CheckCandidate, candidates_[2], | 502 EXPECT_PRED5(CheckCandidate, candidates_[2], |
| 507 cricket::ICE_CANDIDATE_COMPONENT_RTP, "relay", "tcp", kRelayTcpIntAddr); | 503 cricket::ICE_CANDIDATE_COMPONENT_RTP, "relay", "tcp", kRelayTcpIntAddr); |
| 508 EXPECT_PRED5(CheckCandidate, candidates_[3], | 504 EXPECT_PRED5(CheckCandidate, candidates_[3], |
| 509 cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "tcp", kClientAddr); | 505 cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "tcp", kClientAddr); |
| 510 EXPECT_PRED5(CheckCandidate, candidates_[4], | 506 EXPECT_PRED5(CheckCandidate, candidates_[4], |
| 511 cricket::ICE_CANDIDATE_COMPONENT_RTP, | 507 cricket::ICE_CANDIDATE_COMPONENT_RTP, |
| 512 "relay", "ssltcp", kRelaySslTcpIntAddr); | 508 "relay", "ssltcp", kRelaySslTcpIntAddr); |
| 513 EXPECT_TRUE(candidate_allocation_done_); | 509 EXPECT_TRUE(candidate_allocation_done_); |
| 514 } | 510 } |
| 515 | 511 |
| 516 #endif // if !defined(THREAD_SANITIZER) | |
| 517 | |
| 518 // Test that we don't crash or malfunction if we can't create UDP sockets or | 512 // Test that we don't crash or malfunction if we can't create UDP sockets or |
| 519 // listen on TCP sockets. We still give out a local TCP address, since | 513 // listen on TCP sockets. We still give out a local TCP address, since |
| 520 // apparently this is needed for the remote side to accept our connection. | 514 // apparently this is needed for the remote side to accept our connection. |
| 521 TEST_F(PortAllocatorTest, TestGetAllPortsNoUdpSocketsNoTcpListen) { | 515 TEST_F(PortAllocatorTest, TestGetAllPortsNoUdpSocketsNoTcpListen) { |
| 522 AddInterface(kClientAddr); | 516 AddInterface(kClientAddr); |
| 523 fss_->set_udp_sockets_enabled(false); | 517 fss_->set_udp_sockets_enabled(false); |
| 524 fss_->set_tcp_listen_enabled(false); | 518 fss_->set_tcp_listen_enabled(false); |
| 525 EXPECT_TRUE(CreateSession(1)); | 519 EXPECT_TRUE(CreateSession(1)); |
| 526 session_->StartGettingPorts(); | 520 session_->StartGettingPorts(); |
| 527 ASSERT_EQ_WAIT(5U, candidates_.size(), kDefaultAllocationTimeout); | 521 ASSERT_EQ_WAIT(5U, candidates_.size(), kDefaultAllocationTimeout); |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1045 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP)); | 1039 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP)); |
| 1046 session_->StartGettingPorts(); | 1040 session_->StartGettingPorts(); |
| 1047 ASSERT_EQ_WAIT(7U, candidates_.size(), kDefaultAllocationTimeout); | 1041 ASSERT_EQ_WAIT(7U, candidates_.size(), kDefaultAllocationTimeout); |
| 1048 EXPECT_EQ(4U, ports_.size()); | 1042 EXPECT_EQ(4U, ports_.size()); |
| 1049 | 1043 |
| 1050 auto it = ports_.begin(); | 1044 auto it = ports_.begin(); |
| 1051 for (; it != ports_.end(); ++it) { | 1045 for (; it != ports_.end(); ++it) { |
| 1052 (reinterpret_cast<cricket::Port*>(*it))->Destroy(); | 1046 (reinterpret_cast<cricket::Port*>(*it))->Destroy(); |
| 1053 } | 1047 } |
| 1054 } | 1048 } |
| OLD | NEW |