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

Side by Side Diff: net/socket/tcp_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
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>
11 11
12 #include "base/basictypes.h"
12 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
14 #include "net/base/address_list.h" 15 #include "net/base/address_list.h"
15 #include "net/base/io_buffer.h" 16 #include "net/base/io_buffer.h"
16 #include "net/base/ip_endpoint.h" 17 #include "net/base/ip_endpoint.h"
17 #include "net/base/net_errors.h" 18 #include "net/base/net_errors.h"
18 #include "net/base/test_completion_callback.h" 19 #include "net/base/test_completion_callback.h"
19 #include "net/socket/tcp_client_socket.h" 20 #include "net/socket/tcp_client_socket.h"
20 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
21 #include "testing/platform_test.h" 22 #include "testing/platform_test.h"
(...skipping 27 matching lines...) Expand all
49 socket_.Bind(address) != OK || 50 socket_.Bind(address) != OK ||
50 socket_.Listen(kListenBacklog) != OK) { 51 socket_.Listen(kListenBacklog) != OK) {
51 LOG(ERROR) << "Failed to listen on ::1 - probably because IPv6 is " 52 LOG(ERROR) << "Failed to listen on ::1 - probably because IPv6 is "
52 "disabled. Skipping the test"; 53 "disabled. Skipping the test";
53 return; 54 return;
54 } 55 }
55 ASSERT_EQ(OK, socket_.GetLocalAddress(&local_address_)); 56 ASSERT_EQ(OK, socket_.GetLocalAddress(&local_address_));
56 *success = true; 57 *success = true;
57 } 58 }
58 59
59 void ParseAddress(const std::string& ip_str, int port, IPEndPoint* address) { 60 void ParseAddress(const std::string& ip_str,
61 uint16 port,
62 IPEndPoint* address) {
60 IPAddressNumber ip_number; 63 IPAddressNumber ip_number;
61 bool rv = ParseIPLiteralToNumber(ip_str, &ip_number); 64 bool rv = ParseIPLiteralToNumber(ip_str, &ip_number);
62 if (!rv) 65 if (!rv)
63 return; 66 return;
64 *address = IPEndPoint(ip_number, port); 67 *address = IPEndPoint(ip_number, port);
65 } 68 }
66 69
67 void TestAcceptAsync() { 70 void TestAcceptAsync() {
68 TestCompletionCallback accept_callback; 71 TestCompletionCallback accept_callback;
69 scoped_ptr<TCPSocket> accepted_socket; 72 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); 280 memmove(&buffer[bytes_read], read_buffer->data(), read_result);
278 bytes_read += read_result; 281 bytes_read += read_result;
279 } 282 }
280 283
281 std::string received_message(buffer.begin(), buffer.end()); 284 std::string received_message(buffer.begin(), buffer.end());
282 ASSERT_EQ(message, received_message); 285 ASSERT_EQ(message, received_message);
283 } 286 }
284 287
285 } // namespace 288 } // namespace
286 } // namespace net 289 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/tcp_server_socket_unittest.cc ('k') | net/socket/transport_client_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698