#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include <algorithm>
#include <memory>
#include <optional>
#include <vector>
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/run_loop.h"
#include "base/strings/escape.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/synchronization/lock.h"
#include "base/test/bind.h"
#include "base/test/scoped_feature_list.h"
#include "base/thread_annotations.h"
#include "base/types/optional_ref.h"
#include "build/build_config.h"
#include "content/browser/browsing_data/browsing_data_browsertest_utils.h"
#include "content/browser/browsing_data/browsing_data_filter_builder_impl.h"
#include "content/browser/browsing_data/shared_storage_clear_site_data_tester.h"
#include "content/browser/browsing_data/storage_bucket_clear_site_data_tester.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/browsing_data_remover.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/network_service_util.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/browser/storage_partition_config.h"
#include "content/public/browser/storage_usage_info.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/content_browser_test.h"
#include "content/public/test/content_browser_test_utils.h"
#include "content/public/test/mock_browsing_data_remover_delegate.h"
#include "content/public/test/test_navigation_observer.h"
#include "content/shell/browser/shell.h"
#include "net/base/features.h"
#include "net/base/net_errors.h"
#include "net/base/schemeful_site.h"
#include "net/base/url_util.h"
#include "net/cookies/cookie_access_result.h"
#include "net/cookies/cookie_partition_key.h"
#include "net/cookies/cookie_partition_key_collection.h"
#include "net/cookies/cookie_store.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
#include "storage/browser/quota/quota_settings.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/features_generated.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"
#include "third_party/blink/public/mojom/storage_key/ancestor_chain_bit.mojom.h"
#include "url/origin.h"
#include "url/url_constants.h"
_;
namespace content {
namespace {
void AddQuery(GURL* url, const std::string& key, const std::string& value) { … }
void WaitForTitle(const Shell* shell, const char* expected_title) { … }
static const char* kClearCookiesHeader = …;
enum class SetStorageKey { … };
class TestBrowsingDataRemoverDelegate : public MockBrowsingDataRemoverDelegate { … };
}
class ClearSiteDataHandlerBrowserTest : public ContentBrowserTest { … };
#if BUILDFLAG(IS_WIN)
#define MAYBE_RedirectNavigation …
#else
#define MAYBE_RedirectNavigation …
#endif
IN_PROC_BROWSER_TEST_F(ClearSiteDataHandlerBrowserTest,
MAYBE_RedirectNavigation) { … }
#if BUILDFLAG(IS_WIN)
#define MAYBE_RedirectResourceLoad …
#else
#define MAYBE_RedirectResourceLoad …
#endif
IN_PROC_BROWSER_TEST_F(ClearSiteDataHandlerBrowserTest,
MAYBE_RedirectResourceLoad) { … }
IN_PROC_BROWSER_TEST_F(ClearSiteDataHandlerBrowserTest, InsecureNavigation) { … }
class ClearSiteDataHandlerBrowserTestWithAutoupgradesDisabled
: public ClearSiteDataHandlerBrowserTest { … };
IN_PROC_BROWSER_TEST_F(ClearSiteDataHandlerBrowserTestWithAutoupgradesDisabled,
SecureAndInsecureResourceLoad) { … }
IN_PROC_BROWSER_TEST_F(ClearSiteDataHandlerBrowserTest, ServiceWorker) { … }
#if BUILDFLAG(IS_WIN)
#define MAYBE_Credentials …
#else
#define MAYBE_Credentials …
#endif
IN_PROC_BROWSER_TEST_F(ClearSiteDataHandlerBrowserTest, MAYBE_Credentials) { … }
IN_PROC_BROWSER_TEST_F(ClearSiteDataHandlerBrowserTest, CredentialsOnRedirect) { … }
IN_PROC_BROWSER_TEST_F(ClearSiteDataHandlerBrowserTest, Types) { … }
IN_PROC_BROWSER_TEST_F(ClearSiteDataHandlerBrowserTest,
CookiesIntegrationTest) { … }
IN_PROC_BROWSER_TEST_F(ClearSiteDataHandlerBrowserTest,
ThirdPartyCookieBlocking) { … }
IN_PROC_BROWSER_TEST_F(ClearSiteDataHandlerBrowserTest,
StorageServiceWorkersIntegrationTest) { … }
IN_PROC_BROWSER_TEST_F(ClearSiteDataHandlerBrowserTest,
DISABLED_CacheIntegrationTest) { … }
IN_PROC_BROWSER_TEST_F(ClearSiteDataHandlerBrowserTest, ClosedTab) { … }
IN_PROC_BROWSER_TEST_F(ClearSiteDataHandlerBrowserTest,
ClearSiteDataDuringServiceWorkerInstall) { … }
IN_PROC_BROWSER_TEST_F(ClearSiteDataHandlerBrowserTest,
ClearSiteDataDuringServiceWorkerUpdate) { … }
enum TestScenario { … };
class ClearSiteDataHandlerStorageBucketsBrowserTest
: public ClearSiteDataHandlerBrowserTest,
public testing::WithParamInterface<TestScenario> { … };
INSTANTIATE_TEST_SUITE_P(…);
IN_PROC_BROWSER_TEST_P(ClearSiteDataHandlerStorageBucketsBrowserTest,
StorageBucketsIntegrationTest) { … }
class ClearSiteDataHandlerSharedStorageBrowserTest
: public ClearSiteDataHandlerBrowserTest { … };
IN_PROC_BROWSER_TEST_F(ClearSiteDataHandlerSharedStorageBrowserTest,
SharedStorageIntegrationTest) { … }
}