#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "services/network/cookie_manager.h"
#include <algorithm>
#include <vector>
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/strings/strcat.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/thread_pool.h"
#include "base/task/thread_pool/thread_pool_instance.h"
#include "base/test/bind.h"
#include "base/test/scoped_command_line.h"
#include "base/test/spin_wait.h"
#include "base/test/task_environment.h"
#include "base/test/test_future.h"
#include "base/time/time.h"
#include "components/content_settings/core/common/content_settings.h"
#include "components/content_settings/core/common/content_settings_types.h"
#include "net/cookies/canonical_cookie_test_helpers.h"
#include "net/cookies/cookie_access_result.h"
#include "net/cookies/cookie_constants.h"
#include "net/cookies/cookie_inclusion_status.h"
#include "net/cookies/cookie_monster.h"
#include "net/cookies/cookie_partition_key.h"
#include "net/cookies/cookie_store.h"
#include "net/cookies/cookie_store_test_callbacks.h"
#include "net/cookies/cookie_store_test_helpers.h"
#include "net/cookies/cookie_util.h"
#include "net/cookies/test_cookie_access_delegate.h"
#include "net/extras/sqlite/sqlite_persistent_cookie_store.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_builder.h"
#include "net/url_request/url_request_test_util.h"
#include "services/network/cookie_access_delegate_impl.h"
#include "services/network/public/cpp/is_potentially_trustworthy.h"
#include "services/network/public/cpp/network_switches.h"
#include "services/network/public/mojom/cookie_manager.mojom.h"
#include "services/network/session_cleanup_cookie_store.h"
#include "testing/gmock/include/gmock/gmock-matchers.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace network {
namespace {
StrCat;
IsEmpty;
UnorderedElementsAre;
CookieDeletionInfo;
const base::FilePath::CharType kTestCookiesFilename[] = …);
constexpr char kCookieDomain[] = …;
constexpr char kCookieURL[] = …;
constexpr char kCookieHttpsURL[] = …;
class SynchronousCookieManager { … };
class CookieManagerTest : public testing::Test { … };
bool CompareCanonicalCookies(const net::CanonicalCookie& c1,
const net::CanonicalCookie& c2) { … }
TEST_F(CookieManagerTest, GetAllCookies) { … }
TEST_F(CookieManagerTest, GetAllCookiesWithAccessSemantics) { … }
TEST_F(CookieManagerTest, GetCookieList) { … }
TEST_F(CookieManagerTest, GetCookieListHttpOnly) { … }
TEST_F(CookieManagerTest, GetCookieListSameSite) { … }
TEST_F(CookieManagerTest, GetCookieListCookiePartitionKeyCollection) { … }
TEST_F(CookieManagerTest, GetCookieListAccessTime) { … }
TEST_F(CookieManagerTest, DeleteCanonicalCookie) { … }
TEST_F(CookieManagerTest, DeleteThroughSet) { … }
TEST_F(CookieManagerTest, ConfirmSecureSetFails) { … }
TEST_F(CookieManagerTest, SecureCookieNonCryptographicPotentiallyTrustworthy) { … }
TEST_F(CookieManagerTest, ConfirmHttpOnlySetFails) { … }
TEST_F(CookieManagerTest, ConfirmSecureOverwriteFails) { … }
TEST_F(CookieManagerTest, ConfirmHttpOnlyOverwriteFails) { … }
TEST_F(CookieManagerTest, DeleteEverything) { … }
TEST_F(CookieManagerTest, DeleteByTime) { … }
TEST_F(CookieManagerTest, DeleteByExcludingDomains) { … }
TEST_F(CookieManagerTest, DeleteByIncludingDomains) { … }
TEST_F(CookieManagerTest, DeleteByEmptyIncludingDomains) { … }
TEST_F(CookieManagerTest, DeleteByEmptyExcludingDomains) { … }
TEST_F(CookieManagerTest, DeleteDetails_eTLD) { … }
TEST_F(CookieManagerTest, DeleteDetails_HostDomain) { … }
TEST_F(CookieManagerTest, DeleteDetails_eTLDvsPrivateRegistry) { … }
TEST_F(CookieManagerTest, DeleteDetails_PrivateRegistry) { … }
TEST_F(CookieManagerTest, DeleteDetails_IgnoredFields) { … }
TEST_F(CookieManagerTest, DeleteDetails_Consumer) { … }
TEST_F(CookieManagerTest, DeleteByName) { … }
TEST_F(CookieManagerTest, DeleteByURL) { … }
TEST_F(CookieManagerTest, DeleteBySessionStatus) { … }
TEST_F(CookieManagerTest, DeleteByAll) { … }
class CookieChangeListener : public mojom::CookieChangeListener { … };
TEST_F(CookieManagerTest, AddCookieChangeListener) { … }
TEST_F(CookieManagerTest, AddGlobalChangeListener) { … }
TEST_F(CookieManagerTest, ListenerDestroyed) { … }
TEST_F(CookieManagerTest, ServiceDestructVisible) { … }
TEST_F(CookieManagerTest, CloningAndClientDestructVisible) { … }
TEST_F(CookieManagerTest, BlockThirdPartyCookies) { … }
class FlushableCookieManagerTest : public CookieManagerTest { … };
TEST_F(FlushableCookieManagerTest, FlushCookieStore) { … }
TEST_F(FlushableCookieManagerTest, DeletionFilterToInfo) { … }
class SessionCleanupCookieManagerTest : public CookieManagerTest { … };
TEST_F(SessionCleanupCookieManagerTest, PersistSessionCookies) { … }
TEST_F(SessionCleanupCookieManagerTest, DeleteSessionCookiesOnShutdown) { … }
TEST_F(SessionCleanupCookieManagerTest, SettingMustMatchDomainOnShutdown) { … }
TEST_F(SessionCleanupCookieManagerTest, DeleteSessionOnlyCookies) { … }
TEST_F(SessionCleanupCookieManagerTest, SettingMustMatchDomain) { … }
TEST_F(SessionCleanupCookieManagerTest, DeleteStaleSessionOnlyCookies) { … }
TEST_F(SessionCleanupCookieManagerTest, MorePreciseSettingTakesPrecedence) { … }
TEST_F(SessionCleanupCookieManagerTest, ForceKeepSessionState) { … }
TEST_F(SessionCleanupCookieManagerTest, HttpCookieAllowedOnHttps) { … }
TEST_F(CookieManagerTest, SetStorageAccessGrantSettingsRunsCallback) { … }
}
}