Chromium Code Reviews| Index: chrome/browser/profiles/profile_manager_unittest.cc |
| diff --git a/chrome/browser/profiles/profile_manager_unittest.cc b/chrome/browser/profiles/profile_manager_unittest.cc |
| index 1ae59f3d9806e120f19f23f96504a0e0e26b189c..bcea5e59738947d83358109111c330816d75120a 100644 |
| --- a/chrome/browser/profiles/profile_manager_unittest.cc |
| +++ b/chrome/browser/profiles/profile_manager_unittest.cc |
| @@ -5,7 +5,7 @@ |
| #include <string> |
| #include "base/command_line.h" |
| -#include "base/file_util.h" |
| +#include "base/memory/scoped_temp_dir.h" |
| #include "base/message_loop.h" |
| #include "base/path_service.h" |
| #include "chrome/browser/prefs/browser_prefs.h" |
| @@ -29,13 +29,9 @@ class ProfileManagerTest : public testing::Test { |
| } |
| virtual void SetUp() { |
| - // Name a subdirectory of the temp directory. |
| - ASSERT_TRUE(PathService::Get(base::DIR_TEMP, &test_dir_)); |
| - test_dir_ = test_dir_.Append(FILE_PATH_LITERAL("ProfileManagerTest")); |
| - |
| - // Create a fresh, empty copy of this directory. |
| - file_util::Delete(test_dir_, true); |
| - file_util::CreateDirectory(test_dir_); |
| + // Create a new temporary directory, and store the path |
| + ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| + test_dir_ = temp_dir_.path(); |
|
Paweł Hajdan Jr.
2011/04/04 08:08:54
How about removing the member variable and using t
Mike West
2011/04/04 08:39:33
Two reasons:
1. This was the minimal changeset, a
Paweł Hajdan Jr.
2011/04/04 09:05:31
Makes sense, but on the other hand it may be worth
Mike West
2011/04/04 09:16:07
Fair enough, you've convinced me. :) I'll change i
|
| // Create a local_state PrefService. |
| browser::RegisterLocalState(&test_local_state_); |
| @@ -46,8 +42,7 @@ class ProfileManagerTest : public testing::Test { |
| virtual void TearDown() { |
| // Clean up test directory |
| - ASSERT_TRUE(file_util::Delete(test_dir_, true)); |
| - ASSERT_FALSE(file_util::PathExists(test_dir_)); |
| + ASSERT_TRUE(temp_dir_.Delete()); |
|
Paweł Hajdan Jr.
2011/04/04 08:08:54
This shouldn't be necessary. That's the entire poi
Mike West
2011/04/04 08:39:33
Maybe I'm misunderstanding the mechanics here, but
Paweł Hajdan Jr.
2011/04/04 09:05:31
Yes, it does. Feel free to check with a debugger a
Mike West
2011/04/04 09:16:07
Me, for instance. :)
|
| TestingBrowserProcess* testing_browser_process = |
| static_cast<TestingBrowserProcess*>(g_browser_process); |
| @@ -59,6 +54,7 @@ class ProfileManagerTest : public testing::Test { |
| BrowserThread file_thread_; |
| // the path to temporary directory used to contain the test operations |
| + ScopedTempDir temp_dir_; |
|
Paweł Hajdan Jr.
2011/04/04 08:08:54
Please make ScopedTempDir the first member variabl
Mike West
2011/04/04 08:39:33
Done.
|
| FilePath test_dir_; |
| TestingPrefService test_local_state_; |