| 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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 udp_port_->PrepareAddress(); | 357 udp_port_->PrepareAddress(); |
| 358 ASSERT_TRUE_WAIT(udp_ready_, kTimeout); | 358 ASSERT_TRUE_WAIT(udp_ready_, kTimeout); |
| 359 | 359 |
| 360 // Send ping from UDP to TURN. | 360 // Send ping from UDP to TURN. |
| 361 Connection* conn1 = udp_port_->CreateConnection( | 361 Connection* conn1 = udp_port_->CreateConnection( |
| 362 turn_port_->Candidates()[0], Port::ORIGIN_MESSAGE); | 362 turn_port_->Candidates()[0], Port::ORIGIN_MESSAGE); |
| 363 ASSERT_TRUE(conn1 != NULL); | 363 ASSERT_TRUE(conn1 != NULL); |
| 364 conn1->Ping(0); | 364 conn1->Ping(0); |
| 365 WAIT(!turn_unknown_address_, kTimeout); | 365 WAIT(!turn_unknown_address_, kTimeout); |
| 366 EXPECT_FALSE(turn_unknown_address_); | 366 EXPECT_FALSE(turn_unknown_address_); |
| 367 EXPECT_EQ(Connection::STATE_READ_INIT, conn1->read_state()); | 367 EXPECT_FALSE(conn1->receiving()); |
| 368 EXPECT_EQ(Connection::STATE_WRITE_INIT, conn1->write_state()); | 368 EXPECT_EQ(Connection::STATE_WRITE_INIT, conn1->write_state()); |
| 369 | 369 |
| 370 // Send ping from TURN to UDP. | 370 // Send ping from TURN to UDP. |
| 371 Connection* conn2 = turn_port_->CreateConnection( | 371 Connection* conn2 = turn_port_->CreateConnection( |
| 372 udp_port_->Candidates()[0], Port::ORIGIN_MESSAGE); | 372 udp_port_->Candidates()[0], Port::ORIGIN_MESSAGE); |
| 373 ASSERT_TRUE(conn2 != NULL); | 373 ASSERT_TRUE(conn2 != NULL); |
| 374 ASSERT_TRUE_WAIT(turn_create_permission_success_, kTimeout); | 374 ASSERT_TRUE_WAIT(turn_create_permission_success_, kTimeout); |
| 375 conn2->Ping(0); | 375 conn2->Ping(0); |
| 376 | 376 |
| 377 EXPECT_EQ_WAIT(Connection::STATE_WRITABLE, conn2->write_state(), kTimeout); | 377 EXPECT_EQ_WAIT(Connection::STATE_WRITABLE, conn2->write_state(), kTimeout); |
| 378 EXPECT_EQ(Connection::STATE_READABLE, conn1->read_state()); | 378 EXPECT_TRUE(conn1->receiving()); |
| 379 EXPECT_EQ(Connection::STATE_READ_INIT, conn2->read_state()); | 379 EXPECT_TRUE(conn2->receiving()); |
| 380 EXPECT_EQ(Connection::STATE_WRITE_INIT, conn1->write_state()); | 380 EXPECT_EQ(Connection::STATE_WRITE_INIT, conn1->write_state()); |
| 381 | 381 |
| 382 // Send another ping from UDP to TURN. | 382 // Send another ping from UDP to TURN. |
| 383 conn1->Ping(0); | 383 conn1->Ping(0); |
| 384 EXPECT_EQ_WAIT(Connection::STATE_WRITABLE, conn1->write_state(), kTimeout); | 384 EXPECT_EQ_WAIT(Connection::STATE_WRITABLE, conn1->write_state(), kTimeout); |
| 385 EXPECT_EQ(Connection::STATE_READABLE, conn2->read_state()); | 385 EXPECT_TRUE(conn2->receiving()); |
| 386 } | 386 } |
| 387 | 387 |
| 388 void TestTurnSendData() { | 388 void TestTurnSendData() { |
| 389 turn_port_->PrepareAddress(); | 389 turn_port_->PrepareAddress(); |
| 390 EXPECT_TRUE_WAIT(turn_ready_, kTimeout); | 390 EXPECT_TRUE_WAIT(turn_ready_, kTimeout); |
| 391 CreateUdpPort(); | 391 CreateUdpPort(); |
| 392 udp_port_->PrepareAddress(); | 392 udp_port_->PrepareAddress(); |
| 393 EXPECT_TRUE_WAIT(udp_ready_, kTimeout); | 393 EXPECT_TRUE_WAIT(udp_ready_, kTimeout); |
| 394 // Create connections and send pings. | 394 // Create connections and send pings. |
| 395 Connection* conn1 = turn_port_->CreateConnection( | 395 Connection* conn1 = turn_port_->CreateConnection( |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 turn_port_->PrepareAddress(); | 807 turn_port_->PrepareAddress(); |
| 808 ASSERT_TRUE_WAIT(turn_error_, kTimeout); | 808 ASSERT_TRUE_WAIT(turn_error_, kTimeout); |
| 809 EXPECT_TRUE(turn_port_->Candidates().empty()); | 809 EXPECT_TRUE(turn_port_->Candidates().empty()); |
| 810 turn_port_.reset(); | 810 turn_port_.reset(); |
| 811 rtc::Thread::Current()->Post(this, MSG_TESTFINISH); | 811 rtc::Thread::Current()->Post(this, MSG_TESTFINISH); |
| 812 // Waiting for above message to be processed. | 812 // Waiting for above message to be processed. |
| 813 ASSERT_TRUE_WAIT(test_finish_, kTimeout); | 813 ASSERT_TRUE_WAIT(test_finish_, kTimeout); |
| 814 EXPECT_EQ(last_fd_count, GetFDCount()); | 814 EXPECT_EQ(last_fd_count, GetFDCount()); |
| 815 } | 815 } |
| 816 #endif | 816 #endif |
| OLD | NEW |