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