| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/history/core/test/database_test_utils.h" | 5 #include "components/history/core/test/database_test_utils.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "sql/test/test_helpers.h" | 9 #include "sql/test/test_helpers.h" |
| 10 | 10 |
| 11 namespace history { | 11 namespace history { |
| 12 | 12 |
| 13 namespace { | |
| 14 | |
| 15 WARN_UNUSED_RESULT bool GetTestDataHistoryDir(base::FilePath* dir) { | 13 WARN_UNUSED_RESULT bool GetTestDataHistoryDir(base::FilePath* dir) { |
| 16 if (!PathService::Get(base::DIR_SOURCE_ROOT, dir)) | 14 if (!PathService::Get(base::DIR_SOURCE_ROOT, dir)) |
| 17 return false; | 15 return false; |
| 18 *dir = dir->AppendASCII("components"); | 16 *dir = dir->AppendASCII("components"); |
| 19 *dir = dir->AppendASCII("test"); | 17 *dir = dir->AppendASCII("test"); |
| 20 *dir = dir->AppendASCII("data"); | 18 *dir = dir->AppendASCII("data"); |
| 21 *dir = dir->AppendASCII("history"); | 19 *dir = dir->AppendASCII("history"); |
| 22 return true; | 20 return true; |
| 23 } | 21 } |
| 24 | 22 |
| 25 } // namespace | |
| 26 | |
| 27 WARN_UNUSED_RESULT bool CreateDatabaseFromSQL(const base::FilePath& db_path, | 23 WARN_UNUSED_RESULT bool CreateDatabaseFromSQL(const base::FilePath& db_path, |
| 28 const char* ascii_path) { | 24 const char* ascii_path) { |
| 29 base::FilePath dir; | 25 base::FilePath dir; |
| 30 if (!GetTestDataHistoryDir(&dir)) | 26 if (!GetTestDataHistoryDir(&dir)) |
| 31 return false; | 27 return false; |
| 32 return sql::test::CreateDatabaseFromSQL(db_path, dir.AppendASCII(ascii_path)); | 28 return sql::test::CreateDatabaseFromSQL(db_path, dir.AppendASCII(ascii_path)); |
| 33 } | 29 } |
| 34 | 30 |
| 35 } // namespace history | 31 } // namespace history |
| OLD | NEW |