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

Unified Diff: app/sql/statement_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: Needed to rebase; patch didn't apply cleanly to save_package_unittest. 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
« no previous file with comments | « app/sql/connection_unittest.cc ('k') | app/sql/transaction_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: app/sql/statement_unittest.cc
diff --git a/app/sql/statement_unittest.cc b/app/sql/statement_unittest.cc
index f9271a7aba12c83eb81d564ee0ab8a968ab1ddf1..2cefd18fa296499e01be4df32db236e7d6086a2d 100644
--- a/app/sql/statement_unittest.cc
+++ b/app/sql/statement_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.
@@ -6,9 +6,8 @@
#include "app/sql/connection.h"
#include "app/sql/statement.h"
-#include "base/file_path.h"
#include "base/file_util.h"
-#include "base/path_service.h"
+#include "base/memory/scoped_temp_dir.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/sqlite/sqlite3.h"
@@ -43,10 +42,9 @@ class SQLStatementTest : public testing::Test {
SQLStatementTest() : error_handler_(new StatementErrorHandler) {}
void SetUp() {
- ASSERT_TRUE(PathService::Get(base::DIR_TEMP, &path_));
- path_ = path_.AppendASCII("SQLStatementTest.db");
- file_util::Delete(path_, false);
- ASSERT_TRUE(db_.Open(path_));
+ ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
+ ASSERT_TRUE(db_.Open(temp_dir_.path().AppendASCII("SQLStatementTest.db")));
+
// The |error_handler_| will be called if any sqlite statement operation
// returns an error code.
db_.set_error_delegate(error_handler_);
@@ -57,9 +55,6 @@ class SQLStatementTest : public testing::Test {
// error_handler_->sql_statement().
EXPECT_EQ(SQLITE_OK, error_handler_->error());
db_.Close();
- // If this fails something is going on with cleanup and later tests may
- // fail, so we want to identify problems right away.
- ASSERT_TRUE(file_util::Delete(path_, false));
}
sql::Connection& db() { return db_; }
@@ -68,7 +63,7 @@ class SQLStatementTest : public testing::Test {
void reset_error() const { error_handler_->reset_error(); }
private:
- FilePath path_;
+ ScopedTempDir temp_dir_;
sql::Connection db_;
scoped_refptr<StatementErrorHandler> error_handler_;
};
« no previous file with comments | « app/sql/connection_unittest.cc ('k') | app/sql/transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698