Chromium Code Reviews| Index: app/sql/transaction_unittest.cc |
| diff --git a/app/sql/transaction_unittest.cc b/app/sql/transaction_unittest.cc |
| index 9ca6bbda15910bf717fc5e232363f5c97c124d93..36c66bd89cec7e060e2ef31a224653a45e727422 100644 |
| --- a/app/sql/transaction_unittest.cc |
| +++ b/app/sql/transaction_unittest.cc |
| @@ -1,13 +1,12 @@ |
| -// 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. |
| #include "app/sql/connection.h" |
| #include "app/sql/statement.h" |
| #include "app/sql/transaction.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" |
| @@ -16,10 +15,9 @@ class SQLTransactionTest : public testing::Test { |
| SQLTransactionTest() {} |
| 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("SQLTransactionTest.db"))); |
| ASSERT_TRUE(db().Execute("CREATE TABLE foo (a, b)")); |
| } |
| @@ -29,7 +27,8 @@ class SQLTransactionTest : public testing::Test { |
| // If this fails something is going on with cleanup and later tests may |
|
Paweł Hajdan Jr.
2011/04/08 15:58:17
Can be removed.
Mike West
2011/04/11 14:47:04
Done.
|
| // fail, so we want to identify problems right away. |
| - ASSERT_TRUE(file_util::Delete(path_, false)); |
| + ASSERT_TRUE(file_util::Delete( |
| + temp_dir_.path().AppendASCII("SQLTransactionTest.db"), false)); |
| } |
| sql::Connection& db() { return db_; } |
| @@ -42,7 +41,7 @@ class SQLTransactionTest : public testing::Test { |
| } |
| private: |
| - FilePath path_; |
| + ScopedTempDir temp_dir_; |
| sql::Connection db_; |
| }; |