| 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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr); | 658 CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr); |
| 659 turn_port_->PrepareAddress(); | 659 turn_port_->PrepareAddress(); |
| 660 | 660 |
| 661 // Verifies that the new port has the same address. | 661 // Verifies that the new port has the same address. |
| 662 EXPECT_EQ(first_addr, turn_port_->socket()->GetLocalAddress()); | 662 EXPECT_EQ(first_addr, turn_port_->socket()->GetLocalAddress()); |
| 663 | 663 |
| 664 EXPECT_TRUE_WAIT(turn_ready_, kTimeout); | 664 EXPECT_TRUE_WAIT(turn_ready_, kTimeout); |
| 665 | 665 |
| 666 // Verifies that the new port has a different address now. | 666 // Verifies that the new port has a different address now. |
| 667 EXPECT_NE(first_addr, turn_port_->socket()->GetLocalAddress()); | 667 EXPECT_NE(first_addr, turn_port_->socket()->GetLocalAddress()); |
| 668 |
| 669 // Verify that all packets received from the shared socket are ignored. |
| 670 std::string test_packet = "Test packet"; |
| 671 EXPECT_FALSE(turn_port_->HandleIncomingPacket( |
| 672 socket_.get(), test_packet.data(), test_packet.size(), |
| 673 rtc::SocketAddress(kTurnUdpExtAddr.ipaddr(), 0), |
| 674 rtc::CreatePacketTime(0))); |
| 668 } | 675 } |
| 669 | 676 |
| 670 // Tests that a shared-socket-TurnPort creates its own socket after | 677 // Tests that a shared-socket-TurnPort creates its own socket after |
| 671 // STUN_ERROR_ALLOCATION_MISMATCH. | 678 // STUN_ERROR_ALLOCATION_MISMATCH. |
| 672 TEST_F(TurnPortTest, TestSharedSocketAllocateMismatch) { | 679 TEST_F(TurnPortTest, TestSharedSocketAllocateMismatch) { |
| 673 // Do a normal allocation first. | 680 // Do a normal allocation first. |
| 674 CreateSharedTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr); | 681 CreateSharedTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr); |
| 675 turn_port_->PrepareAddress(); | 682 turn_port_->PrepareAddress(); |
| 676 EXPECT_TRUE_WAIT(turn_ready_, kTimeout); | 683 EXPECT_TRUE_WAIT(turn_ready_, kTimeout); |
| 677 rtc::SocketAddress first_addr(turn_port_->socket()->GetLocalAddress()); | 684 rtc::SocketAddress first_addr(turn_port_->socket()->GetLocalAddress()); |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 turn_port_->PrepareAddress(); | 1056 turn_port_->PrepareAddress(); |
| 1050 ASSERT_TRUE_WAIT(turn_error_, kResolverTimeout); | 1057 ASSERT_TRUE_WAIT(turn_error_, kResolverTimeout); |
| 1051 EXPECT_TRUE(turn_port_->Candidates().empty()); | 1058 EXPECT_TRUE(turn_port_->Candidates().empty()); |
| 1052 turn_port_.reset(); | 1059 turn_port_.reset(); |
| 1053 rtc::Thread::Current()->Post(this, MSG_TESTFINISH); | 1060 rtc::Thread::Current()->Post(this, MSG_TESTFINISH); |
| 1054 // Waiting for above message to be processed. | 1061 // Waiting for above message to be processed. |
| 1055 ASSERT_TRUE_WAIT(test_finish_, kTimeout); | 1062 ASSERT_TRUE_WAIT(test_finish_, kTimeout); |
| 1056 EXPECT_EQ(last_fd_count, GetFDCount()); | 1063 EXPECT_EQ(last_fd_count, GetFDCount()); |
| 1057 } | 1064 } |
| 1058 #endif | 1065 #endif |
| OLD | NEW |