| 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" |
| 11 #include "net/dns/dns_config_service.h" |
| 10 #include "net/dns/dns_protocol.h" | 12 #include "net/dns/dns_protocol.h" |
| 11 | 13 |
| 12 namespace net { | 14 namespace net { |
| 13 | 15 |
| 14 //----------------------------------------------------------------------------- | 16 //----------------------------------------------------------------------------- |
| 15 // Query/response set for www.google.com, ID is fixed to 0. | 17 // Query/response set for www.google.com, ID is fixed to 0. |
| 16 static const char kT0HostName[] = "www.google.com"; | 18 static const char kT0HostName[] = "www.google.com"; |
| 17 static const uint16 kT0Qtype = dns_protocol::kTypeA; | 19 static const uint16 kT0Qtype = dns_protocol::kTypeA; |
| 18 static const char kT0DnsName[] = { | 20 static const char kT0DnsName[] = { |
| 19 0x03, 'w', 'w', 'w', | 21 0x03, 'w', 'w', 'w', |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 0x47, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, | 151 0x47, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, |
| 150 0x15, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb1 | 152 0x15, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb1 |
| 151 }; | 153 }; |
| 152 static const char* const kT3IpAddresses[] = { | 154 static const char* const kT3IpAddresses[] = { |
| 153 "74.125.226.178", "74.125.226.179", "74.125.226.180", | 155 "74.125.226.178", "74.125.226.179", "74.125.226.180", |
| 154 "74.125.226.176", "74.125.226.177" | 156 "74.125.226.176", "74.125.226.177" |
| 155 }; | 157 }; |
| 156 static const char kT3CanonName[] = "www.l.google.com"; | 158 static const char kT3CanonName[] = "www.l.google.com"; |
| 157 static const int kT3TTL = 0x00000015; | 159 static const int kT3TTL = 0x00000015; |
| 158 | 160 |
| 161 class DnsClient; |
| 162 // Creates mock DnsClient for testing HostResolverImpl. |
| 163 scoped_ptr<DnsClient> CreateMockDnsClient(const DnsConfig& config); |
| 164 |
| 165 class MockDnsConfigService : public DnsConfigService { |
| 166 public: |
| 167 virtual ~MockDnsConfigService() {} |
| 168 |
| 169 // Expose the protected methods for tests. |
| 170 void ChangeConfig(const DnsConfig& config) { |
| 171 DnsConfigService::OnConfigRead(config); |
| 172 } |
| 173 |
| 174 void ChangeHosts(const DnsHosts& hosts) { |
| 175 DnsConfigService::OnHostsRead(hosts); |
| 176 } |
| 177 }; |
| 178 |
| 179 |
| 159 } // namespace net | 180 } // namespace net |
| 160 | 181 |
| 161 #endif // NET_DNS_DNS_TEST_UTIL_H_ | 182 #endif // NET_DNS_DNS_TEST_UTIL_H_ |
| OLD | NEW |