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 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 turn_server_.set_enable_otu_nonce(true); | 705 turn_server_.set_enable_otu_nonce(true); |
706 CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr); | 706 CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr); |
707 TestTurnConnection(); | 707 TestTurnConnection(); |
708 } | 708 } |
709 | 709 |
710 // Do a TURN allocation, establish a UDP connection, and send some data. | 710 // Do a TURN allocation, establish a UDP connection, and send some data. |
711 TEST_F(TurnPortTest, TestTurnSendDataTurnUdpToUdp) { | 711 TEST_F(TurnPortTest, TestTurnSendDataTurnUdpToUdp) { |
712 // Create ports and prepare addresses. | 712 // Create ports and prepare addresses. |
713 CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr); | 713 CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr); |
714 TestTurnSendData(); | 714 TestTurnSendData(); |
| 715 EXPECT_EQ(turn_port_->Candidates()[0].relay_protocol(), |
| 716 cricket::UDP_PROTOCOL_NAME); |
715 } | 717 } |
716 | 718 |
717 // Do a TURN allocation, establish a TCP connection, and send some data. | 719 // Do a TURN allocation, establish a TCP connection, and send some data. |
718 TEST_F(TurnPortTest, TestTurnSendDataTurnTcpToUdp) { | 720 TEST_F(TurnPortTest, TestTurnSendDataTurnTcpToUdp) { |
719 turn_server_.AddInternalSocket(kTurnTcpIntAddr, cricket::PROTO_TCP); | 721 turn_server_.AddInternalSocket(kTurnTcpIntAddr, cricket::PROTO_TCP); |
720 // Create ports and prepare addresses. | 722 // Create ports and prepare addresses. |
721 CreateTurnPort(kTurnUsername, kTurnPassword, kTurnTcpProtoAddr); | 723 CreateTurnPort(kTurnUsername, kTurnPassword, kTurnTcpProtoAddr); |
722 TestTurnSendData(); | 724 TestTurnSendData(); |
| 725 EXPECT_EQ(turn_port_->Candidates()[0].relay_protocol(), |
| 726 cricket::TCP_PROTOCOL_NAME); |
723 } | 727 } |
724 | 728 |
725 // Test TURN fails to make a connection from IPv6 address to a server which has | 729 // Test TURN fails to make a connection from IPv6 address to a server which has |
726 // IPv4 address. | 730 // IPv4 address. |
727 TEST_F(TurnPortTest, TestTurnLocalIPv6AddressServerIPv4) { | 731 TEST_F(TurnPortTest, TestTurnLocalIPv6AddressServerIPv4) { |
728 turn_server_.AddInternalSocket(kTurnUdpIPv6IntAddr, cricket::PROTO_UDP); | 732 turn_server_.AddInternalSocket(kTurnUdpIPv6IntAddr, cricket::PROTO_UDP); |
729 CreateTurnPort(kLocalIPv6Addr, kTurnUsername, kTurnPassword, | 733 CreateTurnPort(kLocalIPv6Addr, kTurnUsername, kTurnPassword, |
730 kTurnUdpProtoAddr); | 734 kTurnUdpProtoAddr); |
731 turn_port_->PrepareAddress(); | 735 turn_port_->PrepareAddress(); |
732 ASSERT_TRUE_WAIT(turn_error_, kTimeout); | 736 ASSERT_TRUE_WAIT(turn_error_, kTimeout); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 turn_port_->PrepareAddress(); | 799 turn_port_->PrepareAddress(); |
796 ASSERT_TRUE_WAIT(turn_error_, kTimeout); | 800 ASSERT_TRUE_WAIT(turn_error_, kTimeout); |
797 EXPECT_TRUE(turn_port_->Candidates().empty()); | 801 EXPECT_TRUE(turn_port_->Candidates().empty()); |
798 turn_port_.reset(); | 802 turn_port_.reset(); |
799 rtc::Thread::Current()->Post(this, MSG_TESTFINISH); | 803 rtc::Thread::Current()->Post(this, MSG_TESTFINISH); |
800 // Waiting for above message to be processed. | 804 // Waiting for above message to be processed. |
801 ASSERT_TRUE_WAIT(test_finish_, kTimeout); | 805 ASSERT_TRUE_WAIT(test_finish_, kTimeout); |
802 EXPECT_EQ(last_fd_count, GetFDCount()); | 806 EXPECT_EQ(last_fd_count, GetFDCount()); |
803 } | 807 } |
804 #endif | 808 #endif |
OLD | NEW |