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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
65 void MockHostResolverBase::RemoveObserver(Observer* observer) { | 65 void MockHostResolverBase::RemoveObserver(Observer* observer) { |
66 impl_->RemoveObserver(observer); | 66 impl_->RemoveObserver(observer); |
67 } | 67 } |
68 | 68 |
| 69 void MockHostResolverBase::Flush() { |
| 70 impl_->Flush(); |
| 71 } |
| 72 |
69 void MockHostResolverBase::Reset(HostResolverProc* interceptor) { | 73 void MockHostResolverBase::Reset(HostResolverProc* interceptor) { |
70 synchronous_mode_ = false; | 74 synchronous_mode_ = false; |
71 | 75 |
72 // At the root of the chain, map everything to localhost. | 76 // At the root of the chain, map everything to localhost. |
73 scoped_refptr<RuleBasedHostResolverProc> catchall = | 77 scoped_refptr<RuleBasedHostResolverProc> catchall = |
74 new RuleBasedHostResolverProc(NULL); | 78 new RuleBasedHostResolverProc(NULL); |
75 catchall->AddRule("*", "127.0.0.1"); | 79 catchall->AddRule("*", "127.0.0.1"); |
76 | 80 |
77 // Next add a rules-based layer the use controls. | 81 // Next add a rules-based layer the use controls. |
78 rules_ = new RuleBasedHostResolverProc(catchall); | 82 rules_ = new RuleBasedHostResolverProc(catchall); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 CHECK_EQ(old_proc, current_proc_); | 231 CHECK_EQ(old_proc, current_proc_); |
228 } | 232 } |
229 | 233 |
230 void ScopedDefaultHostResolverProc::Init(HostResolverProc* proc) { | 234 void ScopedDefaultHostResolverProc::Init(HostResolverProc* proc) { |
231 current_proc_ = proc; | 235 current_proc_ = proc; |
232 previous_proc_ = HostResolverProc::SetDefault(current_proc_); | 236 previous_proc_ = HostResolverProc::SetDefault(current_proc_); |
233 current_proc_->SetLastProc(previous_proc_); | 237 current_proc_->SetLastProc(previous_proc_); |
234 } | 238 } |
235 | 239 |
236 } // namespace net | 240 } // namespace net |
OLD | NEW |