#include "components/safe_browsing/core/browser/verdict_cache_manager.h"
#include "base/base64.h"
#include "base/command_line.h"
#include "base/memory/scoped_refptr.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/task_environment.h"
#include "base/values.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/safe_browsing/core/browser/db/v4_protocol_manager_util.h"
#include "components/safe_browsing/core/browser/safe_browsing_sync_observer.h"
#include "components/safe_browsing/core/common/hashprefix_realtime/hash_realtime_utils.h"
#include "components/safe_browsing/core/common/proto/csd.pb.h"
#include "components/safe_browsing/core/common/proto/realtimeapi.pb.h"
#include "components/safe_browsing/core/common/proto/safebrowsingv5.pb.h"
#include "components/safe_browsing/core/common/safe_browsing_prefs.h"
#include "components/safe_browsing/core/common/safebrowsing_constants.h"
#include "components/sync_preferences/testing_pref_service_syncable.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace safe_browsing {
namespace {
SizeIs;
const char kArtificialHashRealTimeUnsafeUrl[] = …;
class MockSafeBrowsingSyncObserver : public SafeBrowsingSyncObserver { … };
}
class VerdictCacheManagerTest : public ::testing::Test { … };
class ArtificialHashRealTimeVerdictCacheManagerTest
: public VerdictCacheManagerTest { … };
TEST_F(VerdictCacheManagerTest, TestCanRetrieveCachedVerdict) { … }
TEST_F(VerdictCacheManagerTest, TestCacheSplitByTriggerType) { … }
TEST_F(VerdictCacheManagerTest, TestCacheSplitByPasswordType) { … }
TEST_F(VerdictCacheManagerTest, TestGetStoredPhishGuardVerdictCount) { … }
TEST_F(VerdictCacheManagerTest, TestParseInvalidVerdictEntry) { … }
TEST_F(VerdictCacheManagerTest, TestRemoveCachedVerdictOnURLsDeleted) { … }
#if TARGET_OS_IOS && !TARGET_IPHONE_SIMULATOR
#define MAYBE_TestCleanUpExpiredVerdict …
#else
#define MAYBE_TestCleanUpExpiredVerdict …
#endif
TEST_F(VerdictCacheManagerTest, MAYBE_TestCleanUpExpiredVerdict) { … }
TEST_F(VerdictCacheManagerTest, TestCleanUpExpiredVerdictWithInvalidEntry) { … }
TEST_F(VerdictCacheManagerTest, TestCanRetrieveCachedRealTimeUrlCheckVerdict) { … }
TEST_F(VerdictCacheManagerTest,
TestCanRetrieveCachedRealTimeUrlCheckVerdictWithMultipleThreatInfos) { … }
TEST_F(VerdictCacheManagerTest,
TestCannotRetrieveRealTimeUrlCheckExpiredVerdict) { … }
TEST_F(VerdictCacheManagerTest,
TestRemoveRealTimeUrlCheckCachedVerdictOnURLsDeleted) { … }
TEST_F(VerdictCacheManagerTest,
TestCanRetrieveCachedRealTimeClientSideDetectionTypeCheck) { … }
TEST_F(VerdictCacheManagerTest, TestHostSuffixMatching) { … }
TEST_F(VerdictCacheManagerTest, TestHostSuffixMatchingMostExactMatching) { … }
TEST_F(VerdictCacheManagerTest, TestExactMatching) { … }
TEST_F(VerdictCacheManagerTest, TestMatchingTypeNotSet) { … }
TEST_F(VerdictCacheManagerTest, TestCleanUpExpiredVerdictInBackground) { … }
TEST_F(VerdictCacheManagerTest, TestCleanUpVerdictOlderThanUpperBound) { … }
TEST_F(VerdictCacheManagerTest, TestGetPageLoadToken) { … }
TEST_F(VerdictCacheManagerTest, TestGetExpiredPageLoadToken) { … }
TEST_F(VerdictCacheManagerTest, TestClearTokenOnSafeBrowsingStateChanged) { … }
TEST_F(VerdictCacheManagerTest, TestClearTokenOnSyncStateChanged) { … }
TEST_F(VerdictCacheManagerTest, TestShutdown) { … }
TEST_F(VerdictCacheManagerTest, TestHashPrefixRealTimeLookupCaching) { … }
TEST_F(ArtificialHashRealTimeVerdictCacheManagerTest, TestCachePopulated) { … }
}