Index: chrome/browser/history/text_database_unittest.cc |
diff --git a/chrome/browser/history/text_database_unittest.cc b/chrome/browser/history/text_database_unittest.cc |
index fb94eba8e5cbec2aac46813d8c674c25dd578553..00754450241c54ada418c6436071c787c47ca565 100644 |
--- a/chrome/browser/history/text_database_unittest.cc |
+++ b/chrome/browser/history/text_database_unittest.cc |
@@ -6,6 +6,7 @@ |
#include "base/file_util.h" |
#include "base/memory/scoped_ptr.h" |
+#include "base/memory/scoped_temp_dir.h" |
#include "base/path_service.h" |
#include "base/string_util.h" |
#include "base/utf_string_conversions.h" |
@@ -91,8 +92,7 @@ class TextDatabaseTest : public PlatformTest { |
protected: |
void SetUp() { |
- PlatformTest::SetUp(); |
- PathService::Get(base::DIR_TEMP, &temp_path_); |
+ ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
Paweł Hajdan Jr.
2011/04/08 15:58:17
Make sure to call PlatformTest::SetUp(), that call
Mike West
2011/04/11 14:47:04
Yup, I hit `d` too many times. Good catch! :)
|
} |
void TearDown() { |
@@ -112,7 +112,7 @@ class TextDatabaseTest : public PlatformTest { |
TextDatabase* CreateDB(TextDatabase::DBIdent id, |
bool allow_create, |
bool delete_file) { |
- TextDatabase* db = new TextDatabase(temp_path_, id, allow_create); |
+ TextDatabase* db = new TextDatabase(temp_dir_.path(), id, allow_create); |
if (delete_file) |
file_util::Delete(db->file_name(), false); |
@@ -126,7 +126,7 @@ class TextDatabaseTest : public PlatformTest { |
} |
// Directory containing the databases. |
- FilePath temp_path_; |
+ ScopedTempDir temp_dir_; |
// Name of the main database file. |
FilePath file_name_; |
@@ -183,7 +183,7 @@ TEST_F(TextDatabaseTest, AddRemove) { |
EXPECT_EQ(2, RowCount(db.get())); |
// Close and reopen. |
- db.reset(new TextDatabase(temp_path_, kIdee1, false)); |
+ db.reset(new TextDatabase(temp_dir_.path(), kIdee1, false)); |
EXPECT_TRUE(db->Init()); |
// Verify that the deleted ID is gone and try to delete another one. |