| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "chrome/browser/net/dns_probe_test_util.h" | 5 #include "chrome/browser/net/dns_probe_test_util.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "chrome/browser/net/dns_probe_runner.h" | 9 #include "chrome/browser/net/dns_probe_runner.h" |
| 10 #include "net/base/ip_address.h" |
| 10 #include "net/dns/dns_config_service.h" | 11 #include "net/dns/dns_config_service.h" |
| 11 #include "net/dns/dns_protocol.h" | 12 #include "net/dns/dns_protocol.h" |
| 12 | 13 |
| 13 using net::DnsClient; | 14 using net::DnsClient; |
| 14 using net::DnsConfig; | 15 using net::DnsConfig; |
| 15 using net::IPAddressNumber; | 16 using net::IPAddress; |
| 16 using net::MockDnsClientRule; | 17 using net::MockDnsClientRule; |
| 17 using net::MockDnsClientRuleList; | 18 using net::MockDnsClientRuleList; |
| 18 using net::ParseIPLiteralToNumber; | 19 using net::ParseIPLiteralToNumber; |
| 19 | 20 |
| 20 namespace chrome_browser_net { | 21 namespace chrome_browser_net { |
| 21 | 22 |
| 22 scoped_ptr<DnsClient> CreateMockDnsClientForProbes( | 23 scoped_ptr<DnsClient> CreateMockDnsClientForProbes( |
| 23 MockDnsClientRule::Result result) { | 24 MockDnsClientRule::Result result) { |
| 24 DnsConfig config; | 25 DnsConfig config; |
| 25 IPAddressNumber dns_ip; | 26 IPAddress dns_ip(192, 168, 1, 1); |
| 26 ParseIPLiteralToNumber("192.168.1.1", &dns_ip); | |
| 27 const uint16_t kDnsPort = net::dns_protocol::kDefaultPort; | 27 const uint16_t kDnsPort = net::dns_protocol::kDefaultPort; |
| 28 config.nameservers.push_back(net::IPEndPoint(dns_ip, kDnsPort)); | 28 config.nameservers.push_back(net::IPEndPoint(dns_ip, kDnsPort)); |
| 29 | 29 |
| 30 const uint16_t kTypeA = net::dns_protocol::kTypeA; | 30 const uint16_t kTypeA = net::dns_protocol::kTypeA; |
| 31 MockDnsClientRuleList rules; | 31 MockDnsClientRuleList rules; |
| 32 rules.push_back(MockDnsClientRule(DnsProbeRunner::kKnownGoodHostname, kTypeA, | 32 rules.push_back(MockDnsClientRule(DnsProbeRunner::kKnownGoodHostname, kTypeA, |
| 33 result, false)); | 33 result, false)); |
| 34 | 34 |
| 35 return scoped_ptr<DnsClient>(new net::MockDnsClient(config, rules)); | 35 return scoped_ptr<DnsClient>(new net::MockDnsClient(config, rules)); |
| 36 } | 36 } |
| 37 | 37 |
| 38 } // namespace chrome_browser_net | 38 } // namespace chrome_browser_net |
| OLD | NEW |