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 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 | 708 |
709 // Run TurnConnectionTest with one-time-use nonce feature. | 709 // Run TurnConnectionTest with one-time-use nonce feature. |
710 // Here server will send a 438 STALE_NONCE error message for | 710 // Here server will send a 438 STALE_NONCE error message for |
711 // every TURN transaction. | 711 // every TURN transaction. |
712 TEST_F(TurnPortTest, TestTurnConnectionUsingOTUNonce) { | 712 TEST_F(TurnPortTest, TestTurnConnectionUsingOTUNonce) { |
713 turn_server_.set_enable_otu_nonce(true); | 713 turn_server_.set_enable_otu_nonce(true); |
714 CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr); | 714 CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr); |
715 TestTurnConnection(); | 715 TestTurnConnection(); |
716 } | 716 } |
717 | 717 |
| 718 // Test that CreatePermissionRequest will be scheduled after the success |
| 719 // of the first create permission request. |
| 720 TEST_F(TurnPortTest, TestRefreshCreatePermissionRequest) { |
| 721 CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr); |
| 722 |
| 723 ASSERT_TRUE(turn_port_ != NULL); |
| 724 turn_port_->PrepareAddress(); |
| 725 ASSERT_TRUE_WAIT(turn_ready_, kTimeout); |
| 726 CreateUdpPort(); |
| 727 udp_port_->PrepareAddress(); |
| 728 ASSERT_TRUE_WAIT(udp_ready_, kTimeout); |
| 729 |
| 730 Connection* conn = turn_port_->CreateConnection(udp_port_->Candidates()[0], |
| 731 Port::ORIGIN_MESSAGE); |
| 732 ASSERT_TRUE(conn != NULL); |
| 733 ASSERT_TRUE_WAIT(turn_create_permission_success_, kTimeout); |
| 734 turn_create_permission_success_ = false; |
| 735 // A create-permission-request should be pending. |
| 736 turn_port_->FlushRequests(); |
| 737 ASSERT_TRUE_WAIT(turn_create_permission_success_, kTimeout); |
| 738 } |
| 739 |
718 // Do a TURN allocation, establish a UDP connection, and send some data. | 740 // Do a TURN allocation, establish a UDP connection, and send some data. |
719 TEST_F(TurnPortTest, TestTurnSendDataTurnUdpToUdp) { | 741 TEST_F(TurnPortTest, TestTurnSendDataTurnUdpToUdp) { |
720 // Create ports and prepare addresses. | 742 // Create ports and prepare addresses. |
721 CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr); | 743 CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr); |
722 TestTurnSendData(); | 744 TestTurnSendData(); |
723 EXPECT_EQ(cricket::UDP_PROTOCOL_NAME, | 745 EXPECT_EQ(cricket::UDP_PROTOCOL_NAME, |
724 turn_port_->Candidates()[0].relay_protocol()); | 746 turn_port_->Candidates()[0].relay_protocol()); |
725 } | 747 } |
726 | 748 |
727 // Do a TURN allocation, establish a TCP connection, and send some data. | 749 // Do a TURN allocation, establish a TCP connection, and send some data. |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 turn_port_->PrepareAddress(); | 829 turn_port_->PrepareAddress(); |
808 ASSERT_TRUE_WAIT(turn_error_, kTimeout); | 830 ASSERT_TRUE_WAIT(turn_error_, kTimeout); |
809 EXPECT_TRUE(turn_port_->Candidates().empty()); | 831 EXPECT_TRUE(turn_port_->Candidates().empty()); |
810 turn_port_.reset(); | 832 turn_port_.reset(); |
811 rtc::Thread::Current()->Post(this, MSG_TESTFINISH); | 833 rtc::Thread::Current()->Post(this, MSG_TESTFINISH); |
812 // Waiting for above message to be processed. | 834 // Waiting for above message to be processed. |
813 ASSERT_TRUE_WAIT(test_finish_, kTimeout); | 835 ASSERT_TRUE_WAIT(test_finish_, kTimeout); |
814 EXPECT_EQ(last_fd_count, GetFDCount()); | 836 EXPECT_EQ(last_fd_count, GetFDCount()); |
815 } | 837 } |
816 #endif | 838 #endif |
OLD | NEW |