Index: chrome/test/base/testing_browser_process.cc |
diff --git a/chrome/test/base/testing_browser_process.cc b/chrome/test/base/testing_browser_process.cc |
index bed25a5cb9437e27700d6af2bbee38b35cb9889f..508394f107dca3d66d9e872997d10bdcb74421f7 100644 |
--- a/chrome/test/base/testing_browser_process.cc |
+++ b/chrome/test/base/testing_browser_process.cc |
@@ -4,6 +4,7 @@ |
#include "chrome/test/base/testing_browser_process.h" |
+#include "base/path_service.h" |
#include "base/strings/string_util.h" |
#include "base/time/default_clock.h" |
#include "base/time/default_tick_clock.h" |
@@ -17,6 +18,7 @@ |
#include "chrome/browser/printing/print_job_manager.h" |
#include "chrome/browser/profiles/profile_manager.h" |
#include "chrome/browser/safe_browsing/safe_browsing_service.h" |
+#include "chrome/common/chrome_paths.h" |
#include "chrome/common/features.h" |
#include "chrome/test/base/testing_browser_process_platform_part.h" |
#include "components/network_time/network_time_tracker.h" |
@@ -151,6 +153,17 @@ policy::BrowserPolicyConnector* |
if (!browser_policy_connector_) { |
EXPECT_FALSE(created_browser_policy_connector_); |
created_browser_policy_connector_ = true; |
+ |
+#if defined(OS_POSIX) && !defined(OS_MACOSX) |
+ // Make sure that the machine policy directory does not exist so that |
+ // machine-wide poilcies do not affect tests. |
Thiemo Nagel
2017/01/10 13:24:37
Nit: typo
pmarko
2017/01/11 09:09:25
Done.
|
+ // If a test needs to place a file in this directory in the future, we could |
+ // create a temporary directory and make its path available to tests. |
+ base::FilePath local_policy_path("/tmp/non/existing/directory"); |
Paweł Hajdan Jr.
2017/01/05 15:48:02
Why is this in POSIX non-OSX #ifdef?
pmarko
2017/01/05 16:07:53
See Reply on test_launcher_util.cc - if we decide
|
+ EXPECT_TRUE(PathService::OverrideAndCreateIfNeeded( |
+ chrome::DIR_POLICY_FILES, local_policy_path, true, false)); |
+#endif |
+ |
browser_policy_connector_ = platform_part_->CreateBrowserPolicyConnector(); |
// Note: creating the ChromeBrowserPolicyConnector invokes BrowserThread:: |