Chromium Code Reviews| Index: chrome/browser/net/dns_probe_test_util.cc |
| diff --git a/chrome/browser/net/dns_probe_test_util.cc b/chrome/browser/net/dns_probe_test_util.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..40d8133942b13e76a772da4d87cc3366be22216e |
| --- /dev/null |
| +++ b/chrome/browser/net/dns_probe_test_util.cc |
| @@ -0,0 +1,35 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/net/dns_probe_test_util.h" |
| + |
| +#include "net/dns/dns_config_service.h" |
| +#include "net/dns/dns_protocol.h" |
| + |
| +using net::DnsClient; |
| +using net::DnsConfig; |
| +using net::IPAddressNumber; |
| +using net::IPEndPoint; |
| +using net::MockDnsClientRule; |
| +using net::MockDnsClientRuleList; |
| +using net::ParseIPLiteralToNumber; |
| + |
| +namespace chrome_browser_net { |
| + |
| +scoped_ptr<DnsClient> CreateMockDnsClientForProbes( |
| + MockDnsClientRule::Result result) { |
| + DnsConfig config; |
| + IPAddressNumber dns_ip; |
| + ParseIPLiteralToNumber("192.168.1.1", &dns_ip); |
| + const uint16 kDnsPort = net::dns_protocol::kDefaultPort; |
| + config.nameservers.push_back(IPEndPoint(dns_ip, kDnsPort)); |
| + |
| + const uint16 kTypeA = net::dns_protocol::kTypeA; |
| + MockDnsClientRuleList rules; |
| + rules.push_back(MockDnsClientRule("google.com", kTypeA, result)); |
|
mmenke
2013/06/28 20:43:27
Think it would be a bit better to have the probe r
Deprecated (see juliatuttle)
2013/07/01 17:39:55
Done.
|
| + |
| + return CreateMockDnsClient(config, rules).Pass(); |
| +} |
| + |
| +} // namespace chrome_browser_net |