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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 bool turn_unknown_address_; | 530 bool turn_unknown_address_; |
531 bool turn_create_permission_success_; | 531 bool turn_create_permission_success_; |
532 bool udp_ready_; | 532 bool udp_ready_; |
533 bool test_finish_; | 533 bool test_finish_; |
534 bool turn_refresh_success_ = false; | 534 bool turn_refresh_success_ = false; |
535 std::vector<rtc::Buffer> turn_packets_; | 535 std::vector<rtc::Buffer> turn_packets_; |
536 std::vector<rtc::Buffer> udp_packets_; | 536 std::vector<rtc::Buffer> udp_packets_; |
537 rtc::PacketOptions options; | 537 rtc::PacketOptions options; |
538 }; | 538 }; |
539 | 539 |
| 540 TEST_F(TurnPortTest, TestTurnPortType) { |
| 541 CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr); |
| 542 EXPECT_EQ(cricket::RELAY_PORT_TYPE, turn_port_->Type()); |
| 543 } |
| 544 |
540 // Do a normal TURN allocation. | 545 // Do a normal TURN allocation. |
541 TEST_F(TurnPortTest, TestTurnAllocate) { | 546 TEST_F(TurnPortTest, TestTurnAllocate) { |
542 CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr); | 547 CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr); |
543 EXPECT_EQ(0, turn_port_->SetOption(rtc::Socket::OPT_SNDBUF, 10*1024)); | 548 EXPECT_EQ(0, turn_port_->SetOption(rtc::Socket::OPT_SNDBUF, 10*1024)); |
544 turn_port_->PrepareAddress(); | 549 turn_port_->PrepareAddress(); |
545 EXPECT_TRUE_WAIT(turn_ready_, kTimeout); | 550 EXPECT_TRUE_WAIT(turn_ready_, kTimeout); |
546 ASSERT_EQ(1U, turn_port_->Candidates().size()); | 551 ASSERT_EQ(1U, turn_port_->Candidates().size()); |
547 EXPECT_EQ(kTurnUdpExtAddr.ipaddr(), | 552 EXPECT_EQ(kTurnUdpExtAddr.ipaddr(), |
548 turn_port_->Candidates()[0].address().ipaddr()); | 553 turn_port_->Candidates()[0].address().ipaddr()); |
549 EXPECT_NE(0, turn_port_->Candidates()[0].address().port()); | 554 EXPECT_NE(0, turn_port_->Candidates()[0].address().port()); |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1122 turn_port_->PrepareAddress(); | 1127 turn_port_->PrepareAddress(); |
1123 ASSERT_TRUE_WAIT(turn_error_, kResolverTimeout); | 1128 ASSERT_TRUE_WAIT(turn_error_, kResolverTimeout); |
1124 EXPECT_TRUE(turn_port_->Candidates().empty()); | 1129 EXPECT_TRUE(turn_port_->Candidates().empty()); |
1125 turn_port_.reset(); | 1130 turn_port_.reset(); |
1126 rtc::Thread::Current()->Post(RTC_FROM_HERE, this, MSG_TESTFINISH); | 1131 rtc::Thread::Current()->Post(RTC_FROM_HERE, this, MSG_TESTFINISH); |
1127 // Waiting for above message to be processed. | 1132 // Waiting for above message to be processed. |
1128 ASSERT_TRUE_WAIT(test_finish_, kTimeout); | 1133 ASSERT_TRUE_WAIT(test_finish_, kTimeout); |
1129 EXPECT_EQ(last_fd_count, GetFDCount()); | 1134 EXPECT_EQ(last_fd_count, GetFDCount()); |
1130 } | 1135 } |
1131 #endif | 1136 #endif |
OLD | NEW |