blob: 337955e31a5b17437b12c231ed1837525130cacb [file] [log] [blame]
Eric Orth4e55b362019-05-07 22:00:031// Copyright 2016 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#ifndef NET_DNS_FUZZED_HOST_RESOLVER_UTIL_H_
6#define NET_DNS_FUZZED_HOST_RESOLVER_UTIL_H_
7
8#include <memory>
9
10#include "net/dns/host_resolver.h"
11
Eric Orth4e55b362019-05-07 22:00:0312class FuzzedDataProvider;
Eric Orth4e55b362019-05-07 22:00:0313
14namespace net {
15
16class ContextHostResolver;
17class NetLog;
18
19// Creates a ContextHostResolver that uses a fuzzer to determine what results to
20// return. It inherits from ContextHostResolver, unlike MockHostResolver, so
21// more closely matches real behavior.
22//
dalykc27699a2019-07-29 20:53:2923// By default uses a mocked out system resolver, though can be configured to use
24// the built-in async resolver (Built in DNS stub resolver) with a fuzzed set
25// of UDP/TCP sockets by setting ManagerOptions.insecure_dns_client_enabled to
26// true or calling SetInsecureDnsClientEnabled on the underlying
27// HostResolverManager.
Eric Orth4e55b362019-05-07 22:00:0328//
29// To make behavior most deterministic, does not use the WorkerPool to run its
30// simulated platform host resolver calls, instead runs them on the thread it is
31// created on.
32//
33// Note that it does not attempt to sort the resulting AddressList when using
34// the mock system resolver path.
35//
36// The async DNS client can make system calls in AddressSorterPosix, but other
37// methods that make system calls are stubbed out.
38std::unique_ptr<ContextHostResolver> CreateFuzzedContextHostResolver(
39 const HostResolver::ManagerOptions& options,
40 NetLog* net_log,
Max Morozcfbe47cc2019-06-24 17:45:0241 FuzzedDataProvider* data_provider,
Eric Orth4e55b362019-05-07 22:00:0342 bool enable_caching);
43
44} // namespace net
45
46#endif // NET_DNS_FUZZED_HOST_RESOLVER_UTIL_H_