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 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
953 EXPECT_TRUE_SIMULATED_WAIT(conn1->writable(), kTimeout, clock); | 953 EXPECT_TRUE_SIMULATED_WAIT(conn1->writable(), kTimeout, clock); |
954 bool success = | 954 bool success = |
955 turn_port_->SetEntryChannelId(udp_port_->Candidates()[0].address(), -1); | 955 turn_port_->SetEntryChannelId(udp_port_->Candidates()[0].address(), -1); |
956 ASSERT_TRUE(success); | 956 ASSERT_TRUE(success); |
957 | 957 |
958 std::string data = "ABC"; | 958 std::string data = "ABC"; |
959 conn1->Send(data.data(), data.length(), options); | 959 conn1->Send(data.data(), data.length(), options); |
960 | 960 |
961 EXPECT_TRUE_SIMULATED_WAIT(CheckConnectionFailedAndPruned(conn1), kTimeout, | 961 EXPECT_TRUE_SIMULATED_WAIT(CheckConnectionFailedAndPruned(conn1), kTimeout, |
962 clock); | 962 clock); |
963 // Verify that no packet can be sent after a bind request error. | 963 // Verify that packets are allowed to be sent after a bind request error. |
| 964 // They'll just use a send indication instead. |
964 conn2->SignalReadPacket.connect(static_cast<TurnPortTest*>(this), | 965 conn2->SignalReadPacket.connect(static_cast<TurnPortTest*>(this), |
965 &TurnPortTest::OnUdpReadPacket); | 966 &TurnPortTest::OnUdpReadPacket); |
966 conn1->Send(data.data(), data.length(), options); | 967 conn1->Send(data.data(), data.length(), options); |
967 SIMULATED_WAIT(!udp_packets_.empty(), kTimeout, clock); | 968 EXPECT_TRUE_SIMULATED_WAIT(!udp_packets_.empty(), kTimeout, clock); |
968 EXPECT_TRUE(udp_packets_.empty()); | |
969 } | 969 } |
970 | 970 |
971 // Do a TURN allocation, establish a UDP connection, and send some data. | 971 // Do a TURN allocation, establish a UDP connection, and send some data. |
972 TEST_F(TurnPortTest, TestTurnSendDataTurnUdpToUdp) { | 972 TEST_F(TurnPortTest, TestTurnSendDataTurnUdpToUdp) { |
973 // Create ports and prepare addresses. | 973 // Create ports and prepare addresses. |
974 CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr); | 974 CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr); |
975 TestTurnSendData(); | 975 TestTurnSendData(); |
976 EXPECT_EQ(cricket::UDP_PROTOCOL_NAME, | 976 EXPECT_EQ(cricket::UDP_PROTOCOL_NAME, |
977 turn_port_->Candidates()[0].relay_protocol()); | 977 turn_port_->Candidates()[0].relay_protocol()); |
978 } | 978 } |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1122 turn_port_->PrepareAddress(); | 1122 turn_port_->PrepareAddress(); |
1123 ASSERT_TRUE_WAIT(turn_error_, kResolverTimeout); | 1123 ASSERT_TRUE_WAIT(turn_error_, kResolverTimeout); |
1124 EXPECT_TRUE(turn_port_->Candidates().empty()); | 1124 EXPECT_TRUE(turn_port_->Candidates().empty()); |
1125 turn_port_.reset(); | 1125 turn_port_.reset(); |
1126 rtc::Thread::Current()->Post(RTC_FROM_HERE, this, MSG_TESTFINISH); | 1126 rtc::Thread::Current()->Post(RTC_FROM_HERE, this, MSG_TESTFINISH); |
1127 // Waiting for above message to be processed. | 1127 // Waiting for above message to be processed. |
1128 ASSERT_TRUE_WAIT(test_finish_, kTimeout); | 1128 ASSERT_TRUE_WAIT(test_finish_, kTimeout); |
1129 EXPECT_EQ(last_fd_count, GetFDCount()); | 1129 EXPECT_EQ(last_fd_count, GetFDCount()); |
1130 } | 1130 } |
1131 #endif | 1131 #endif |
OLD | NEW |