1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef NET_DNS_HOST_RESOLVER_INTERNAL_RESULT_TEST_UTIL_H_
#define NET_DNS_HOST_RESOLVER_INTERNAL_RESULT_TEST_UTIL_H_
#include <map>
#include <ostream>
#include <string>
#include <vector>
#include "base/time/time.h"
#include "net/base/connection_endpoint_metadata.h"
#include "net/base/host_port_pair.h"
#include "net/base/ip_endpoint.h"
#include "net/dns/host_resolver_internal_result.h"
#include "net/dns/https_record_rdata.h"
#include "net/dns/public/dns_query_type.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
namespace net {
testing::Matcher<const HostResolverInternalResult&>
ExpectHostResolverInternalDataResult(
std::string expected_domain_name,
DnsQueryType expected_query_type,
HostResolverInternalResult::Source expected_source,
testing::Matcher<absl::optional<base::TimeTicks>> expiration_matcher,
testing::Matcher<absl::optional<base::Time>> timed_expiration_matcher,
testing::Matcher<std::vector<IPEndPoint>> endpoints_matcher =
testing::IsEmpty(),
testing::Matcher<std::vector<std::string>> strings_matcher =
testing::IsEmpty(),
testing::Matcher<std::vector<HostPortPair>> hosts_matcher =
testing::IsEmpty());
testing::Matcher<const HostResolverInternalResult&>
ExpectHostResolverInternalMetadataResult(
std::string expected_domain_name,
DnsQueryType expected_query_type,
HostResolverInternalResult::Source expected_source,
testing::Matcher<absl::optional<base::TimeTicks>> expiration_matcher,
testing::Matcher<absl::optional<base::Time>> timed_expiration_matcher,
testing::Matcher<
std::multimap<HttpsRecordPriority, ConnectionEndpointMetadata>>
metadatas_matcher = testing::IsEmpty());
testing::Matcher<const HostResolverInternalResult&>
ExpectHostResolverInternalErrorResult(
std::string expected_domain_name,
DnsQueryType expected_query_type,
HostResolverInternalResult::Source expected_source,
testing::Matcher<absl::optional<base::TimeTicks>> expiration_matcher,
testing::Matcher<absl::optional<base::Time>> timed_expiration_matcher,
int expected_error);
testing::Matcher<const HostResolverInternalResult&>
ExpectHostResolverInternalAliasResult(
std::string expected_domain_name,
DnsQueryType expected_query_type,
HostResolverInternalResult::Source expected_source,
testing::Matcher<absl::optional<base::TimeTicks>> expiration_matcher,
testing::Matcher<absl::optional<base::Time>> timed_expiration_matcher,
std::string expected_alias_target);
std::ostream& operator<<(std::ostream& os,
const HostResolverInternalResult& result);
} // namespace net
#endif // NET_DNS_HOST_RESOLVER_INTERNAL_RESULT_TEST_UTIL_H_
|