| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/base/mock_host_resolver.h" | 5 #include "net/base/mock_host_resolver.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/platform_thread.h" | 8 #include "base/platform_thread.h" |
| 9 #include "base/ref_counted.h" | 9 #include "base/ref_counted.h" |
| 10 #include "googleurl/src/url_canon_ip.h" | 10 #include "googleurl/src/url_canon_ip.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 MockHostResolverBase::MockHostResolverBase(bool use_caching) | 40 MockHostResolverBase::MockHostResolverBase(bool use_caching) |
| 41 : use_caching_(use_caching) { | 41 : use_caching_(use_caching) { |
| 42 Reset(NULL); | 42 Reset(NULL); |
| 43 } | 43 } |
| 44 | 44 |
| 45 int MockHostResolverBase::Resolve(const RequestInfo& info, | 45 int MockHostResolverBase::Resolve(const RequestInfo& info, |
| 46 AddressList* addresses, | 46 AddressList* addresses, |
| 47 CompletionCallback* callback, | 47 CompletionCallback* callback, |
| 48 RequestHandle* out_req, | 48 RequestHandle* out_req, |
| 49 LoadLog* load_log) { | 49 const BoundNetLog& net_log) { |
| 50 if (synchronous_mode_) { | 50 if (synchronous_mode_) { |
| 51 callback = NULL; | 51 callback = NULL; |
| 52 out_req = NULL; | 52 out_req = NULL; |
| 53 } | 53 } |
| 54 return impl_->Resolve(info, addresses, callback, out_req, load_log); | 54 return impl_->Resolve(info, addresses, callback, out_req, net_log); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void MockHostResolverBase::CancelRequest(RequestHandle req) { | 57 void MockHostResolverBase::CancelRequest(RequestHandle req) { |
| 58 impl_->CancelRequest(req); | 58 impl_->CancelRequest(req); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void MockHostResolverBase::AddObserver(Observer* observer) { | 61 void MockHostResolverBase::AddObserver(Observer* observer) { |
| 62 impl_->AddObserver(observer); | 62 impl_->AddObserver(observer); |
| 63 } | 63 } |
| 64 | 64 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 CHECK_EQ(old_proc, current_proc_); | 227 CHECK_EQ(old_proc, current_proc_); |
| 228 } | 228 } |
| 229 | 229 |
| 230 void ScopedDefaultHostResolverProc::Init(HostResolverProc* proc) { | 230 void ScopedDefaultHostResolverProc::Init(HostResolverProc* proc) { |
| 231 current_proc_ = proc; | 231 current_proc_ = proc; |
| 232 previous_proc_ = HostResolverProc::SetDefault(current_proc_); | 232 previous_proc_ = HostResolverProc::SetDefault(current_proc_); |
| 233 current_proc_->SetLastProc(previous_proc_); | 233 current_proc_->SetLastProc(previous_proc_); |
| 234 } | 234 } |
| 235 | 235 |
| 236 } // namespace net | 236 } // namespace net |
| OLD | NEW |