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

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

Issue 149511: Refactorings surrounding HostResolver:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Merge in socks5_client_socket_unittest.cc Created 11 years, 5 months 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 | Annotate | Revision Log
« no previous file with comments | « net/socket/tcp_client_socket_pool_unittest.cc ('k') | net/socket/tcp_pinger_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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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_client_socket.h" 5 #include "net/socket/tcp_client_socket.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "net/base/address_list.h" 8 #include "net/base/address_list.h"
9 #include "net/base/host_resolver.h" 9 #include "net/base/host_resolver.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 for (port = kMinPort; port < kMaxPort; port++) { 79 for (port = kMinPort; port < kMaxPort; port++) {
80 sock = ListenSocket::Listen("127.0.0.1", port, this); 80 sock = ListenSocket::Listen("127.0.0.1", port, this);
81 if (sock) 81 if (sock)
82 break; 82 break;
83 } 83 }
84 ASSERT_TRUE(sock != NULL); 84 ASSERT_TRUE(sock != NULL);
85 listen_sock_ = sock; 85 listen_sock_ = sock;
86 listen_port_ = port; 86 listen_port_ = port;
87 87
88 AddressList addr; 88 AddressList addr;
89 scoped_refptr<HostResolver> resolver(new HostResolver); 89 scoped_refptr<HostResolver> resolver(CreateSystemHostResolver());
90 HostResolver::RequestInfo info("localhost", listen_port_); 90 HostResolver::RequestInfo info("localhost", listen_port_);
91 int rv = resolver->Resolve(info, &addr, NULL, NULL); 91 int rv = resolver->Resolve(info, &addr, NULL, NULL);
92 CHECK(rv == OK); 92 CHECK(rv == OK);
93 sock_.reset(new TCPClientSocket(addr)); 93 sock_.reset(new TCPClientSocket(addr));
94 } 94 }
95 95
96 TEST_F(TCPClientSocketTest, Connect) { 96 TEST_F(TCPClientSocketTest, Connect) {
97 TestCompletionCallback callback; 97 TestCompletionCallback callback;
98 EXPECT_FALSE(sock_->IsConnected()); 98 EXPECT_FALSE(sock_->IsConnected());
99 99
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 // Close the server socket, so there will at least be a 0-byte read. 330 // Close the server socket, so there will at least be a 0-byte read.
331 CloseServerSocket(); 331 CloseServerSocket();
332 332
333 rv = callback.WaitForResult(); 333 rv = callback.WaitForResult();
334 EXPECT_GE(rv, 0); 334 EXPECT_GE(rv, 0);
335 } 335 }
336 336
337 } // namespace 337 } // namespace
338 338
339 } // namespace net 339 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/tcp_client_socket_pool_unittest.cc ('k') | net/socket/tcp_pinger_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698