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

Unified Diff: chrome/browser/history/text_database_unittest.cc

Issue 6793008: Replacing base::DIR_TEMP with ScopedTempDir when appropriate. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: About a third of the way done. Created 9 years, 8 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/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.

Powered by Google App Engine
This is Rietveld 408576698