Index: chrome/test/base/test_launcher_utils.cc |
diff --git a/chrome/test/base/test_launcher_utils.cc b/chrome/test/base/test_launcher_utils.cc |
index 88926743500e693745885766a43a6d2aec508e4c..7dd5f9251b179a81f0fd104477e81d286edbbfb0 100644 |
--- a/chrome/test/base/test_launcher_utils.cc |
+++ b/chrome/test/base/test_launcher_utils.cc |
@@ -106,6 +106,12 @@ bool OverrideUserDataDir(const base::FilePath& user_data_dir) { |
// value to the child process. This is the simplest way to do it. |
std::unique_ptr<base::Environment> env(base::Environment::Create()); |
success = success && env->SetVar("XDG_CACHE_HOME", user_data_dir.value()); |
+ |
+ // Also make sure that the machine policy directory is inside the clear |
+ // profile. Otherwise the machine's policies could affect tests. |
+ base::FilePath policy_files = user_data_dir.AppendASCII("policies"); |
+ success = |
+ success && PathService::Override(chrome::DIR_POLICY_FILES, policy_files); |
#endif |
return success; |