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

Unified Diff: chrome/browser/diagnostics/diagnostics_controller_unittest.cc

Issue 200473002: Move all callers of GetHomeDir() to PathService::Get(base::DIR_HOME). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/diagnostics/diagnostics_controller_unittest.cc
diff --git a/chrome/browser/diagnostics/diagnostics_controller_unittest.cc b/chrome/browser/diagnostics/diagnostics_controller_unittest.cc
index 369dde6ac69dcd1cdfbfa4269408145e69591b5f..cc2180b8e69e28f3b7c2017dbb11a602df5590e1 100644
--- a/chrome/browser/diagnostics/diagnostics_controller_unittest.cc
+++ b/chrome/browser/diagnostics/diagnostics_controller_unittest.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/diagnostics/diagnostics_controller.h"
+#include "base/base_paths.h"
#include "base/command_line.h"
#include "base/file_util.h"
#include "base/files/scoped_temp_dir.h"
@@ -40,14 +41,8 @@ class DiagnosticsControllerTest : public testing::Test {
// Redirect the home dir to the profile directory. We have to do this
// because NSS uses the HOME directory to find where to store it's database,
// so that's where the diagnostics and recovery code looks for it.
-
- // Preserve existing home directory setting, if any.
- const char* old_home_dir = ::getenv("HOME");
- if (old_home_dir)
- old_home_dir_ = old_home_dir;
- else
- old_home_dir_.clear();
- ::setenv("HOME", profile_dir_.value().c_str(), 1);
+ PathService::Get(base::DIR_HOME, &old_home_dir_);
+ PathService::Override(base::DIR_HOME, profile_dir_);
#endif
cmdline_ = CommandLine(CommandLine::NO_PROGRAM);
@@ -62,11 +57,7 @@ class DiagnosticsControllerTest : public testing::Test {
virtual void TearDown() {
DiagnosticsController::GetInstance()->ClearResults();
#if defined(OS_CHROMEOS)
- if (!old_home_dir_.empty()) {
- ::setenv("HOME", old_home_dir_.c_str(), 1);
- } else {
- ::unsetenv("HOME");
- }
+ PathService::Override(base::DIR_HOME, old_home_dir_);
old_home_dir_.clear();
#endif
}
@@ -85,7 +76,7 @@ class DiagnosticsControllerTest : public testing::Test {
base::FilePath profile_dir_;
#if defined(OS_CHROMEOS)
- std::string old_home_dir_;
+ base::FilePath old_home_dir_;
#endif
DISALLOW_COPY_AND_ASSIGN(DiagnosticsControllerTest);
« no previous file with comments | « chrome/browser/chromeos/login/users/user_manager_impl.cc ('k') | chrome/browser/diagnostics/sqlite_diagnostics.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698