NaCl: Update revision in DEPS, r12770 -> r12773
[chromium-blink-merge.git] / chrome / browser / net / dns_probe_test_util.cc
blobfcc5b021b6e5cd2fff17c186827f6b6eee41d5dd
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::IPEndPoint;
15 using net::MockDnsClientRule;
16 using net::MockDnsClientRuleList;
17 using net::ParseIPLiteralToNumber;
19 namespace chrome_browser_net {
21 scoped_ptr<DnsClient> CreateMockDnsClientForProbes(
22 MockDnsClientRule::Result result) {
23 DnsConfig config;
24 IPAddressNumber dns_ip;
25 ParseIPLiteralToNumber("192.168.1.1", &dns_ip);
26 const uint16 kDnsPort = net::dns_protocol::kDefaultPort;
27 config.nameservers.push_back(IPEndPoint(dns_ip, kDnsPort));
29 const uint16 kTypeA = net::dns_protocol::kTypeA;
30 MockDnsClientRuleList rules;
31 rules.push_back(MockDnsClientRule(DnsProbeRunner::kKnownGoodHostname, kTypeA,
32 result, false));
34 return scoped_ptr<DnsClient>(new net::MockDnsClient(config, rules));
37 } // namespace chrome_browser_net