OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/socket/tcp_server_socket.h" | 5 #include "net/socket/tcp_server_socket.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 void ParseAddress(std::string ip_str, int port, IPEndPoint* address) { | 53 void ParseAddress(std::string ip_str, int port, IPEndPoint* address) { |
54 IPAddressNumber ip_number; | 54 IPAddressNumber ip_number; |
55 bool rv = ParseIPLiteralToNumber(ip_str, &ip_number); | 55 bool rv = ParseIPLiteralToNumber(ip_str, &ip_number); |
56 if (!rv) | 56 if (!rv) |
57 return; | 57 return; |
58 *address = IPEndPoint(ip_number, port); | 58 *address = IPEndPoint(ip_number, port); |
59 } | 59 } |
60 | 60 |
61 static IPEndPoint GetPeerAddress(StreamSocket* socket) { | 61 static IPEndPoint GetPeerAddress(StreamSocket* socket) { |
62 AddressList address; | 62 IPEndPoint address; |
63 EXPECT_EQ(OK, socket->GetPeerAddress(&address)); | 63 EXPECT_EQ(OK, socket->GetPeerAddress(&address)); |
64 return address.front(); | 64 return address; |
65 } | 65 } |
66 | 66 |
67 AddressList local_address_list() const { | 67 AddressList local_address_list() const { |
68 return AddressList(local_address_); | 68 return AddressList(local_address_); |
69 } | 69 } |
70 | 70 |
71 TCPServerSocket socket_; | 71 TCPServerSocket socket_; |
72 IPEndPoint local_address_; | 72 IPEndPoint local_address_; |
73 }; | 73 }; |
74 | 74 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 bytes_read += read_result; | 244 bytes_read += read_result; |
245 } | 245 } |
246 | 246 |
247 std::string received_message(buffer.begin(), buffer.end()); | 247 std::string received_message(buffer.begin(), buffer.end()); |
248 ASSERT_EQ(message, received_message); | 248 ASSERT_EQ(message, received_message); |
249 } | 249 } |
250 | 250 |
251 } // namespace | 251 } // namespace |
252 | 252 |
253 } // namespace net | 253 } // namespace net |
OLD | NEW |