#include "chrome/browser/safe_browsing/incident_reporting/state_store.h"
#include <stdint.h>
#include "base/files/scoped_temp_dir.h"
#include "base/json/json_file_value_serializer.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/test_simple_task_runner.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/prefs/browser_prefs.h"
#include "chrome/browser/safe_browsing/incident_reporting/incident.h"
#include "chrome/browser/safe_browsing/incident_reporting/platform_state_store.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile.h"
#include "chrome/test/base/testing_profile_manager.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/in_memory_pref_store.h"
#include "components/safe_browsing/core/common/safe_browsing_prefs.h"
#include "components/sync_preferences/pref_service_syncable.h"
#include "components/sync_preferences/pref_service_syncable_factory.h"
#include "content/public/test/browser_task_environment.h"
#include "extensions/browser/quota_service.h"
#include "testing/gtest/include/gtest/gtest.h"
#if BUILDFLAG(IS_WIN)
#include "base/test/test_reg_util_win.h"
#endif
namespace safe_browsing {
#if BUILDFLAG(IS_WIN)
class PlatformStateStoreTestBase : public ::testing::Test {
protected:
PlatformStateStoreTestBase() {}
PlatformStateStoreTestBase(const PlatformStateStoreTestBase&) = delete;
PlatformStateStoreTestBase& operator=(const PlatformStateStoreTestBase&) =
delete;
void SetUp() override {
::testing::Test::SetUp();
ASSERT_NO_FATAL_FAILURE(
registry_override_manager_.OverrideRegistry(HKEY_CURRENT_USER));
}
private:
registry_util::RegistryOverrideManager registry_override_manager_;
};
#else
PlatformStateStoreTestBase;
#endif
class StateStoreTest : public PlatformStateStoreTestBase { … };
const char StateStoreTest::kProfileName_[] = …;
const StateStoreTest::TestData StateStoreTest::kTestData_[] = …;
TEST_F(StateStoreTest, MarkAsAndHasBeenReported) { … }
TEST_F(StateStoreTest, ClearForType) { … }
TEST_F(StateStoreTest, ClearAll) { … }
TEST_F(StateStoreTest, Persistence) { … }
TEST_F(StateStoreTest, PersistenceWithStoreDelete) { … }
}