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 691 matching lines...) Loading... |
702 turn_refresh_success_ = false; | 702 turn_refresh_success_ = false; |
703 // This sends out the first RefreshRequest with correct credentials. | 703 // This sends out the first RefreshRequest with correct credentials. |
704 // When this succeeds, it will schedule a new RefreshRequest with the bad | 704 // When this succeeds, it will schedule a new RefreshRequest with the bad |
705 // credential. | 705 // credential. |
706 turn_port_->FlushRequests(cricket::TURN_REFRESH_REQUEST); | 706 turn_port_->FlushRequests(cricket::TURN_REFRESH_REQUEST); |
707 EXPECT_TRUE_WAIT(turn_refresh_success_, kTimeout); | 707 EXPECT_TRUE_WAIT(turn_refresh_success_, kTimeout); |
708 // Flush it again, it will receive a bad response. | 708 // Flush it again, it will receive a bad response. |
709 turn_port_->FlushRequests(cricket::TURN_REFRESH_REQUEST); | 709 turn_port_->FlushRequests(cricket::TURN_REFRESH_REQUEST); |
710 EXPECT_TRUE_WAIT(!turn_refresh_success_, kTimeout); | 710 EXPECT_TRUE_WAIT(!turn_refresh_success_, kTimeout); |
711 EXPECT_TRUE_WAIT(!turn_port_->connected(), kTimeout); | 711 EXPECT_TRUE_WAIT(!turn_port_->connected(), kTimeout); |
712 EXPECT_TRUE(turn_port_->connections().empty()); | 712 EXPECT_TRUE_WAIT(turn_port_->connections().empty(), kTimeout); |
713 EXPECT_FALSE(turn_port_->HasRequests()); | 713 EXPECT_FALSE(turn_port_->HasRequests()); |
714 } | 714 } |
715 | 715 |
716 // Test that CreateConnection will return null if port becomes disconnected. | 716 // Test that CreateConnection will return null if port becomes disconnected. |
717 TEST_F(TurnPortTest, TestCreateConnectionWhenSocketClosed) { | 717 TEST_F(TurnPortTest, TestCreateConnectionWhenSocketClosed) { |
718 turn_server_.AddInternalSocket(kTurnTcpIntAddr, cricket::PROTO_TCP); | 718 turn_server_.AddInternalSocket(kTurnTcpIntAddr, cricket::PROTO_TCP); |
719 CreateTurnPort(kTurnUsername, kTurnPassword, kTurnTcpProtoAddr); | 719 CreateTurnPort(kTurnUsername, kTurnPassword, kTurnTcpProtoAddr); |
720 PrepareTurnAndUdpPorts(); | 720 PrepareTurnAndUdpPorts(); |
721 // Create a connection. | 721 // Create a connection. |
722 Connection* conn1 = turn_port_->CreateConnection(udp_port_->Candidates()[0], | 722 Connection* conn1 = turn_port_->CreateConnection(udp_port_->Candidates()[0], |
(...skipping 268 matching lines...) Loading... |
991 turn_port_->PrepareAddress(); | 991 turn_port_->PrepareAddress(); |
992 ASSERT_TRUE_WAIT(turn_error_, kResolverTimeout); | 992 ASSERT_TRUE_WAIT(turn_error_, kResolverTimeout); |
993 EXPECT_TRUE(turn_port_->Candidates().empty()); | 993 EXPECT_TRUE(turn_port_->Candidates().empty()); |
994 turn_port_.reset(); | 994 turn_port_.reset(); |
995 rtc::Thread::Current()->Post(this, MSG_TESTFINISH); | 995 rtc::Thread::Current()->Post(this, MSG_TESTFINISH); |
996 // Waiting for above message to be processed. | 996 // Waiting for above message to be processed. |
997 ASSERT_TRUE_WAIT(test_finish_, kTimeout); | 997 ASSERT_TRUE_WAIT(test_finish_, kTimeout); |
998 EXPECT_EQ(last_fd_count, GetFDCount()); | 998 EXPECT_EQ(last_fd_count, GetFDCount()); |
999 } | 999 } |
1000 #endif | 1000 #endif |
OLD | NEW |