#include "components/content_settings/browser/ui/cookie_controls_controller.h"
#include <string>
#include "base/test/metrics/histogram_tester.h"
#include "chrome/browser/content_settings/cookie_settings_factory.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/content_settings/page_specific_content_settings_delegate.h"
#include "chrome/browser/fingerprinting_protection/chrome_fingerprinting_protection_web_contents_helper_factory.h"
#include "chrome/browser/privacy_sandbox/tracking_protection_settings_factory.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "components/content_settings/browser/page_specific_content_settings.h"
#include "components/content_settings/browser/ui/cookie_controls_view.h"
#include "components/content_settings/core/browser/cookie_settings.h"
#include "components/content_settings/core/common/content_settings.h"
#include "components/content_settings/core/common/cookie_blocking_3pcd_status.h"
#include "components/content_settings/core/common/cookie_controls_enforcement.h"
#include "components/content_settings/core/common/features.h"
#include "components/content_settings/core/common/pref_names.h"
#include "components/content_settings/core/common/third_party_site_data_access_type.h"
#include "components/content_settings/core/common/tracking_protection_feature.h"
#include "components/fingerprinting_protection_filter/browser/fingerprinting_protection_web_contents_helper.h"
#include "components/fingerprinting_protection_filter/common/fingerprinting_protection_filter_features.h"
#include "components/privacy_sandbox/privacy_sandbox_features.h"
#include "components/privacy_sandbox/tracking_protection_settings.h"
#include "components/site_engagement/content/site_engagement_service.h"
#include "components/strings/grit/privacy_sandbox_strings.h"
#include "components/ukm/test_ukm_recorder.h"
#include "content/public/test/navigation_simulator.h"
#include "content/public/test/web_contents_tester.h"
#include "net/http/http_response_headers.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/l10n/l10n_util.h"
namespace {
StorageType;
BlockingStatus;
FeatureType;
TrackingProtectionFeature;
constexpr char kCookieControlsActivatedSaaHistogram[] = …;
constexpr char kCookieControlsActivatedRefreshCountHistogram[] = …;
constexpr char kCookieControlsActivatedSiteEngagementHistogram[] = …;
constexpr char kCookieControlsActivatedSiteDataAccessHistogram[] = …;
class MockCookieControlsObserver
: public content_settings::CookieControlsObserver { … };
blink::StorageKey CreateUnpartitionedStorageKey(const GURL& url) { … }
}
std::ostream& operator<<(std::ostream& os,
const CookieControlsEnforcement& enforcement) { … }
class CookieControlsUserBypassTest : public ChromeRenderViewHostTestHarness { … };
TEST_F(CookieControlsUserBypassTest, CookieBlockingChanged) { … }
TEST_F(CookieControlsUserBypassTest, SiteCounts) { … }
TEST_F(CookieControlsUserBypassTest, NewTabPage) { … }
TEST_F(CookieControlsUserBypassTest, PreferenceDisabled) { … }
TEST_F(CookieControlsUserBypassTest, AllCookiesBlocked) { … }
TEST_F(CookieControlsUserBypassTest, DisableForSite) { … }
TEST_F(CookieControlsUserBypassTest, Incognito) { … }
TEST_F(CookieControlsUserBypassTest, ThirdPartyCookiesException) { … }
TEST_F(CookieControlsUserBypassTest, FrequentPageReloads) { … }
TEST_F(CookieControlsUserBypassTest,
HittingPageReloadThresholdTriggersOnReloadThresholdExceeded) { … }
TEST_F(CookieControlsUserBypassTest, FrequentPageReloadsMetrics) { … }
TEST_F(CookieControlsUserBypassTest, InfrequentPageReloads) { … }
TEST_F(CookieControlsUserBypassTest, HighSiteEngagement) { … }
TEST_F(CookieControlsUserBypassTest, StorageAccessApiHighSiteEngagement) { … }
TEST_F(CookieControlsUserBypassTest, CustomExceptionsNoWildcardMatchingDomain) { … }
TEST_F(CookieControlsUserBypassTest, CustomExceptionsWildcardMatchingDomain) { … }
TEST_F(CookieControlsUserBypassTest,
CustomExceptionsWildcardLessSpecificDomain) { … }
TEST_F(CookieControlsUserBypassTest, CustomExceptionsDotComWildcard) { … }
TEST_F(CookieControlsUserBypassTest, FinishedPageReloadWithChangedSettings) { … }
TEST_F(CookieControlsUserBypassTest,
DoesNotHighlightLabelWhenSettingNotChangedInContext) { … }
TEST_F(CookieControlsUserBypassTest, IconHighlightedAfterExceptionExpires) { … }
TEST_F(CookieControlsUserBypassTest, StatefulBounce) { … }
TEST_F(CookieControlsUserBypassTest, SubresourceBlocked) { … }
TEST_F(CookieControlsUserBypassTest, SubresourceBlockedInIncognito) { … }
TEST_F(CookieControlsUserBypassTest, SandboxedTopLevelFrame) { … }
TEST_F(CookieControlsUserBypassTest,
FrequentPageReloadsWithoutUpdateBeingCalled) { … }
class CookieControlsUserBypassTrackingProtectionUiTest
: public CookieControlsUserBypassTest,
public testing::WithParamInterface<testing::tuple<bool, bool>> { … };
TEST_P(CookieControlsUserBypassTrackingProtectionUiTest,
AddsActFeaturesToVectorBasedOnFeatureAndExceptionStatus) { … }
INSTANTIATE_TEST_SUITE_P(…);