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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 // take one simulated clock tick. | 73 // take one simulated clock tick. |
74 static constexpr unsigned int kConnectionDestructionDelay = 1; | 74 static constexpr unsigned int kConnectionDestructionDelay = 1; |
75 // This used to be 1 second, but that's not always enough for getaddrinfo(). | 75 // This used to be 1 second, but that's not always enough for getaddrinfo(). |
76 // See: https://bugs.chromium.org/p/webrtc/issues/detail?id=5191 | 76 // See: https://bugs.chromium.org/p/webrtc/issues/detail?id=5191 |
77 static constexpr unsigned int kResolverTimeout = 10000; | 77 static constexpr unsigned int kResolverTimeout = 10000; |
78 | 78 |
79 static const cricket::ProtocolAddress kTurnUdpProtoAddr( | 79 static const cricket::ProtocolAddress kTurnUdpProtoAddr( |
80 kTurnUdpIntAddr, cricket::PROTO_UDP); | 80 kTurnUdpIntAddr, cricket::PROTO_UDP); |
81 static const cricket::ProtocolAddress kTurnTcpProtoAddr( | 81 static const cricket::ProtocolAddress kTurnTcpProtoAddr( |
82 kTurnTcpIntAddr, cricket::PROTO_TCP); | 82 kTurnTcpIntAddr, cricket::PROTO_TCP); |
| 83 static const cricket::ProtocolAddress kTurnTlsProtoAddr(kTurnTcpIntAddr, |
| 84 cricket::PROTO_TLS); |
83 static const cricket::ProtocolAddress kTurnUdpIPv6ProtoAddr( | 85 static const cricket::ProtocolAddress kTurnUdpIPv6ProtoAddr( |
84 kTurnUdpIPv6IntAddr, cricket::PROTO_UDP); | 86 kTurnUdpIPv6IntAddr, cricket::PROTO_UDP); |
85 | 87 |
86 static const unsigned int MSG_TESTFINISH = 0; | 88 static const unsigned int MSG_TESTFINISH = 0; |
87 | 89 |
88 #if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID) | 90 #if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID) |
89 static int GetFDCount() { | 91 static int GetFDCount() { |
90 struct dirent *dp; | 92 struct dirent *dp; |
91 int fd_count = 0; | 93 int fd_count = 0; |
92 DIR *dir = opendir("/proc/self/fd/"); | 94 DIR *dir = opendir("/proc/self/fd/"); |
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1020 | 1022 |
1021 // Similar to above, except that this test will use the shared socket. | 1023 // Similar to above, except that this test will use the shared socket. |
1022 TEST_F(TurnPortTest, TestDestroyTurnConnectionUsingSharedSocket) { | 1024 TEST_F(TurnPortTest, TestDestroyTurnConnectionUsingSharedSocket) { |
1023 CreateSharedTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr); | 1025 CreateSharedTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr); |
1024 TestDestroyTurnConnection(); | 1026 TestDestroyTurnConnection(); |
1025 } | 1027 } |
1026 | 1028 |
1027 // Test that we fail to create a connection when we want to use TLS over TCP. | 1029 // Test that we fail to create a connection when we want to use TLS over TCP. |
1028 // This test should be removed once we have TLS support. | 1030 // This test should be removed once we have TLS support. |
1029 TEST_F(TurnPortTest, TestTurnTlsTcpConnectionFails) { | 1031 TEST_F(TurnPortTest, TestTurnTlsTcpConnectionFails) { |
1030 ProtocolAddress secure_addr(kTurnTcpProtoAddr.address, | 1032 ProtocolAddress secure_addr(kTurnTlsProtoAddr.address, |
1031 kTurnTcpProtoAddr.proto, true); | 1033 kTurnTlsProtoAddr.proto); |
1032 CreateTurnPort(kTurnUsername, kTurnPassword, secure_addr); | 1034 CreateTurnPort(kTurnUsername, kTurnPassword, secure_addr); |
1033 turn_port_->PrepareAddress(); | 1035 turn_port_->PrepareAddress(); |
1034 EXPECT_TRUE_SIMULATED_WAIT(turn_error_, kSimulatedRtt * 2, fake_clock_); | 1036 EXPECT_TRUE_SIMULATED_WAIT(turn_error_, kSimulatedRtt * 2, fake_clock_); |
1035 ASSERT_EQ(0U, turn_port_->Candidates().size()); | 1037 ASSERT_EQ(0U, turn_port_->Candidates().size()); |
1036 } | 1038 } |
1037 | 1039 |
1038 // Run TurnConnectionTest with one-time-use nonce feature. | 1040 // Run TurnConnectionTest with one-time-use nonce feature. |
1039 // Here server will send a 438 STALE_NONCE error message for | 1041 // Here server will send a 438 STALE_NONCE error message for |
1040 // every TURN transaction. | 1042 // every TURN transaction. |
1041 TEST_F(TurnPortTest, TestTurnConnectionUsingOTUNonce) { | 1043 TEST_F(TurnPortTest, TestTurnConnectionUsingOTUNonce) { |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1255 EXPECT_TRUE(turn_port_->Candidates().empty()); | 1257 EXPECT_TRUE(turn_port_->Candidates().empty()); |
1256 turn_port_.reset(); | 1258 turn_port_.reset(); |
1257 rtc::Thread::Current()->Post(RTC_FROM_HERE, this, MSG_TESTFINISH); | 1259 rtc::Thread::Current()->Post(RTC_FROM_HERE, this, MSG_TESTFINISH); |
1258 // Waiting for above message to be processed. | 1260 // Waiting for above message to be processed. |
1259 ASSERT_TRUE_SIMULATED_WAIT(test_finish_, 1, fake_clock_); | 1261 ASSERT_TRUE_SIMULATED_WAIT(test_finish_, 1, fake_clock_); |
1260 EXPECT_EQ(last_fd_count, GetFDCount()); | 1262 EXPECT_EQ(last_fd_count, GetFDCount()); |
1261 } | 1263 } |
1262 #endif | 1264 #endif |
1263 | 1265 |
1264 } // namespace cricket | 1266 } // namespace cricket |
OLD | NEW |