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

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

Issue 2116983002: Change HostResolver::Resolve() to take an std::unique_ptr<Request>* rather than a RequestHandle* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: http_stream_factory_impl_job_controller_unittest RequestHandle* to unique_ptr Created 4 years, 4 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
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 <memory> 5 #include <memory>
6 #include <string> 6 #include <string>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 listen_port_ = local_address.port(); 110 listen_port_ = local_address.port();
111 listen_sock_->Accept(&connected_sock_, 111 listen_sock_->Accept(&connected_sock_,
112 base::Bind(&TransportClientSocketTest::AcceptCallback, 112 base::Bind(&TransportClientSocketTest::AcceptCallback,
113 base::Unretained(this))); 113 base::Unretained(this)));
114 114
115 AddressList addr; 115 AddressList addr;
116 // MockHostResolver resolves everything to 127.0.0.1. 116 // MockHostResolver resolves everything to 127.0.0.1.
117 std::unique_ptr<HostResolver> resolver(new MockHostResolver()); 117 std::unique_ptr<HostResolver> resolver(new MockHostResolver());
118 HostResolver::RequestInfo info(HostPortPair("localhost", listen_port_)); 118 HostResolver::RequestInfo info(HostPortPair("localhost", listen_port_));
119 TestCompletionCallback callback; 119 TestCompletionCallback callback;
120 std::unique_ptr<HostResolver::Request> request;
120 int rv = resolver->Resolve(info, DEFAULT_PRIORITY, &addr, callback.callback(), 121 int rv = resolver->Resolve(info, DEFAULT_PRIORITY, &addr, callback.callback(),
121 NULL, BoundNetLog()); 122 &request, BoundNetLog());
122 CHECK_EQ(ERR_IO_PENDING, rv); 123 CHECK_EQ(ERR_IO_PENDING, rv);
123 rv = callback.WaitForResult(); 124 rv = callback.WaitForResult();
124 CHECK_EQ(rv, OK); 125 CHECK_EQ(rv, OK);
125 sock_ = socket_factory_->CreateTransportClientSocket(addr, NULL, &net_log_, 126 sock_ = socket_factory_->CreateTransportClientSocket(addr, NULL, &net_log_,
126 NetLog::Source()); 127 NetLog::Source());
127 } 128 }
128 129
129 int TransportClientSocketTest::DrainClientSocket( 130 int TransportClientSocketTest::DrainClientSocket(
130 IOBuffer* buf, 131 IOBuffer* buf,
131 uint32_t buf_len, 132 uint32_t buf_len,
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 469
469 // It's possible the read is blocked because it's already read all the data. 470 // It's possible the read is blocked because it's already read all the data.
470 // Close the server socket, so there will at least be a 0-byte read. 471 // Close the server socket, so there will at least be a 0-byte read.
471 CloseServerSocket(); 472 CloseServerSocket();
472 473
473 rv = callback.WaitForResult(); 474 rv = callback.WaitForResult();
474 EXPECT_GE(rv, 0); 475 EXPECT_GE(rv, 0);
475 } 476 }
476 477
477 } // namespace net 478 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698