OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_DNS_TEST_UTIL_H_ | 5 #ifndef NET_DNS_DNS_TEST_UTIL_H_ |
6 #define NET_DNS_DNS_TEST_UTIL_H_ | 6 #define NET_DNS_DNS_TEST_UTIL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 static const int kT3TTL = 0x00000015; | 165 static const int kT3TTL = 0x00000015; |
166 // +2 for the CNAME records. | 166 // +2 for the CNAME records. |
167 static const unsigned kT3RecordCount = arraysize(kT3IpAddresses) + 2; | 167 static const unsigned kT3RecordCount = arraysize(kT3IpAddresses) + 2; |
168 | 168 |
169 class DnsClient; | 169 class DnsClient; |
170 // Creates mock DnsClient for testing HostResolverImpl. | 170 // Creates mock DnsClient for testing HostResolverImpl. |
171 scoped_ptr<DnsClient> CreateMockDnsClient(const DnsConfig& config); | 171 scoped_ptr<DnsClient> CreateMockDnsClient(const DnsConfig& config); |
172 | 172 |
173 class MockDnsConfigService : public DnsConfigService { | 173 class MockDnsConfigService : public DnsConfigService { |
174 public: | 174 public: |
175 virtual ~MockDnsConfigService() {} | 175 virtual ~MockDnsConfigService(); |
176 | 176 |
177 virtual void Watch(const CallbackType& callback) OVERRIDE; | 177 // NetworkChangeNotifier::DNSObserver: |
| 178 virtual void OnDNSChanged(unsigned detail) OVERRIDE; |
178 | 179 |
179 // Expose the protected methods for tests. | 180 // Expose the protected methods for tests. |
180 void ChangeConfig(const DnsConfig& config) { | 181 void ChangeConfig(const DnsConfig& config); |
181 DnsConfigService::OnConfigRead(config); | 182 void ChangeHosts(const DnsHosts& hosts); |
182 } | |
183 | |
184 void ChangeHosts(const DnsHosts& hosts) { | |
185 DnsConfigService::OnHostsRead(hosts); | |
186 } | |
187 }; | 183 }; |
188 | 184 |
189 | 185 |
190 } // namespace net | 186 } // namespace net |
191 | 187 |
192 #endif // NET_DNS_DNS_TEST_UTIL_H_ | 188 #endif // NET_DNS_DNS_TEST_UTIL_H_ |
OLD | NEW |