OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef NET_DNS_MOCK_HOST_RESOLVER_H_ | 5 #ifndef NET_DNS_MOCK_HOST_RESOLVER_H_ |
6 #define NET_DNS_MOCK_HOST_RESOLVER_H_ | 6 #define NET_DNS_MOCK_HOST_RESOLVER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // By default, MockHostResolvers include a single rule that maps all hosts to | 50 // By default, MockHostResolvers include a single rule that maps all hosts to |
51 // 127.0.0.1. | 51 // 127.0.0.1. |
52 | 52 |
53 // Base class shared by MockHostResolver and MockCachingHostResolver. | 53 // Base class shared by MockHostResolver and MockCachingHostResolver. |
54 class MockHostResolverBase : public HostResolver, | 54 class MockHostResolverBase : public HostResolver, |
55 public base::SupportsWeakPtr<MockHostResolverBase>, | 55 public base::SupportsWeakPtr<MockHostResolverBase>, |
56 public base::NonThreadSafe { | 56 public base::NonThreadSafe { |
57 public: | 57 public: |
58 virtual ~MockHostResolverBase(); | 58 virtual ~MockHostResolverBase(); |
59 | 59 |
60 RuleBasedHostResolverProc* rules() { return rules_; } | 60 RuleBasedHostResolverProc* rules() { return rules_.get(); } |
61 void set_rules(RuleBasedHostResolverProc* rules) { rules_ = rules; } | 61 void set_rules(RuleBasedHostResolverProc* rules) { rules_ = rules; } |
62 | 62 |
63 // Controls whether resolutions complete synchronously or asynchronously. | 63 // Controls whether resolutions complete synchronously or asynchronously. |
64 void set_synchronous_mode(bool is_synchronous) { | 64 void set_synchronous_mode(bool is_synchronous) { |
65 synchronous_mode_ = is_synchronous; | 65 synchronous_mode_ = is_synchronous; |
66 } | 66 } |
67 | 67 |
68 // Asynchronous requests are automatically resolved by default. | 68 // Asynchronous requests are automatically resolved by default. |
69 // If set_ondemand_mode() is set then Resolve() returns IO_PENDING and | 69 // If set_ondemand_mode() is set then Resolve() returns IO_PENDING and |
70 // ResolveAllPending() must be explicitly invoked to resolve all requests | 70 // ResolveAllPending() must be explicitly invoked to resolve all requests |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 void Init(HostResolverProc* proc); | 245 void Init(HostResolverProc* proc); |
246 | 246 |
247 private: | 247 private: |
248 scoped_refptr<HostResolverProc> current_proc_; | 248 scoped_refptr<HostResolverProc> current_proc_; |
249 scoped_refptr<HostResolverProc> previous_proc_; | 249 scoped_refptr<HostResolverProc> previous_proc_; |
250 }; | 250 }; |
251 | 251 |
252 } // namespace net | 252 } // namespace net |
253 | 253 |
254 #endif // NET_DNS_MOCK_HOST_RESOLVER_H_ | 254 #endif // NET_DNS_MOCK_HOST_RESOLVER_H_ |
OLD | NEW |