#include "content/browser/browsing_data/browsing_data_remover_impl.h"
#include <stddef.h>
#include <stdint.h>
#include <list>
#include <memory>
#include <optional>
#include <set>
#include <string>
#include <utility>
#include <vector>
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/location.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/raw_ref.h"
#include "base/run_loop.h"
#include "base/scoped_observation.h"
#include "base/strings/strcat.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/cancelable_task_tracker.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/gmock_callback_support.h"
#include "base/test/scoped_feature_list.h"
#include "base/time/time.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_filter_builder.h"
#include "content/public/browser/browsing_data_remover.h"
#include "content/public/browser/browsing_data_remover_delegate.h"
#include "content/public/browser/cookie_store_factory.h"
#include "content/public/browser/dom_storage_context.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/test/browser_task_environment.h"
#include "content/public/test/browsing_data_remover_test_util.h"
#include "content/public/test/mock_download_manager.h"
#include "content/public/test/test_browser_context.h"
#include "content/public/test/test_storage_partition.h"
#include "content/public/test/test_utils.h"
#include "net/cookies/canonical_cookie.h"
#include "net/cookies/cookie_deletion_info.h"
#include "net/cookies/cookie_store.h"
#include "net/http/http_network_session.h"
#include "net/http/http_transaction_factory.h"
#include "ppapi/buildflags/buildflags.h"
#include "services/network/cookie_manager.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/mojom/network_context.mojom.h"
#include "services/network/test/test_network_context.h"
#include "storage/browser/test/mock_special_storage_policy.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"
#include "url/origin.h"
RunOnceClosure;
_;
ByRef;
Eq;
Invoke;
IsEmpty;
MakeMatcher;
Matcher;
MatcherInterface;
MatchResultListener;
Not;
Return;
SizeIs;
StrictMock;
Truly;
UnorderedElementsAre;
WithArgs;
CookieDeletionFilterPtr;
namespace content {
namespace {
struct StoragePartitionRemovalData { … };
net::CanonicalCookie CreateCookieWithHost(const url::Origin& origin) { … }
class StoragePartitionRemovalTestStoragePartition
: public TestStoragePartition { … };
class ProbablySameFilterMatcher
: public MatcherInterface<
const base::RepeatingCallback<bool(const GURL&)>&> { … };
inline Matcher<const base::RepeatingCallback<bool(const GURL&)>&>
ProbablySameFilter(base::RepeatingCallback<bool(const GURL&)> filter) { … }
base::Time AnHourAgo() { … }
bool FilterMatchesCookie(const CookieDeletionFilterPtr& filter,
const net::CanonicalCookie& cookie) { … }
class TestBrowsingDataRemoverDelegate
: public content::BrowsingDataRemoverDelegate { … };
}
class RemoveDownloadsTester { … };
class BrowsingDataRemoverImplTest : public testing::Test { … };
TEST_F(BrowsingDataRemoverImplTest, RemoveCookieForever) { … }
TEST_F(BrowsingDataRemoverImplTest, RemoveCookieLastHour) { … }
TEST_F(BrowsingDataRemoverImplTest, RemoveCookiesDomainPreserveList) { … }
TEST_F(BrowsingDataRemoverImplTest, RemoveUnprotectedLocalStorageForever) { … }
TEST_F(BrowsingDataRemoverImplTest, RemoveProtectedLocalStorageForever) { … }
TEST_F(BrowsingDataRemoverImplTest, RemoveLocalStorageForLastWeek) { … }
TEST_F(BrowsingDataRemoverImplTest, RemoveMultipleTypes) { … }
TEST_F(BrowsingDataRemoverImplTest, RemoveQuotaManagedDataForeverBoth) { … }
TEST_F(BrowsingDataRemoverImplTest,
RemoveQuotaManagedDataForeverOnlyTemporary) { … }
TEST_F(BrowsingDataRemoverImplTest,
RemoveQuotaManagedDataForeverOnlyPersistent) { … }
TEST_F(BrowsingDataRemoverImplTest, RemoveQuotaManagedDataForeverNeither) { … }
TEST_F(BrowsingDataRemoverImplTest,
RemoveQuotaManagedDataForeverSpecificOrigin) { … }
TEST_F(BrowsingDataRemoverImplTest, RemoveQuotaManagedDataForLastHour) { … }
TEST_F(BrowsingDataRemoverImplTest, RemoveQuotaManagedDataForLastWeek) { … }
TEST_F(BrowsingDataRemoverImplTest, RemoveQuotaManagedUnprotectedOrigins) { … }
TEST_F(BrowsingDataRemoverImplTest, RemoveQuotaManagedProtectedSpecificOrigin) { … }
TEST_F(BrowsingDataRemoverImplTest, RemoveQuotaManagedProtectedOrigins) { … }
TEST_F(BrowsingDataRemoverImplTest,
RemoveQuotaManagedIgnoreExtensionsAndDevTools) { … }
class InspectableCompletionObserver
: public BrowsingDataRemoverCompletionObserver { … };
TEST_F(BrowsingDataRemoverImplTest, CompletionInhibition) { … }
TEST_F(BrowsingDataRemoverImplTest, EarlyShutdown) { … }
TEST_F(BrowsingDataRemoverImplTest, RemoveDownloadsByTimeOnly) { … }
TEST_F(BrowsingDataRemoverImplTest, RemoveDownloadsByOrigin) { … }
TEST_F(BrowsingDataRemoverImplTest, RemoveCodeCache) { … }
TEST_F(BrowsingDataRemoverImplTest,
RemoveShaderCacheAndInterstGroupPermissionsCache) { … }
TEST_F(BrowsingDataRemoverImplTest, RemoveAttributionReporting) { … }
TEST_F(BrowsingDataRemoverImplTest, RemoveAggregationServiceData) { … }
TEST_F(BrowsingDataRemoverImplTest, RemovePrivateAggregationData) { … }
class MultipleTasksObserver { … };
TEST_F(BrowsingDataRemoverImplTest, MultipleTasks) { … }
TEST_F(BrowsingDataRemoverImplTest, MultipleIdenticalTasks) { … }
TEST_F(BrowsingDataRemoverImplTest, MultipleTasksInQuickSuccession) { … }
namespace {
class MockNetworkContext : public network::TestNetworkContext { … };
}
TEST_F(BrowsingDataRemoverImplTest, ClearsTrustTokens) { … }
TEST_F(BrowsingDataRemoverImplTest, PreservesTrustTokens) { … }
TEST_F(BrowsingDataRemoverImplTest, ClearsTrustTokensForSite) { … }
TEST_F(BrowsingDataRemoverImplTest, ClearsTrustTokensForSiteDespiteTimeRange) { … }
TEST_F(BrowsingDataRemoverImplTest, DeferCookieDeletion) { … }
TEST_F(BrowsingDataRemoverImplTest, FailedDataTypes) { … }
TEST_F(BrowsingDataRemoverImplTest, RemoveStorageBucketsAndReply) { … }
TEST_F(BrowsingDataRemoverImplTest, NonDefaultStoragePartitionInFilter) { … }
TEST_F(BrowsingDataRemoverImplTest, DeleteInterestGroupsWhenClearingCookies) { … }
TEST_F(BrowsingDataRemoverImplTest,
IfPartitionedCookiesOnlyDontDeleteInterestGroupsWhenClearingCookies) { … }
class BrowsingDataRemoverImplSharedStorageTest
: public BrowsingDataRemoverImplTest { … };
TEST_F(BrowsingDataRemoverImplSharedStorageTest,
RemoveUnprotectedSharedStorageForever) { … }
TEST_F(BrowsingDataRemoverImplSharedStorageTest,
RemoveProtectedSharedStorageForever) { … }
TEST_F(BrowsingDataRemoverImplSharedStorageTest,
RemoveSharedStorageForLastWeek) { … }
}