Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 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 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1248 UDPPort* port1 = CreateUdpPort(kLocalAddr1); | 1248 UDPPort* port1 = CreateUdpPort(kLocalAddr1); |
| 1249 UDPPort* port2 = CreateUdpPort(kLocalAddr2); | 1249 UDPPort* port2 = CreateUdpPort(kLocalAddr2); |
| 1250 TestChannel ch1(port1); | 1250 TestChannel ch1(port1); |
| 1251 TestChannel ch2(port2); | 1251 TestChannel ch2(port2); |
| 1252 // Acquire address. | 1252 // Acquire address. |
| 1253 ch1.Start(); | 1253 ch1.Start(); |
| 1254 ch2.Start(); | 1254 ch2.Start(); |
| 1255 ASSERT_EQ_WAIT(1, ch1.complete_count(), kTimeout); | 1255 ASSERT_EQ_WAIT(1, ch1.complete_count(), kTimeout); |
| 1256 ASSERT_EQ_WAIT(1, ch2.complete_count(), kTimeout); | 1256 ASSERT_EQ_WAIT(1, ch2.complete_count(), kTimeout); |
| 1257 | 1257 |
| 1258 uint32_t before_created = rtc::Time(); | |
| 1259 ch1.CreateConnection(GetCandidate(port2)); | 1258 ch1.CreateConnection(GetCandidate(port2)); |
| 1260 uint32_t after_created = rtc::Time(); | 1259 uint32_t after_created = rtc::Time(); |
| 1261 Connection* conn = ch1.conn(); | 1260 Connection* conn = ch1.conn(); |
| 1262 ASSERT(conn != nullptr); | 1261 ASSERT(conn != nullptr); |
| 1263 // If the connection has never received anything, it will be dead after | 1262 // If the connection has never received anything, it will be dead after |
| 1264 // MIN_CONNECTION_LIFETIME | 1263 // MIN_CONNECTION_LIFETIME AND inactive (write_timeout). |
|
pthatcher1
2015/12/30 17:12:28
This is now testing the case that when we are afte
honghaiz3
2015/12/30 19:38:18
Done.
| |
| 1265 conn->UpdateState(before_created + MIN_CONNECTION_LIFETIME - 1); | 1264 conn->UpdateState(after_created + MIN_CONNECTION_LIFETIME + 1); |
| 1266 rtc::Thread::Current()->ProcessMessages(100); | 1265 rtc::Thread::Current()->ProcessMessages(0); |
| 1267 EXPECT_TRUE(ch1.conn() != nullptr); | 1266 EXPECT_TRUE(ch1.conn() != nullptr); |
| 1267 conn->Prune(); | |
| 1268 conn->UpdateState(after_created + MIN_CONNECTION_LIFETIME + 1); | 1268 conn->UpdateState(after_created + MIN_CONNECTION_LIFETIME + 1); |
| 1269 EXPECT_TRUE_WAIT(ch1.conn() == nullptr, kTimeout); | 1269 EXPECT_TRUE_WAIT(ch1.conn() == nullptr, kTimeout); |
| 1270 | 1270 |
| 1271 // Create a connection again and receive a ping. | 1271 // Create a connection again and receive a ping. |
| 1272 ch1.CreateConnection(GetCandidate(port2)); | 1272 ch1.CreateConnection(GetCandidate(port2)); |
| 1273 conn = ch1.conn(); | 1273 conn = ch1.conn(); |
| 1274 ASSERT(conn != nullptr); | 1274 ASSERT(conn != nullptr); |
| 1275 uint32_t before_last_receiving = rtc::Time(); | 1275 uint32_t before_last_receiving = rtc::Time(); |
| 1276 conn->ReceivedPing(); | 1276 conn->ReceivedPing(); |
| 1277 uint32_t after_last_receiving = rtc::Time(); | 1277 uint32_t after_last_receiving = rtc::Time(); |
| (...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2513 rtc::scoped_ptr<Port> tcp_port(CreateTcpPort(kLocalAddr1)); | 2513 rtc::scoped_ptr<Port> tcp_port(CreateTcpPort(kLocalAddr1)); |
| 2514 EXPECT_TRUE(tcp_port->SupportsProtocol(TCP_PROTOCOL_NAME)); | 2514 EXPECT_TRUE(tcp_port->SupportsProtocol(TCP_PROTOCOL_NAME)); |
| 2515 EXPECT_TRUE(tcp_port->SupportsProtocol(SSLTCP_PROTOCOL_NAME)); | 2515 EXPECT_TRUE(tcp_port->SupportsProtocol(SSLTCP_PROTOCOL_NAME)); |
| 2516 EXPECT_FALSE(tcp_port->SupportsProtocol(UDP_PROTOCOL_NAME)); | 2516 EXPECT_FALSE(tcp_port->SupportsProtocol(UDP_PROTOCOL_NAME)); |
| 2517 | 2517 |
| 2518 rtc::scoped_ptr<Port> turn_port( | 2518 rtc::scoped_ptr<Port> turn_port( |
| 2519 CreateTurnPort(kLocalAddr1, nat_socket_factory1(), PROTO_UDP, PROTO_UDP)); | 2519 CreateTurnPort(kLocalAddr1, nat_socket_factory1(), PROTO_UDP, PROTO_UDP)); |
| 2520 EXPECT_TRUE(turn_port->SupportsProtocol(UDP_PROTOCOL_NAME)); | 2520 EXPECT_TRUE(turn_port->SupportsProtocol(UDP_PROTOCOL_NAME)); |
| 2521 EXPECT_FALSE(turn_port->SupportsProtocol(TCP_PROTOCOL_NAME)); | 2521 EXPECT_FALSE(turn_port->SupportsProtocol(TCP_PROTOCOL_NAME)); |
| 2522 } | 2522 } |
| OLD | NEW |