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

Side by Side Diff: net/dns/mojo_host_resolver_impl_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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/dns/mojo_host_resolver_impl.h" 5 #include "net/dns/mojo_host_resolver_impl.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 // every run. 98 // every run.
99 void SetResolveCallback(base::Closure callback) { 99 void SetResolveCallback(base::Closure callback) {
100 resolve_callback_ = callback; 100 resolve_callback_ = callback;
101 } 101 }
102 102
103 // Overridden from MockHostResolver. 103 // Overridden from MockHostResolver.
104 int Resolve(const RequestInfo& info, 104 int Resolve(const RequestInfo& info,
105 RequestPriority priority, 105 RequestPriority priority,
106 AddressList* addresses, 106 AddressList* addresses,
107 const CompletionCallback& callback, 107 const CompletionCallback& callback,
108 RequestHandle* out_req, 108 std::unique_ptr<Request>* request,
109 const BoundNetLog& net_log) override; 109 const BoundNetLog& net_log) override;
110 110
111 private: 111 private:
112 base::Closure resolve_callback_; 112 base::Closure resolve_callback_;
113 }; 113 };
114 114
115 int CallbackMockHostResolver::Resolve(const RequestInfo& info, 115 int CallbackMockHostResolver::Resolve(const RequestInfo& info,
116 RequestPriority priority, 116 RequestPriority priority,
117 AddressList* addresses, 117 AddressList* addresses,
118 const CompletionCallback& callback, 118 const CompletionCallback& callback,
119 RequestHandle* out_req, 119 std::unique_ptr<Request>* request,
120 const BoundNetLog& net_log) { 120 const BoundNetLog& net_log) {
121 int result = MockHostResolver::Resolve(info, priority, addresses, callback, 121 int result = MockHostResolver::Resolve(info, priority, addresses, callback,
122 out_req, net_log); 122 request, net_log);
123 if (!resolve_callback_.is_null()) { 123 if (!resolve_callback_.is_null()) {
124 resolve_callback_.Run(); 124 resolve_callback_.Run();
125 resolve_callback_.Reset(); 125 resolve_callback_.Reset();
126 } 126 }
127 return result; 127 return result;
128 } 128 }
129 129
130 } // namespace 130 } // namespace
131 131
132 class MojoHostResolverImplTest : public testing::Test { 132 class MojoHostResolverImplTest : public testing::Test {
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 WaitForRequests(1); 283 WaitForRequests(1);
284 284
285 client.reset(); 285 client.reset();
286 base::RunLoop().RunUntilIdle(); 286 base::RunLoop().RunUntilIdle();
287 287
288 mock_host_resolver_.ResolveAllPending(); 288 mock_host_resolver_.ResolveAllPending();
289 base::RunLoop().RunUntilIdle(); 289 base::RunLoop().RunUntilIdle();
290 } 290 }
291 291
292 } // namespace net 292 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698