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
3 // found in the LICENSE file.
5 #include "chrome/browser/net/dns_probe_test_util.h"
7 #include "chrome/browser/net/dns_probe_runner.h"
8 #include "net/dns/dns_config_service.h"
9 #include "net/dns/dns_protocol.h"
13 using net::IPAddressNumber
;
14 using net::MockDnsClientRule
;
15 using net::MockDnsClientRuleList
;
16 using net::ParseIPLiteralToNumber
;
18 namespace chrome_browser_net
{
20 scoped_ptr
<DnsClient
> CreateMockDnsClientForProbes(
21 MockDnsClientRule::Result result
) {
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(net::IPEndPoint(dns_ip
, kDnsPort
));
28 const uint16 kTypeA
= net::dns_protocol::kTypeA
;
29 MockDnsClientRuleList rules
;
30 rules
.push_back(MockDnsClientRule(DnsProbeRunner::kKnownGoodHostname
, kTypeA
,
33 return scoped_ptr
<DnsClient
>(new net::MockDnsClient(config
, rules
));
36 } // namespace chrome_browser_net