#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/path_service.h"
#include "base/strings/escape.h"
#include "base/strings/strcat.h"
#include "base/strings/stringprintf.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/content_settings/cookie_settings_factory.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/net/storage_test_utils.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/tab_contents/navigation_metrics_recorder.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.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/features.h"
#include "components/content_settings/core/common/pref_names.h"
#include "components/prefs/pref_service.h"
#include "components/privacy_sandbox/tracking_protection_prefs.h"
#include "content/public/common/content_paths.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_navigation_observer.h"
#include "net/base/features.h"
#include "net/cookies/canonical_cookie_test_helpers.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/features_generated.h"
#include "ui/base/window_open_disposition.h"
BrowserThread;
namespace {
const char* kHostA = …;
const char* kHostB = …;
const char* kHostC = …;
const char* kHostD = …;
const char* kEchoCookiesWithCorsPath = …;
bool ThirdPartyPartitionedStorageAllowedByDefault() { … }
bool ThirdPartyPartitionedStorageAllowedByStorageAccessAPI() { … }
class CookiePolicyBrowserTest : public InProcessBrowserTest { … };
IN_PROC_BROWSER_TEST_F(CookiePolicyBrowserTest, AllowFirstPartyCookies) { … }
IN_PROC_BROWSER_TEST_F(CookiePolicyBrowserTest,
AllowFirstPartyCookiesRedirect) { … }
IN_PROC_BROWSER_TEST_F(CookiePolicyBrowserTest,
ThirdPartyCookiesIFrameAllowSetting) { … }
IN_PROC_BROWSER_TEST_F(CookiePolicyBrowserTest,
ThirdPartyCookiesIFrameBlockSetting) { … }
IN_PROC_BROWSER_TEST_F(CookiePolicyBrowserTest,
ThirdPartyCookiesIFrameAllowReading) { … }
IN_PROC_BROWSER_TEST_F(CookiePolicyBrowserTest,
ThirdPartyCookiesIFrameBlockReading) { … }
IN_PROC_BROWSER_TEST_F(CookiePolicyBrowserTest,
ThirdPartyCookiesIFrameExceptions) { … }
IN_PROC_BROWSER_TEST_F(CookiePolicyBrowserTest,
ThirdPartyCookiesIFrameThirdPartyExceptions) { … }
IN_PROC_BROWSER_TEST_F(CookiePolicyBrowserTest, MultiTabTest) { … }
IN_PROC_BROWSER_TEST_F(CookiePolicyBrowserTest, MultiTabNestedTest) { … }
enum class ContextType { … };
class CookiePolicyStorageBrowserTest
: public CookiePolicyBrowserTest,
public testing::WithParamInterface<ContextType> { … };
IN_PROC_BROWSER_TEST_P(CookiePolicyStorageBrowserTest,
ThirdPartyIFrameStorage) { … }
IN_PROC_BROWSER_TEST_P(CookiePolicyStorageBrowserTest,
NestedThirdPartyIFrameStorage) { … }
class ThirdPartyPartitionedStorageAccessibilityTest
: public CookiePolicyBrowserTest,
public testing::WithParamInterface<std::tuple<ContextType, bool>> { … };
IN_PROC_BROWSER_TEST_P(ThirdPartyPartitionedStorageAccessibilityTest, Basic) { … }
IN_PROC_BROWSER_TEST_P(ThirdPartyPartitionedStorageAccessibilityTest,
UserSetting) { … }
ThirdPartyPartitionedStorageAccessibilitySharedWorkerTest;
IN_PROC_BROWSER_TEST_P(
ThirdPartyPartitionedStorageAccessibilitySharedWorkerTest,
Basic) { … }
IN_PROC_BROWSER_TEST_P(
ThirdPartyPartitionedStorageAccessibilitySharedWorkerTest,
UserSetting) { … }
class ThirdPartyPartitionedStorageAccessibilityCanBeDisabledTest
: public ThirdPartyPartitionedStorageAccessibilityTest { … };
IN_PROC_BROWSER_TEST_P(
ThirdPartyPartitionedStorageAccessibilityCanBeDisabledTest,
Basic) { … }
IN_PROC_BROWSER_TEST_P(CookiePolicyStorageBrowserTest,
NestedFirstPartyIFrameStorage) { … }
std::unique_ptr<net::test_server::HttpResponse>
HandleEchoCookiesWithCorsRequest(const net::test_server::HttpRequest& request) { … }
class ThirdPartyCookiePhaseoutPolicyStorageBrowserTest
: public CookiePolicyBrowserTest { … };
IN_PROC_BROWSER_TEST_F(ThirdPartyCookiePhaseoutPolicyStorageBrowserTest,
ForceThirdPartyCookieBlocking) { … }
IN_PROC_BROWSER_TEST_F(ThirdPartyCookiePhaseoutPolicyStorageBrowserTest,
SandboxedTopLevelFrame) { … }
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
}