OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "chrome/browser/policy/cloud/test_request_interceptor.h" | 5 #include "chrome/browser/policy/cloud/test_request_interceptor.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <queue> | 8 #include <queue> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 158 |
159 class TestRequestInterceptor::Delegate : public net::URLRequestInterceptor { | 159 class TestRequestInterceptor::Delegate : public net::URLRequestInterceptor { |
160 public: | 160 public: |
161 Delegate(const std::string& hostname, | 161 Delegate(const std::string& hostname, |
162 scoped_refptr<base::SequencedTaskRunner> io_task_runner); | 162 scoped_refptr<base::SequencedTaskRunner> io_task_runner); |
163 virtual ~Delegate(); | 163 virtual ~Delegate(); |
164 | 164 |
165 // net::URLRequestInterceptor implementation: | 165 // net::URLRequestInterceptor implementation: |
166 virtual net::URLRequestJob* MaybeInterceptRequest( | 166 virtual net::URLRequestJob* MaybeInterceptRequest( |
167 net::URLRequest* request, | 167 net::URLRequest* request, |
168 net::NetworkDelegate* network_delegate) const OVERRIDE; | 168 net::NetworkDelegate* network_delegate) const override; |
169 | 169 |
170 void GetPendingSize(size_t* pending_size) const; | 170 void GetPendingSize(size_t* pending_size) const; |
171 void PushJobCallback(const JobCallback& callback); | 171 void PushJobCallback(const JobCallback& callback); |
172 | 172 |
173 private: | 173 private: |
174 const std::string hostname_; | 174 const std::string hostname_; |
175 scoped_refptr<base::SequencedTaskRunner> io_task_runner_; | 175 scoped_refptr<base::SequencedTaskRunner> io_task_runner_; |
176 | 176 |
177 // The queue of pending callbacks. 'mutable' because MaybeCreateJob() is a | 177 // The queue of pending callbacks. 'mutable' because MaybeCreateJob() is a |
178 // const method; it can't reenter though, because it runs exclusively on | 178 // const method; it can't reenter though, because it runs exclusively on |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 FROM_HERE, | 286 FROM_HERE, |
287 base::Bind( | 287 base::Bind( |
288 base::IgnoreResult(&base::MessageLoopProxy::PostTask), | 288 base::IgnoreResult(&base::MessageLoopProxy::PostTask), |
289 base::MessageLoopProxy::current(), | 289 base::MessageLoopProxy::current(), |
290 FROM_HERE, | 290 FROM_HERE, |
291 run_loop.QuitClosure())); | 291 run_loop.QuitClosure())); |
292 run_loop.Run(); | 292 run_loop.Run(); |
293 } | 293 } |
294 | 294 |
295 } // namespace policy | 295 } // namespace policy |
OLD | NEW |