Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_BASE_MOCK_HOST_RESOLVER_H_ | 5 #ifndef NET_BASE_MOCK_HOST_RESOLVER_H_ |
| 6 #define NET_BASE_MOCK_HOST_RESOLVER_H_ | 6 #define NET_BASE_MOCK_HOST_RESOLVER_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 | 9 |
| 10 #include "base/waitable_event.h" | 10 #include "base/waitable_event.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 95 class RuleBasedHostResolverProc : public HostResolverProc { | 95 class RuleBasedHostResolverProc : public HostResolverProc { |
| 96 public: | 96 public: |
| 97 explicit RuleBasedHostResolverProc(HostResolverProc* previous); | 97 explicit RuleBasedHostResolverProc(HostResolverProc* previous); |
| 98 ~RuleBasedHostResolverProc(); | 98 ~RuleBasedHostResolverProc(); |
| 99 | 99 |
| 100 // Any hostname matching the given pattern will be replaced with the given | 100 // Any hostname matching the given pattern will be replaced with the given |
| 101 // replacement value. Usually, replacement should be an IP address literal. | 101 // replacement value. Usually, replacement should be an IP address literal. |
| 102 void AddRule(const std::string& host_pattern, | 102 void AddRule(const std::string& host_pattern, |
| 103 const std::string& replacement); | 103 const std::string& replacement); |
| 104 | 104 |
| 105 // Same as AddRule(), but further restricts to |address_family|. | |
| 106 void AddRuleForFamily(const std::string& host_pattern, | |
|
wtc
2009/10/22 21:53:54
Nit: rename this AddRuleForAddressFamily.
Are you
| |
| 107 AddressFamily address_family, | |
| 108 const std::string& replacement); | |
| 109 | |
| 105 // Same as AddRule(), but the replacement is expected to be an IPV6 literal. | 110 // Same as AddRule(), but the replacement is expected to be an IPV6 literal. |
| 106 // You should use this in place of AddRule(), since the system's host resolver | 111 // You should use this in place of AddRule(), since the system's host resolver |
| 107 // may not support IPv6 literals on all systems. Whereas this variant | 112 // may not support IPv6 literals on all systems. Whereas this variant |
| 108 // constructs the socket address directly so it will always work. | 113 // constructs the socket address directly so it will always work. |
| 109 void AddIPv6Rule(const std::string& host_pattern, | 114 void AddIPv6Rule(const std::string& host_pattern, |
| 110 const std::string& ipv6_literal); | 115 const std::string& ipv6_literal); |
| 111 | 116 |
| 112 void AddRuleWithLatency(const std::string& host_pattern, | 117 void AddRuleWithLatency(const std::string& host_pattern, |
| 113 const std::string& replacement, | 118 const std::string& replacement, |
| 114 int latency_ms); | 119 int latency_ms); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 void Init(HostResolverProc* proc); | 175 void Init(HostResolverProc* proc); |
| 171 | 176 |
| 172 private: | 177 private: |
| 173 scoped_refptr<HostResolverProc> current_proc_; | 178 scoped_refptr<HostResolverProc> current_proc_; |
| 174 scoped_refptr<HostResolverProc> previous_proc_; | 179 scoped_refptr<HostResolverProc> previous_proc_; |
| 175 }; | 180 }; |
| 176 | 181 |
| 177 } // namespace net | 182 } // namespace net |
| 178 | 183 |
| 179 #endif // NET_BASE_MOCK_HOST_RESOLVER_H_ | 184 #endif // NET_BASE_MOCK_HOST_RESOLVER_H_ |
| OLD | NEW |