Popular sites on the NTP: re-download popular suggestions once per Chrome run
[chromium-blink-merge.git] / chrome / browser / net / dns_probe_test_util.cc
blob4f9c49d70fc56e9f3efd3b75a9942cc1a7af1d65
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"
11 using net::DnsClient;
12 using net::DnsConfig;
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) {
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(net::IPEndPoint(dns_ip, kDnsPort));
28 const uint16 kTypeA = net::dns_protocol::kTypeA;
29 MockDnsClientRuleList rules;
30 rules.push_back(MockDnsClientRule(DnsProbeRunner::kKnownGoodHostname, kTypeA,
31 result, false));
33 return scoped_ptr<DnsClient>(new net::MockDnsClient(config, rules));
36 } // namespace chrome_browser_net