| 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) |
| 11 #include <dirent.h> | 11 #include <dirent.h> |
| 12 #endif | 12 #endif |
| 13 | 13 |
| 14 #include <memory> |
| 15 |
| 14 #include "webrtc/p2p/base/basicpacketsocketfactory.h" | 16 #include "webrtc/p2p/base/basicpacketsocketfactory.h" |
| 15 #include "webrtc/p2p/base/p2pconstants.h" | 17 #include "webrtc/p2p/base/p2pconstants.h" |
| 16 #include "webrtc/p2p/base/portallocator.h" | 18 #include "webrtc/p2p/base/portallocator.h" |
| 17 #include "webrtc/p2p/base/tcpport.h" | 19 #include "webrtc/p2p/base/tcpport.h" |
| 18 #include "webrtc/p2p/base/testturnserver.h" | 20 #include "webrtc/p2p/base/testturnserver.h" |
| 19 #include "webrtc/p2p/base/turnport.h" | 21 #include "webrtc/p2p/base/turnport.h" |
| 20 #include "webrtc/p2p/base/udpport.h" | 22 #include "webrtc/p2p/base/udpport.h" |
| 21 #include "webrtc/base/asynctcpsocket.h" | 23 #include "webrtc/base/asynctcpsocket.h" |
| 22 #include "webrtc/base/buffer.h" | 24 #include "webrtc/base/buffer.h" |
| 23 #include "webrtc/base/dscp.h" | 25 #include "webrtc/base/dscp.h" |
| 24 #include "webrtc/base/firewallsocketserver.h" | 26 #include "webrtc/base/firewallsocketserver.h" |
| 25 #include "webrtc/base/gunit.h" | 27 #include "webrtc/base/gunit.h" |
| 26 #include "webrtc/base/helpers.h" | 28 #include "webrtc/base/helpers.h" |
| 27 #include "webrtc/base/logging.h" | 29 #include "webrtc/base/logging.h" |
| 28 #include "webrtc/base/physicalsocketserver.h" | 30 #include "webrtc/base/physicalsocketserver.h" |
| 29 #include "webrtc/base/scoped_ptr.h" | |
| 30 #include "webrtc/base/socketaddress.h" | 31 #include "webrtc/base/socketaddress.h" |
| 31 #include "webrtc/base/ssladapter.h" | 32 #include "webrtc/base/ssladapter.h" |
| 32 #include "webrtc/base/thread.h" | 33 #include "webrtc/base/thread.h" |
| 33 #include "webrtc/base/virtualsocketserver.h" | 34 #include "webrtc/base/virtualsocketserver.h" |
| 34 | 35 |
| 35 using rtc::SocketAddress; | 36 using rtc::SocketAddress; |
| 36 using cricket::Connection; | 37 using cricket::Connection; |
| 37 using cricket::Port; | 38 using cricket::Port; |
| 38 using cricket::PortInterface; | 39 using cricket::PortInterface; |
| 39 using cricket::TurnPort; | 40 using cricket::TurnPort; |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 ASSERT_EQ_WAIT(num_packets, udp_packets_.size(), kTimeout); | 501 ASSERT_EQ_WAIT(num_packets, udp_packets_.size(), kTimeout); |
| 501 for (size_t i = 0; i < num_packets; ++i) { | 502 for (size_t i = 0; i < num_packets; ++i) { |
| 502 EXPECT_EQ(i + 1, turn_packets_[i].size()); | 503 EXPECT_EQ(i + 1, turn_packets_[i].size()); |
| 503 EXPECT_EQ(i + 1, udp_packets_[i].size()); | 504 EXPECT_EQ(i + 1, udp_packets_[i].size()); |
| 504 EXPECT_EQ(turn_packets_[i], udp_packets_[i]); | 505 EXPECT_EQ(turn_packets_[i], udp_packets_[i]); |
| 505 } | 506 } |
| 506 } | 507 } |
| 507 | 508 |
| 508 protected: | 509 protected: |
| 509 rtc::Thread* main_; | 510 rtc::Thread* main_; |
| 510 rtc::scoped_ptr<rtc::PhysicalSocketServer> pss_; | 511 std::unique_ptr<rtc::PhysicalSocketServer> pss_; |
| 511 rtc::scoped_ptr<TurnPortTestVirtualSocketServer> ss_; | 512 std::unique_ptr<TurnPortTestVirtualSocketServer> ss_; |
| 512 rtc::SocketServerScope ss_scope_; | 513 rtc::SocketServerScope ss_scope_; |
| 513 rtc::Network network_; | 514 rtc::Network network_; |
| 514 rtc::BasicPacketSocketFactory socket_factory_; | 515 rtc::BasicPacketSocketFactory socket_factory_; |
| 515 rtc::scoped_ptr<rtc::AsyncPacketSocket> socket_; | 516 std::unique_ptr<rtc::AsyncPacketSocket> socket_; |
| 516 cricket::TestTurnServer turn_server_; | 517 cricket::TestTurnServer turn_server_; |
| 517 rtc::scoped_ptr<TurnPort> turn_port_; | 518 std::unique_ptr<TurnPort> turn_port_; |
| 518 rtc::scoped_ptr<UDPPort> udp_port_; | 519 std::unique_ptr<UDPPort> udp_port_; |
| 519 bool turn_ready_; | 520 bool turn_ready_; |
| 520 bool turn_error_; | 521 bool turn_error_; |
| 521 bool turn_unknown_address_; | 522 bool turn_unknown_address_; |
| 522 bool turn_create_permission_success_; | 523 bool turn_create_permission_success_; |
| 523 bool udp_ready_; | 524 bool udp_ready_; |
| 524 bool test_finish_; | 525 bool test_finish_; |
| 525 bool turn_refresh_success_ = false; | 526 bool turn_refresh_success_ = false; |
| 526 bool connection_destroyed_ = false; | 527 bool connection_destroyed_ = false; |
| 527 std::vector<rtc::Buffer> turn_packets_; | 528 std::vector<rtc::Buffer> turn_packets_; |
| 528 std::vector<rtc::Buffer> udp_packets_; | 529 std::vector<rtc::Buffer> udp_packets_; |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 turn_port_->PrepareAddress(); | 1050 turn_port_->PrepareAddress(); |
| 1050 ASSERT_TRUE_WAIT(turn_error_, kResolverTimeout); | 1051 ASSERT_TRUE_WAIT(turn_error_, kResolverTimeout); |
| 1051 EXPECT_TRUE(turn_port_->Candidates().empty()); | 1052 EXPECT_TRUE(turn_port_->Candidates().empty()); |
| 1052 turn_port_.reset(); | 1053 turn_port_.reset(); |
| 1053 rtc::Thread::Current()->Post(this, MSG_TESTFINISH); | 1054 rtc::Thread::Current()->Post(this, MSG_TESTFINISH); |
| 1054 // Waiting for above message to be processed. | 1055 // Waiting for above message to be processed. |
| 1055 ASSERT_TRUE_WAIT(test_finish_, kTimeout); | 1056 ASSERT_TRUE_WAIT(test_finish_, kTimeout); |
| 1056 EXPECT_EQ(last_fd_count, GetFDCount()); | 1057 EXPECT_EQ(last_fd_count, GetFDCount()); |
| 1057 } | 1058 } |
| 1058 #endif | 1059 #endif |
| OLD | NEW |