Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1977)

Side by Side Diff: chrome/test/base/test_launcher_utils.cc

Issue 2612733003: Machine-local policy files should not affect tests (Closed)
Patch Set: Improve comment Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/test/base/testing_browser_process.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/test/base/test_launcher_utils.h" 5 #include "chrome/test/base/test_launcher_utils.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/environment.h" 10 #include "base/environment.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 99
100 #if defined(OS_POSIX) && !defined(OS_MACOSX) 100 #if defined(OS_POSIX) && !defined(OS_MACOSX)
101 // Make sure the cache directory is inside our clear profile. Otherwise 101 // Make sure the cache directory is inside our clear profile. Otherwise
102 // the cache may contain data from earlier tests that could break the 102 // the cache may contain data from earlier tests that could break the
103 // current test. 103 // current test.
104 // 104 //
105 // Note: we use an environment variable here, because we have to pass the 105 // Note: we use an environment variable here, because we have to pass the
106 // value to the child process. This is the simplest way to do it. 106 // value to the child process. This is the simplest way to do it.
107 std::unique_ptr<base::Environment> env(base::Environment::Create()); 107 std::unique_ptr<base::Environment> env(base::Environment::Create());
108 success = success && env->SetVar("XDG_CACHE_HOME", user_data_dir.value()); 108 success = success && env->SetVar("XDG_CACHE_HOME", user_data_dir.value());
109
110 // Also make sure that the machine policy directory is inside the clear
111 // profile. Otherwise the machine's policies could affect tests.
112 base::FilePath policy_files = user_data_dir.AppendASCII("policies");
113 success =
114 success && PathService::Override(chrome::DIR_POLICY_FILES, policy_files);
109 #endif 115 #endif
110 116
111 return success; 117 return success;
112 } 118 }
113 119
114 } // namespace test_launcher_utils 120 } // namespace test_launcher_utils
OLDNEW
« no previous file with comments | « no previous file | chrome/test/base/testing_browser_process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698