Chromium Code Reviews| Index: app/sql/connection_unittest.cc |
| diff --git a/app/sql/connection_unittest.cc b/app/sql/connection_unittest.cc |
| index 0a14a9a4a8ba4f81759f4f9d0626fed562a72ee3..af27eb4a733d07d39e537b498489981fb6cb8a7f 100644 |
| --- a/app/sql/connection_unittest.cc |
| +++ b/app/sql/connection_unittest.cc |
| @@ -1,12 +1,11 @@ |
| -// Copyright (c) 2010 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 "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" |
| @@ -15,10 +14,8 @@ class SQLConnectionTest : public testing::Test { |
| SQLConnectionTest() {} |
| void SetUp() { |
| - ASSERT_TRUE(PathService::Get(base::DIR_TEMP, &path_)); |
| - path_ = path_.AppendASCII("SQLConnectionTest.db"); |
| - file_util::Delete(path_, false); |
| - ASSERT_TRUE(db_.Open(path_)); |
| + ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| + ASSERT_TRUE(db_.Open(temp_dir_.path().AppendASCII("SQLConnectionTest.db"))); |
| } |
| void TearDown() { |
| @@ -26,13 +23,14 @@ class SQLConnectionTest : 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
This can also be removed now.
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("SQLConnectionTest.db"), false)); |
| } |
| sql::Connection& db() { return db_; } |
| private: |
| - FilePath path_; |
| + ScopedTempDir temp_dir_; |
| sql::Connection db_; |
| }; |