Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Side by Side Diff: net/socket/tcp_server_socket_unittest.cc

Issue 754433003: Update from https://crrev.com/305340 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/socket/tcp_listen_socket.cc ('k') | net/socket/tcp_socket_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 ParseAddress("::1", 0, &address); 43 ParseAddress("::1", 0, &address);
44 if (socket_.Listen(address, kListenBacklog) != 0) { 44 if (socket_.Listen(address, kListenBacklog) != 0) {
45 LOG(ERROR) << "Failed to listen on ::1 - probably because IPv6 is " 45 LOG(ERROR) << "Failed to listen on ::1 - probably because IPv6 is "
46 "disabled. Skipping the test"; 46 "disabled. Skipping the test";
47 return; 47 return;
48 } 48 }
49 ASSERT_EQ(OK, socket_.GetLocalAddress(&local_address_)); 49 ASSERT_EQ(OK, socket_.GetLocalAddress(&local_address_));
50 *success = true; 50 *success = true;
51 } 51 }
52 52
53 void ParseAddress(std::string ip_str, int port, IPEndPoint* address) { 53 void ParseAddress(std::string ip_str, uint16 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 IPEndPoint address; 62 IPEndPoint address;
63 EXPECT_EQ(OK, socket->GetPeerAddress(&address)); 63 EXPECT_EQ(OK, socket->GetPeerAddress(&address));
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 bytes_read += read_result; 242 bytes_read += read_result;
243 } 243 }
244 244
245 std::string received_message(buffer.begin(), buffer.end()); 245 std::string received_message(buffer.begin(), buffer.end());
246 ASSERT_EQ(message, received_message); 246 ASSERT_EQ(message, received_message);
247 } 247 }
248 248
249 } // namespace 249 } // namespace
250 250
251 } // namespace net 251 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/tcp_listen_socket.cc ('k') | net/socket/tcp_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698