#include "net/cookies/test_cookie_access_delegate.h"
#include <set>
#include <utility>
#include <vector>
#include "base/containers/contains.h"
#include "base/containers/flat_map.h"
#include "base/containers/flat_set.h"
#include "base/functional/callback.h"
#include "base/ranges/algorithm.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/thread_pool.h"
#include "base/types/optional_util.h"
#include "net/base/schemeful_site.h"
#include "net/cookies/cookie_constants.h"
#include "net/cookies/cookie_util.h"
#include "net/first_party_sets/first_party_set_entry.h"
#include "net/first_party_sets/first_party_set_metadata.h"
#include "net/first_party_sets/first_party_sets_cache_filter.h"
namespace net {
TestCookieAccessDelegate::TestCookieAccessDelegate() = default;
TestCookieAccessDelegate::~TestCookieAccessDelegate() = default;
CookieAccessSemantics TestCookieAccessDelegate::GetAccessSemantics(
const CanonicalCookie& cookie) const { … }
bool TestCookieAccessDelegate::ShouldIgnoreSameSiteRestrictions(
const GURL& url,
const SiteForCookies& site_for_cookies) const { … }
bool TestCookieAccessDelegate::ShouldTreatUrlAsTrustworthy(
const GURL& url) const { … }
std::optional<
std::pair<FirstPartySetMetadata, FirstPartySetsCacheFilter::MatchInfo>>
TestCookieAccessDelegate::ComputeFirstPartySetMetadataMaybeAsync(
const SchemefulSite& site,
const SchemefulSite* top_frame_site,
base::OnceCallback<void(FirstPartySetMetadata,
FirstPartySetsCacheFilter::MatchInfo)> callback)
const { … }
std::optional<FirstPartySetEntry>
TestCookieAccessDelegate::FindFirstPartySetEntry(
const SchemefulSite& site) const { … }
std::optional<base::flat_map<SchemefulSite, FirstPartySetEntry>>
TestCookieAccessDelegate::FindFirstPartySetEntries(
const base::flat_set<SchemefulSite>& sites,
base::OnceCallback<void(base::flat_map<SchemefulSite, FirstPartySetEntry>)>
callback) const { … }
template <class T>
std::optional<T> TestCookieAccessDelegate::RunMaybeAsync(
T result,
base::OnceCallback<void(T)> callback) const { … }
void TestCookieAccessDelegate::SetExpectationForCookieDomain(
const std::string& cookie_domain,
CookieAccessSemantics access_semantics) { … }
void TestCookieAccessDelegate::SetIgnoreSameSiteRestrictionsScheme(
const std::string& site_for_cookies_scheme,
bool require_secure_origin) { … }
std::string TestCookieAccessDelegate::GetKeyForDomainValue(
const std::string& domain) const { … }
void TestCookieAccessDelegate::SetFirstPartySets(
const base::flat_map<SchemefulSite, FirstPartySetEntry>& sets) { … }
}