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

Unified Diff: chrome/browser/history/visit_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/visit_database_unittest.cc
diff --git a/chrome/browser/history/visit_database_unittest.cc b/chrome/browser/history/visit_database_unittest.cc
index 1cf1868afeed0123978272b2870ab884bcd142e6..f5fd80be32a125d9ccddf330bb0a38054b6d1d9d 100644
--- a/chrome/browser/history/visit_database_unittest.cc
+++ b/chrome/browser/history/visit_database_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,6 +7,7 @@
#include "base/file_util.h"
#include "base/path_service.h"
#include "base/string_util.h"
+#include "base/memory/scoped_temp_dir.h"
#include "chrome/browser/history/url_database.h"
#include "chrome/browser/history/visit_database.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -42,12 +43,10 @@ class VisitDatabaseTest : public PlatformTest,
// Test setup.
void SetUp() {
PlatformTest::SetUp();
- FilePath temp_dir;
- PathService::Get(base::DIR_TEMP, &temp_dir);
- db_file_ = temp_dir.AppendASCII("VisitTest.db");
- file_util::Delete(db_file_, false);
+ ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
+ FilePath db_file = temp_dir_.path().AppendASCII("VisitTest.db");
- EXPECT_TRUE(db_.Open(db_file_));
+ EXPECT_TRUE(db_.Open(db_file));
// Initialize the tables for this test.
CreateURLTable(false);
@@ -56,7 +55,6 @@ class VisitDatabaseTest : public PlatformTest,
}
void TearDown() {
db_.Close();
- file_util::Delete(db_file_, false);
PlatformTest::TearDown();
}
@@ -65,7 +63,7 @@ class VisitDatabaseTest : public PlatformTest,
return db_;
}
- FilePath db_file_;
+ ScopedTempDir temp_dir_;
sql::Connection db_;
};

Powered by Google App Engine
This is Rietveld 408576698