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 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1261 UDPPort* port2 = CreateUdpPort(kLocalAddr2); | 1261 UDPPort* port2 = CreateUdpPort(kLocalAddr2); |
1262 TestChannel ch1(port1); | 1262 TestChannel ch1(port1); |
1263 TestChannel ch2(port2); | 1263 TestChannel ch2(port2); |
1264 // Acquire address. | 1264 // Acquire address. |
1265 ch1.Start(); | 1265 ch1.Start(); |
1266 ch2.Start(); | 1266 ch2.Start(); |
1267 ASSERT_EQ_WAIT(1, ch1.complete_count(), kTimeout); | 1267 ASSERT_EQ_WAIT(1, ch1.complete_count(), kTimeout); |
1268 ASSERT_EQ_WAIT(1, ch2.complete_count(), kTimeout); | 1268 ASSERT_EQ_WAIT(1, ch2.complete_count(), kTimeout); |
1269 | 1269 |
1270 // Test case that the connection has never received anything. | 1270 // Test case that the connection has never received anything. |
1271 int64_t before_created = rtc::Time64(); | 1271 int64_t before_created = rtc::TimeMillis(); |
1272 ch1.CreateConnection(GetCandidate(port2)); | 1272 ch1.CreateConnection(GetCandidate(port2)); |
1273 int64_t after_created = rtc::Time64(); | 1273 int64_t after_created = rtc::TimeMillis(); |
1274 Connection* conn = ch1.conn(); | 1274 Connection* conn = ch1.conn(); |
1275 ASSERT(conn != nullptr); | 1275 ASSERT(conn != nullptr); |
1276 // It is not dead if it is after MIN_CONNECTION_LIFETIME but not pruned. | 1276 // It is not dead if it is after MIN_CONNECTION_LIFETIME but not pruned. |
1277 conn->UpdateState(after_created + MIN_CONNECTION_LIFETIME + 1); | 1277 conn->UpdateState(after_created + MIN_CONNECTION_LIFETIME + 1); |
1278 rtc::Thread::Current()->ProcessMessages(0); | 1278 rtc::Thread::Current()->ProcessMessages(0); |
1279 EXPECT_TRUE(ch1.conn() != nullptr); | 1279 EXPECT_TRUE(ch1.conn() != nullptr); |
1280 // It is not dead if it is before MIN_CONNECTION_LIFETIME and pruned. | 1280 // It is not dead if it is before MIN_CONNECTION_LIFETIME and pruned. |
1281 conn->UpdateState(before_created + MIN_CONNECTION_LIFETIME - 1); | 1281 conn->UpdateState(before_created + MIN_CONNECTION_LIFETIME - 1); |
1282 conn->Prune(); | 1282 conn->Prune(); |
1283 rtc::Thread::Current()->ProcessMessages(0); | 1283 rtc::Thread::Current()->ProcessMessages(0); |
1284 EXPECT_TRUE(ch1.conn() != nullptr); | 1284 EXPECT_TRUE(ch1.conn() != nullptr); |
1285 // It will be dead after MIN_CONNECTION_LIFETIME and pruned. | 1285 // It will be dead after MIN_CONNECTION_LIFETIME and pruned. |
1286 conn->UpdateState(after_created + MIN_CONNECTION_LIFETIME + 1); | 1286 conn->UpdateState(after_created + MIN_CONNECTION_LIFETIME + 1); |
1287 EXPECT_TRUE_WAIT(ch1.conn() == nullptr, kTimeout); | 1287 EXPECT_TRUE_WAIT(ch1.conn() == nullptr, kTimeout); |
1288 | 1288 |
1289 // Test case that the connection has received something. | 1289 // Test case that the connection has received something. |
1290 // Create a connection again and receive a ping. | 1290 // Create a connection again and receive a ping. |
1291 ch1.CreateConnection(GetCandidate(port2)); | 1291 ch1.CreateConnection(GetCandidate(port2)); |
1292 conn = ch1.conn(); | 1292 conn = ch1.conn(); |
1293 ASSERT(conn != nullptr); | 1293 ASSERT(conn != nullptr); |
1294 int64_t before_last_receiving = rtc::Time64(); | 1294 int64_t before_last_receiving = rtc::TimeMillis(); |
1295 conn->ReceivedPing(); | 1295 conn->ReceivedPing(); |
1296 int64_t after_last_receiving = rtc::Time64(); | 1296 int64_t after_last_receiving = rtc::TimeMillis(); |
1297 // The connection will be dead after DEAD_CONNECTION_RECEIVE_TIMEOUT | 1297 // The connection will be dead after DEAD_CONNECTION_RECEIVE_TIMEOUT |
1298 conn->UpdateState( | 1298 conn->UpdateState( |
1299 before_last_receiving + DEAD_CONNECTION_RECEIVE_TIMEOUT - 1); | 1299 before_last_receiving + DEAD_CONNECTION_RECEIVE_TIMEOUT - 1); |
1300 rtc::Thread::Current()->ProcessMessages(100); | 1300 rtc::Thread::Current()->ProcessMessages(100); |
1301 EXPECT_TRUE(ch1.conn() != nullptr); | 1301 EXPECT_TRUE(ch1.conn() != nullptr); |
1302 conn->UpdateState(after_last_receiving + DEAD_CONNECTION_RECEIVE_TIMEOUT + 1); | 1302 conn->UpdateState(after_last_receiving + DEAD_CONNECTION_RECEIVE_TIMEOUT + 1); |
1303 EXPECT_TRUE_WAIT(ch1.conn() == nullptr, kTimeout); | 1303 EXPECT_TRUE_WAIT(ch1.conn() == nullptr, kTimeout); |
1304 } | 1304 } |
1305 | 1305 |
1306 // This test case verifies standard ICE features in STUN messages. Currently it | 1306 // This test case verifies standard ICE features in STUN messages. Currently it |
(...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2588 rtc::scoped_ptr<Port> tcp_port(CreateTcpPort(kLocalAddr1)); | 2588 rtc::scoped_ptr<Port> tcp_port(CreateTcpPort(kLocalAddr1)); |
2589 EXPECT_TRUE(tcp_port->SupportsProtocol(TCP_PROTOCOL_NAME)); | 2589 EXPECT_TRUE(tcp_port->SupportsProtocol(TCP_PROTOCOL_NAME)); |
2590 EXPECT_TRUE(tcp_port->SupportsProtocol(SSLTCP_PROTOCOL_NAME)); | 2590 EXPECT_TRUE(tcp_port->SupportsProtocol(SSLTCP_PROTOCOL_NAME)); |
2591 EXPECT_FALSE(tcp_port->SupportsProtocol(UDP_PROTOCOL_NAME)); | 2591 EXPECT_FALSE(tcp_port->SupportsProtocol(UDP_PROTOCOL_NAME)); |
2592 | 2592 |
2593 rtc::scoped_ptr<Port> turn_port( | 2593 rtc::scoped_ptr<Port> turn_port( |
2594 CreateTurnPort(kLocalAddr1, nat_socket_factory1(), PROTO_UDP, PROTO_UDP)); | 2594 CreateTurnPort(kLocalAddr1, nat_socket_factory1(), PROTO_UDP, PROTO_UDP)); |
2595 EXPECT_TRUE(turn_port->SupportsProtocol(UDP_PROTOCOL_NAME)); | 2595 EXPECT_TRUE(turn_port->SupportsProtocol(UDP_PROTOCOL_NAME)); |
2596 EXPECT_FALSE(turn_port->SupportsProtocol(TCP_PROTOCOL_NAME)); | 2596 EXPECT_FALSE(turn_port->SupportsProtocol(TCP_PROTOCOL_NAME)); |
2597 } | 2597 } |
OLD | NEW |