OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/net/dns_probe_test_util.h" |
| 6 |
| 7 #include "net/dns/dns_config_service.h" |
| 8 #include "net/dns/dns_protocol.h" |
| 9 |
| 10 using net::DnsClient; |
| 11 using net::DnsConfig; |
| 12 using net::IPAddressNumber; |
| 13 using net::IPEndPoint; |
| 14 using net::MockDnsClientRule; |
| 15 using net::MockDnsClientRuleList; |
| 16 using net::ParseIPLiteralToNumber; |
| 17 |
| 18 namespace chrome_browser_net { |
| 19 |
| 20 scoped_ptr<DnsClient> CreateMockDnsClientForProbes( |
| 21 MockDnsClientRule::Result result) { |
| 22 DnsConfig config; |
| 23 IPAddressNumber dns_ip; |
| 24 ParseIPLiteralToNumber("192.168.1.1", &dns_ip); |
| 25 const uint16 kDnsPort = net::dns_protocol::kDefaultPort; |
| 26 config.nameservers.push_back(IPEndPoint(dns_ip, kDnsPort)); |
| 27 |
| 28 const uint16 kTypeA = net::dns_protocol::kTypeA; |
| 29 MockDnsClientRuleList rules; |
| 30 rules.push_back(MockDnsClientRule("google.com", kTypeA, result)); |
| 31 |
| 32 return CreateMockDnsClient(config, rules).Pass(); |
| 33 } |
| 34 |
| 35 } // namespace chrome_browser_net |
OLD | NEW |