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

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

Issue 718273002: Use uint16 for port numbers, net/ edition (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Self review 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_socket.h" 5 #include "net/socket/tcp_socket.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 socket_.Bind(address) != OK || 49 socket_.Bind(address) != OK ||
50 socket_.Listen(kListenBacklog) != OK) { 50 socket_.Listen(kListenBacklog) != OK) {
51 LOG(ERROR) << "Failed to listen on ::1 - probably because IPv6 is " 51 LOG(ERROR) << "Failed to listen on ::1 - probably because IPv6 is "
52 "disabled. Skipping the test"; 52 "disabled. Skipping the test";
53 return; 53 return;
54 } 54 }
55 ASSERT_EQ(OK, socket_.GetLocalAddress(&local_address_)); 55 ASSERT_EQ(OK, socket_.GetLocalAddress(&local_address_));
56 *success = true; 56 *success = true;
57 } 57 }
58 58
59 void ParseAddress(const std::string& ip_str, int port, IPEndPoint* address) { 59 void ParseAddress(const std::string& ip_str,
60 uint16 port,
61 IPEndPoint* address) {
60 IPAddressNumber ip_number; 62 IPAddressNumber ip_number;
61 bool rv = ParseIPLiteralToNumber(ip_str, &ip_number); 63 bool rv = ParseIPLiteralToNumber(ip_str, &ip_number);
62 if (!rv) 64 if (!rv)
63 return; 65 return;
64 *address = IPEndPoint(ip_number, port); 66 *address = IPEndPoint(ip_number, port);
65 } 67 }
66 68
67 void TestAcceptAsync() { 69 void TestAcceptAsync() {
68 TestCompletionCallback accept_callback; 70 TestCompletionCallback accept_callback;
69 scoped_ptr<TCPSocket> accepted_socket; 71 scoped_ptr<TCPSocket> accepted_socket;
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 memmove(&buffer[bytes_read], read_buffer->data(), read_result); 279 memmove(&buffer[bytes_read], read_buffer->data(), read_result);
278 bytes_read += read_result; 280 bytes_read += read_result;
279 } 281 }
280 282
281 std::string received_message(buffer.begin(), buffer.end()); 283 std::string received_message(buffer.begin(), buffer.end());
282 ASSERT_EQ(message, received_message); 284 ASSERT_EQ(message, received_message);
283 } 285 }
284 286
285 } // namespace 287 } // namespace
286 } // namespace net 288 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698