OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2009 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 | 10 |
(...skipping 28 matching lines...) Expand all Loading... |
39 // creating sockets. The test will monitor the current state of the | 39 // creating sockets. The test will monitor the current state of the |
40 // RelayPort and created sockets by listening for signals such as, | 40 // RelayPort and created sockets by listening for signals such as, |
41 // SignalConnectFailure, SignalConnectTimeout, SignalSocketClosed and | 41 // SignalConnectFailure, SignalConnectTimeout, SignalSocketClosed and |
42 // SignalReadPacket. | 42 // SignalReadPacket. |
43 class RelayPortTest : public testing::Test, | 43 class RelayPortTest : public testing::Test, |
44 public sigslot::has_slots<> { | 44 public sigslot::has_slots<> { |
45 public: | 45 public: |
46 RelayPortTest() | 46 RelayPortTest() |
47 : virtual_socket_server_(new rtc::VirtualSocketServer()), | 47 : virtual_socket_server_(new rtc::VirtualSocketServer()), |
48 main_(virtual_socket_server_.get()), | 48 main_(virtual_socket_server_.get()), |
49 network_("unittest", "unittest", rtc::IPAddress(INADDR_ANY), 32), | 49 network_("unittest", "unittest", kLocalAddress.ipaddr(), 32), |
50 socket_factory_(rtc::Thread::Current()), | 50 socket_factory_(rtc::Thread::Current()), |
51 username_(rtc::CreateRandomString(16)), | 51 username_(rtc::CreateRandomString(16)), |
52 password_(rtc::CreateRandomString(16)), | 52 password_(rtc::CreateRandomString(16)), |
53 relay_port_(cricket::RelayPort::Create(&main_, | 53 relay_port_(cricket::RelayPort::Create(&main_, |
54 &socket_factory_, | 54 &socket_factory_, |
55 &network_, | 55 &network_, |
56 kLocalAddress.ipaddr(), | |
57 0, | 56 0, |
58 0, | 57 0, |
59 username_, | 58 username_, |
60 password_)), | 59 password_)), |
61 relay_server_(new cricket::RelayServer(&main_)) {} | 60 relay_server_(new cricket::RelayServer(&main_)) { |
| 61 network_.AddIP(kLocalAddress.ipaddr()); |
| 62 } |
62 | 63 |
63 void OnReadPacket(rtc::AsyncPacketSocket* socket, | 64 void OnReadPacket(rtc::AsyncPacketSocket* socket, |
64 const char* data, size_t size, | 65 const char* data, size_t size, |
65 const rtc::SocketAddress& remote_addr, | 66 const rtc::SocketAddress& remote_addr, |
66 const rtc::PacketTime& packet_time) { | 67 const rtc::PacketTime& packet_time) { |
67 received_packet_count_[socket]++; | 68 received_packet_count_[socket]++; |
68 } | 69 } |
69 | 70 |
70 void OnConnectFailure(const cricket::ProtocolAddress* addr) { | 71 void OnConnectFailure(const cricket::ProtocolAddress* addr) { |
71 failed_connections_.push_back(*addr); | 72 failed_connections_.push_back(*addr); |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 TestConnectUdp(); | 264 TestConnectUdp(); |
264 } | 265 } |
265 | 266 |
266 TEST_F(RelayPortTest, ConnectTcp) { | 267 TEST_F(RelayPortTest, ConnectTcp) { |
267 TestConnectTcp(); | 268 TestConnectTcp(); |
268 } | 269 } |
269 | 270 |
270 TEST_F(RelayPortTest, ConnectSslTcp) { | 271 TEST_F(RelayPortTest, ConnectSslTcp) { |
271 TestConnectSslTcp(); | 272 TestConnectSslTcp(); |
272 } | 273 } |
OLD | NEW |