| 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 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 bool turn_unknown_address_; | 577 bool turn_unknown_address_; |
| 578 bool turn_create_permission_success_; | 578 bool turn_create_permission_success_; |
| 579 bool udp_ready_; | 579 bool udp_ready_; |
| 580 bool test_finish_; | 580 bool test_finish_; |
| 581 bool turn_refresh_success_ = false; | 581 bool turn_refresh_success_ = false; |
| 582 std::vector<rtc::Buffer> turn_packets_; | 582 std::vector<rtc::Buffer> turn_packets_; |
| 583 std::vector<rtc::Buffer> udp_packets_; | 583 std::vector<rtc::Buffer> udp_packets_; |
| 584 rtc::PacketOptions options; | 584 rtc::PacketOptions options; |
| 585 }; | 585 }; |
| 586 | 586 |
| 587 TEST_F(TurnPortTest, TestTurnPortType) { |
| 588 CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr); |
| 589 EXPECT_EQ(cricket::RELAY_PORT_TYPE, turn_port_->Type()); |
| 590 } |
| 591 |
| 587 // Do a normal TURN allocation. | 592 // Do a normal TURN allocation. |
| 588 TEST_F(TurnPortTest, TestTurnAllocate) { | 593 TEST_F(TurnPortTest, TestTurnAllocate) { |
| 589 CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr); | 594 CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr); |
| 590 EXPECT_EQ(0, turn_port_->SetOption(rtc::Socket::OPT_SNDBUF, 10*1024)); | 595 EXPECT_EQ(0, turn_port_->SetOption(rtc::Socket::OPT_SNDBUF, 10*1024)); |
| 591 turn_port_->PrepareAddress(); | 596 turn_port_->PrepareAddress(); |
| 592 EXPECT_TRUE_SIMULATED_WAIT(turn_ready_, kSimulatedRtt * 2, fake_clock_); | 597 EXPECT_TRUE_SIMULATED_WAIT(turn_ready_, kSimulatedRtt * 2, fake_clock_); |
| 593 ASSERT_EQ(1U, turn_port_->Candidates().size()); | 598 ASSERT_EQ(1U, turn_port_->Candidates().size()); |
| 594 EXPECT_EQ(kTurnUdpExtAddr.ipaddr(), | 599 EXPECT_EQ(kTurnUdpExtAddr.ipaddr(), |
| 595 turn_port_->Candidates()[0].address().ipaddr()); | 600 turn_port_->Candidates()[0].address().ipaddr()); |
| 596 EXPECT_NE(0, turn_port_->Candidates()[0].address().port()); | 601 EXPECT_NE(0, turn_port_->Candidates()[0].address().port()); |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1179 EXPECT_TRUE(turn_port_->Candidates().empty()); | 1184 EXPECT_TRUE(turn_port_->Candidates().empty()); |
| 1180 turn_port_.reset(); | 1185 turn_port_.reset(); |
| 1181 rtc::Thread::Current()->Post(RTC_FROM_HERE, this, MSG_TESTFINISH); | 1186 rtc::Thread::Current()->Post(RTC_FROM_HERE, this, MSG_TESTFINISH); |
| 1182 // Waiting for above message to be processed. | 1187 // Waiting for above message to be processed. |
| 1183 ASSERT_TRUE_SIMULATED_WAIT(test_finish_, 1, fake_clock_); | 1188 ASSERT_TRUE_SIMULATED_WAIT(test_finish_, 1, fake_clock_); |
| 1184 EXPECT_EQ(last_fd_count, GetFDCount()); | 1189 EXPECT_EQ(last_fd_count, GetFDCount()); |
| 1185 } | 1190 } |
| 1186 #endif | 1191 #endif |
| 1187 | 1192 |
| 1188 } // namespace cricket | 1193 } // namespace cricket |
| OLD | NEW |