| OLD | NEW |
| 1 // Copyright (c) 2011 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 <deque> | 9 #include "base/basictypes.h" |
| 10 #include <vector> | |
| 11 | |
| 12 #include "base/logging.h" | |
| 13 #include "net/base/dns_util.h" | |
| 14 #include "net/base/host_resolver.h" | |
| 15 #include "net/base/ip_endpoint.h" | |
| 16 #include "net/base/net_util.h" | |
| 17 #include "net/dns/dns_protocol.h" | 10 #include "net/dns/dns_protocol.h" |
| 18 | 11 |
| 19 namespace net { | 12 namespace net { |
| 20 | 13 |
| 21 // A utility function for tests that given an array of IP literals, | |
| 22 // converts it to an IPAddressList. | |
| 23 bool ConvertStringsToIPAddressList( | |
| 24 const char* const ip_strings[], size_t size, IPAddressList* address_list); | |
| 25 | |
| 26 // A utility function for tests that creates an IPEndPoint whose IP is | |
| 27 // |ip_string| and whose port is |port| and stores it in |endpoint|. | |
| 28 bool CreateDnsAddress(const char* ip_string, uint16 port, IPEndPoint* endpoint); | |
| 29 | |
| 30 static const char kDnsIp[] = "192.168.1.1"; | |
| 31 static const uint16 kDnsPort = 53; | 14 static const uint16 kDnsPort = 53; |
| 32 | 15 |
| 33 //----------------------------------------------------------------------------- | 16 //----------------------------------------------------------------------------- |
| 34 // 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. |
| 35 static const char kT0HostName[] = "www.google.com"; | 18 static const char kT0HostName[] = "www.google.com"; |
| 36 static const uint16 kT0Qtype = dns_protocol::kTypeA; | 19 static const uint16 kT0Qtype = dns_protocol::kTypeA; |
| 37 static const char kT0DnsName[] = { | 20 static const char kT0DnsName[] = { |
| 38 0x03, 'w', 'w', 'w', | 21 0x03, 'w', 'w', 'w', |
| 39 0x06, 'g', 'o', 'o', 'g', 'l', 'e', | 22 0x06, 'g', 'o', 'o', 'g', 'l', 'e', |
| 40 0x03, 'c', 'o', 'm', | 23 0x03, 'c', 'o', 'm', |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 0x15, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb1 | 173 0x15, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb1 |
| 191 }; | 174 }; |
| 192 static const char* const kT3IpAddresses[] = { | 175 static const char* const kT3IpAddresses[] = { |
| 193 "74.125.226.178", "74.125.226.179", "74.125.226.180", | 176 "74.125.226.178", "74.125.226.179", "74.125.226.180", |
| 194 "74.125.226.176", "74.125.226.177" | 177 "74.125.226.176", "74.125.226.177" |
| 195 }; | 178 }; |
| 196 | 179 |
| 197 } // namespace net | 180 } // namespace net |
| 198 | 181 |
| 199 #endif // NET_DNS_DNS_TEST_UTIL_H_ | 182 #endif // NET_DNS_DNS_TEST_UTIL_H_ |
| OLD | NEW |