#include <memory>
#include <string>
#include <tuple>
#include "base/check.h"
#include "base/command_line.h"
#include "base/containers/contains.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/threading/thread_restrictions.h"
#include "base/time/time.h"
#include "chrome/browser/content_settings/cookie_settings_factory.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/subresource_filter/subresource_filter_browser_test_harness.h"
#include "chrome/browser/tpcd/experiment/tpcd_experiment_features.h"
#include "chrome/browser/tpcd/support/tpcd_support_service.h"
#include "chrome/browser/tpcd/support/tpcd_support_service_factory.h"
#include "chrome/browser/tpcd/support/validity_service.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/content_settings/core/browser/cookie_settings.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/content_settings/core/common/content_settings_pattern.h"
#include "components/content_settings/core/common/features.h"
#include "components/content_settings/core/common/pref_names.h"
#include "components/metrics/content/subprocess_metrics_provider.h"
#include "components/network_session_configurator/common/network_switches.h"
#include "components/prefs/pref_service.h"
#include "components/privacy_sandbox/tpcd_pref_names.h"
#include "components/privacy_sandbox/tpcd_utils.h"
#include "components/privacy_sandbox/tracking_protection_prefs.h"
#include "components/subresource_filter/core/common/test_ruleset_utils.h"
#include "components/tpcd/metadata/browser/parser.h"
#include "components/user_prefs/user_prefs.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_features.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "net/base/features.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/controllable_http_response.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_response.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/mojom/cookie_manager.mojom.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
namespace url {
class Origin;
}
namespace {
enum class AdsHeuristicCookieOverride { … };
const char kAdHeuristicOverrideHistogramName[] = …;
}
class AdHeuristicTPCDBrowserTestBase
: public subresource_filter::SubresourceFilterBrowserTest { … };
class AdHeuristicTPCDBrowserTestMetadataGrant
: public AdHeuristicTPCDBrowserTestBase { … };
IN_PROC_BROWSER_TEST_F(AdHeuristicTPCDBrowserTestMetadataGrant, CookieAllowed) { … }
class AdHeuristicTPCDBrowserTestSkipMetadata
: public AdHeuristicTPCDBrowserTestBase { … };
IN_PROC_BROWSER_TEST_F(AdHeuristicTPCDBrowserTestSkipMetadata, CookieBlocked) { … }
class AdHeuristicTPCDBrowserTestHeuristicsGrant
: public AdHeuristicTPCDBrowserTestBase { … };
IN_PROC_BROWSER_TEST_F(AdHeuristicTPCDBrowserTestHeuristicsGrant,
CookieAllowed) { … }
class AdHeuristicTPCDBrowserTestSkipHeuristicsGrant
: public AdHeuristicTPCDBrowserTestBase { … };
#if BUILDFLAG(IS_CHROMEOS)
#define MAYBE_CookieBlocked …
#else
#define MAYBE_CookieBlocked …
#endif
IN_PROC_BROWSER_TEST_F(AdHeuristicTPCDBrowserTestSkipHeuristicsGrant,
MAYBE_CookieBlocked) { … }
class AdHeuristicTPCDBrowserTestTrialGrant
: public AdHeuristicTPCDBrowserTestBase { … };
IN_PROC_BROWSER_TEST_F(AdHeuristicTPCDBrowserTestTrialGrant, CookieAllowed) { … }
class AdHeuristicTPCDBrowserTestSkipTrialGrant
: public AdHeuristicTPCDBrowserTestBase { … };
IN_PROC_BROWSER_TEST_F(AdHeuristicTPCDBrowserTestSkipTrialGrant,
CookieBlocked) { … }
class AdHeuristicTPCDBrowserTestTopLevelTrialGrant
: public AdHeuristicTPCDBrowserTestBase { … };
IN_PROC_BROWSER_TEST_F(AdHeuristicTPCDBrowserTestTopLevelTrialGrant,
CookieAllowed) { … }
class AdHeuristicTPCDBrowserTestSkipTopLevelTrialGrant
: public AdHeuristicTPCDBrowserTestBase { … };
IN_PROC_BROWSER_TEST_F(AdHeuristicTPCDBrowserTestSkipTopLevelTrialGrant,
CookieBlocked) { … }