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 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 EXPECT_TRUE_WAIT(turn_ready_, kTimeout); | 968 EXPECT_TRUE_WAIT(turn_ready_, kTimeout); |
969 | 969 |
970 ASSERT_GT(turn_server_.server()->allocations().size(), 0U); | 970 ASSERT_GT(turn_server_.server()->allocations().size(), 0U); |
971 turn_port_.reset(); | 971 turn_port_.reset(); |
972 EXPECT_EQ_WAIT(0U, turn_server_.server()->allocations().size(), kTimeout); | 972 EXPECT_EQ_WAIT(0U, turn_server_.server()->allocations().size(), kTimeout); |
973 } | 973 } |
974 | 974 |
975 // This test verifies any FD's are not leaked after TurnPort is destroyed. | 975 // This test verifies any FD's are not leaked after TurnPort is destroyed. |
976 // https://code.google.com/p/webrtc/issues/detail?id=2651 | 976 // https://code.google.com/p/webrtc/issues/detail?id=2651 |
977 #if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID) | 977 #if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID) |
| 978 // 1 second is not always enough for getaddrinfo(). |
| 979 // See: https://bugs.chromium.org/p/webrtc/issues/detail?id=5191 |
| 980 static const unsigned int kResolverTimeout = 10000; |
| 981 |
978 TEST_F(TurnPortTest, TestResolverShutdown) { | 982 TEST_F(TurnPortTest, TestResolverShutdown) { |
979 turn_server_.AddInternalSocket(kTurnUdpIPv6IntAddr, cricket::PROTO_UDP); | 983 turn_server_.AddInternalSocket(kTurnUdpIPv6IntAddr, cricket::PROTO_UDP); |
980 int last_fd_count = GetFDCount(); | 984 int last_fd_count = GetFDCount(); |
981 // Need to supply unresolved address to kick off resolver. | 985 // Need to supply unresolved address to kick off resolver. |
982 CreateTurnPort(kLocalIPv6Addr, kTurnUsername, kTurnPassword, | 986 CreateTurnPort(kLocalIPv6Addr, kTurnUsername, kTurnPassword, |
983 cricket::ProtocolAddress(rtc::SocketAddress( | 987 cricket::ProtocolAddress(rtc::SocketAddress( |
984 "www.google.invalid", 3478), cricket::PROTO_UDP)); | 988 "www.google.invalid", 3478), cricket::PROTO_UDP)); |
985 turn_port_->PrepareAddress(); | 989 turn_port_->PrepareAddress(); |
986 ASSERT_TRUE_WAIT(turn_error_, kTimeout); | 990 ASSERT_TRUE_WAIT(turn_error_, kResolverTimeout); |
987 EXPECT_TRUE(turn_port_->Candidates().empty()); | 991 EXPECT_TRUE(turn_port_->Candidates().empty()); |
988 turn_port_.reset(); | 992 turn_port_.reset(); |
989 rtc::Thread::Current()->Post(this, MSG_TESTFINISH); | 993 rtc::Thread::Current()->Post(this, MSG_TESTFINISH); |
990 // Waiting for above message to be processed. | 994 // Waiting for above message to be processed. |
991 ASSERT_TRUE_WAIT(test_finish_, kTimeout); | 995 ASSERT_TRUE_WAIT(test_finish_, kTimeout); |
992 EXPECT_EQ(last_fd_count, GetFDCount()); | 996 EXPECT_EQ(last_fd_count, GetFDCount()); |
993 } | 997 } |
994 #endif | 998 #endif |
OLD | NEW |