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 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
700 turn_port_->set_credentials(bad_credentials); | 700 turn_port_->set_credentials(bad_credentials); |
701 turn_refresh_success_ = false; | 701 turn_refresh_success_ = false; |
702 // This sends out the first RefreshRequest with correct credentials. | 702 // This sends out the first RefreshRequest with correct credentials. |
703 // When this succeeds, it will schedule a new RefreshRequest with the bad | 703 // When this succeeds, it will schedule a new RefreshRequest with the bad |
704 // credential. | 704 // credential. |
705 turn_port_->FlushRequests(); | 705 turn_port_->FlushRequests(); |
706 EXPECT_TRUE_WAIT(turn_refresh_success_, kTimeout); | 706 EXPECT_TRUE_WAIT(turn_refresh_success_, kTimeout); |
707 // Flush it again, it will receive a bad response. | 707 // Flush it again, it will receive a bad response. |
708 turn_port_->FlushRequests(); | 708 turn_port_->FlushRequests(); |
709 EXPECT_TRUE_WAIT(!turn_refresh_success_, kTimeout); | 709 EXPECT_TRUE_WAIT(!turn_refresh_success_, kTimeout); |
710 EXPECT_TRUE(turn_port_->connections().empty()); | 710 EXPECT_TRUE_WAIT(!turn_port_->connected(), kTimeout); |
pthatcher1
2015/12/30 22:52:13
Shouldn't we still check this?
honghaiz3
2015/12/31 03:22:10
It wasn't needed because we did not create connect
| |
711 EXPECT_FALSE(turn_port_->connected()); | |
712 } | 711 } |
713 | 712 |
714 // Test that CreateConnection will return null if port becomes disconnected. | 713 // Test that CreateConnection will return null if port becomes disconnected. |
715 TEST_F(TurnPortTest, TestCreateConnectionWhenSocketClosed) { | 714 TEST_F(TurnPortTest, TestCreateConnectionWhenSocketClosed) { |
716 turn_server_.AddInternalSocket(kTurnTcpIntAddr, cricket::PROTO_TCP); | 715 turn_server_.AddInternalSocket(kTurnTcpIntAddr, cricket::PROTO_TCP); |
717 CreateTurnPort(kTurnUsername, kTurnPassword, kTurnTcpProtoAddr); | 716 CreateTurnPort(kTurnUsername, kTurnPassword, kTurnTcpProtoAddr); |
718 PrepareTurnAndUdpPorts(); | 717 PrepareTurnAndUdpPorts(); |
719 // Create a connection. | 718 // Create a connection. |
720 Connection* conn1 = turn_port_->CreateConnection(udp_port_->Candidates()[0], | 719 Connection* conn1 = turn_port_->CreateConnection(udp_port_->Candidates()[0], |
721 Port::ORIGIN_MESSAGE); | 720 Port::ORIGIN_MESSAGE); |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
985 turn_port_->PrepareAddress(); | 984 turn_port_->PrepareAddress(); |
986 ASSERT_TRUE_WAIT(turn_error_, kTimeout); | 985 ASSERT_TRUE_WAIT(turn_error_, kTimeout); |
987 EXPECT_TRUE(turn_port_->Candidates().empty()); | 986 EXPECT_TRUE(turn_port_->Candidates().empty()); |
988 turn_port_.reset(); | 987 turn_port_.reset(); |
989 rtc::Thread::Current()->Post(this, MSG_TESTFINISH); | 988 rtc::Thread::Current()->Post(this, MSG_TESTFINISH); |
990 // Waiting for above message to be processed. | 989 // Waiting for above message to be processed. |
991 ASSERT_TRUE_WAIT(test_finish_, kTimeout); | 990 ASSERT_TRUE_WAIT(test_finish_, kTimeout); |
992 EXPECT_EQ(last_fd_count, GetFDCount()); | 991 EXPECT_EQ(last_fd_count, GetFDCount()); |
993 } | 992 } |
994 #endif | 993 #endif |
OLD | NEW |