summaryrefslogtreecommitdiffstats
path: root/chrome/browser/prefs/pref_service_uitest.cc
diff options
context:
space:
mode:
authormkwst@chromium.org <mkwst@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-12 13:40:53 +0000
committermkwst@chromium.org <mkwst@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-12 13:40:53 +0000
commit3a305db06850635febc42acc54b65a93bf5739c7 (patch)
tree1e79d71199dd8bf13c31b94ee53a25c3afd1fe6b /chrome/browser/prefs/pref_service_uitest.cc
parentca0269fee674ebe4f233ae7f1efa91f503a8c784 (diff)
downloadchromium_src-3a305db06850635febc42acc54b65a93bf5739c7.zip
chromium_src-3a305db06850635febc42acc54b65a93bf5739c7.tar.gz
chromium_src-3a305db06850635febc42acc54b65a93bf5739c7.tar.bz2
Replacing base::DIR_TEMP with ScopedTempDir when appropriate.
BUG=73854 TEST=unit_tests Review URL: http://codereview.chromium.org/6793008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81245 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/prefs/pref_service_uitest.cc')
-rw-r--r--chrome/browser/prefs/pref_service_uitest.cc22
1 files changed, 10 insertions, 12 deletions
diff --git a/chrome/browser/prefs/pref_service_uitest.cc b/chrome/browser/prefs/pref_service_uitest.cc
index fe2a79a..11a5856 100644
--- a/chrome/browser/prefs/pref_service_uitest.cc
+++ b/chrome/browser/prefs/pref_service_uitest.cc
@@ -6,9 +6,9 @@
#include "base/command_line.h"
#include "base/file_util.h"
-#include "base/path_service.h"
#include "base/test/test_file_util.h"
#include "base/values.h"
+#include "base/memory/scoped_temp_dir.h"
#include "build/build_config.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
@@ -22,12 +22,10 @@
class PreferenceServiceTest : public UITest {
public:
void SetUp() {
- PathService::Get(base::DIR_TEMP, &tmp_profile_);
- tmp_profile_ = tmp_profile_.AppendASCII("tmp_profile");
+ ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
+ FilePath tmp_profile = temp_dir_.path().AppendASCII("tmp_profile");
- // Create a fresh, empty copy of this directory.
- file_util::Delete(tmp_profile_, true);
- file_util::CreateDirectory(tmp_profile_);
+ ASSERT_TRUE(file_util::CreateDirectory(tmp_profile));
FilePath reference_pref_file;
if (new_profile_) {
@@ -36,7 +34,7 @@ class PreferenceServiceTest : public UITest {
.AppendASCII("window_placement")
.AppendASCII("Default")
.Append(chrome::kPreferencesFilename);
- tmp_pref_file_ = tmp_profile_.AppendASCII("Default");
+ tmp_pref_file_ = tmp_profile.AppendASCII("Default");
ASSERT_TRUE(file_util::CreateDirectory(tmp_pref_file_));
tmp_pref_file_ = tmp_pref_file_.Append(chrome::kPreferencesFilename);
} else {
@@ -44,7 +42,7 @@ class PreferenceServiceTest : public UITest {
.AppendASCII("profiles")
.AppendASCII("window_placement")
.Append(chrome::kLocalStateFilename);
- tmp_pref_file_ = tmp_profile_.Append(chrome::kLocalStateFilename);
+ tmp_pref_file_ = tmp_profile.Append(chrome::kLocalStateFilename);
}
ASSERT_TRUE(file_util::PathExists(reference_pref_file));
@@ -59,7 +57,7 @@ class PreferenceServiceTest : public UITest {
FILE_ATTRIBUTE_NORMAL));
#endif
- launch_arguments_.AppendSwitchPath(switches::kUserDataDir, tmp_profile_);
+ launch_arguments_.AppendSwitchPath(switches::kUserDataDir, tmp_profile);
}
bool LaunchAppWithProfile() {
@@ -71,14 +69,14 @@ class PreferenceServiceTest : public UITest {
void TearDown() {
UITest::TearDown();
-
- EXPECT_TRUE(file_util::DieFileDie(tmp_profile_, true));
}
public:
bool new_profile_;
FilePath tmp_pref_file_;
- FilePath tmp_profile_;
+
+ private:
+ ScopedTempDir temp_dir_;
};
#if !defined(OS_LINUX)