Index: chrome/browser/safe_browsing/incident_reporting/incident_reporting_service_unittest.cc |
diff --git a/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service_unittest.cc b/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service_unittest.cc |
index 7303ea217c990ecfe7738330a76b93e768a20cd0..601086fb6b94b930c4c79e3b041674c3f7a10bc3 100644 |
--- a/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service_unittest.cc |
+++ b/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service_unittest.cc |
@@ -30,6 +30,10 @@ |
#include "net/url_request/url_request_context_getter.h" |
#include "testing/gtest/include/gtest/gtest.h" |
+#if defined(OS_WIN) |
+#include "base/test/test_reg_util_win.h" |
+#endif |
+ |
// A test fixture that sets up a test task runner and makes it the thread's |
// runner. The fixture implements a fake envrionment data collector and a fake |
// report uploader. |
@@ -180,6 +184,11 @@ class IncidentReportingServiceTest : public testing::Test { |
void SetUp() override { |
testing::Test::SetUp(); |
+#if defined(OS_WIN) |
+ // Redirect HKCU so that the platform state store used by the test doesn't |
+ // collide with existing Chrome installs or other tests running in parallel. |
+ registry_override_manager_.OverrideRegistry(HKEY_CURRENT_USER); |
+#endif |
ASSERT_TRUE(profile_manager_.SetUp()); |
} |
@@ -471,6 +480,10 @@ class IncidentReportingServiceTest : public testing::Test { |
receiver->AddIncidentForProcess(MakeTestIncident(nullptr)); |
} |
+#if defined(OS_WIN) |
+ registry_util::RegistryOverrideManager registry_override_manager_; |
+#endif |
+ |
// A mapping of profile name to its corresponding properties. |
std::map<std::string, ProfileProperties> profile_properties_; |
}; |