| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "chrome/browser/history/history.h" | 10 #include "chrome/browser/history/history.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 } | 59 } |
| 60 | 60 |
| 61 bool EnsureStarredIntegrity() { | 61 bool EnsureStarredIntegrity() { |
| 62 return StarredURLDatabase::EnsureStarredIntegrity(); | 62 return StarredURLDatabase::EnsureStarredIntegrity(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 private: | 65 private: |
| 66 // Test setup. | 66 // Test setup. |
| 67 void SetUp() { | 67 void SetUp() { |
| 68 PathService::Get(base::DIR_TEMP, &db_file_); | 68 PathService::Get(base::DIR_TEMP, &db_file_); |
| 69 db_file_ = db_file_.Append(FILE_PATH_LITERAL("VisitTest.db")); | 69 db_file_ = db_file_.AppendASCII("VisitTest.db"); |
| 70 file_util::Delete(db_file_, false); | 70 file_util::Delete(db_file_, false); |
| 71 | 71 |
| 72 // Copy db file over that contains starred table. | 72 // Copy db file over that contains starred table. |
| 73 FilePath old_history_path; | 73 FilePath old_history_path; |
| 74 PathService::Get(chrome::DIR_TEST_DATA, &old_history_path); | 74 PathService::Get(chrome::DIR_TEST_DATA, &old_history_path); |
| 75 old_history_path = old_history_path.Append(FILE_PATH_LITERAL("bookmarks")); | 75 old_history_path = old_history_path.AppendASCII("bookmarks"); |
| 76 old_history_path = old_history_path.Append( | 76 old_history_path = old_history_path.Append( |
| 77 FILE_PATH_LITERAL("History_with_empty_starred")); | 77 FILE_PATH_LITERAL("History_with_empty_starred")); |
| 78 file_util::CopyFile(old_history_path, db_file_); | 78 file_util::CopyFile(old_history_path, db_file_); |
| 79 | 79 |
| 80 EXPECT_EQ(SQLITE_OK, | 80 EXPECT_EQ(SQLITE_OK, |
| 81 sqlite3_open(WideToUTF8(db_file_.ToWStringHack()).c_str(), &db_)); | 81 sqlite3_open(WideToUTF8(db_file_.ToWStringHack()).c_str(), &db_)); |
| 82 statement_cache_ = new SqliteStatementCache(db_); | 82 statement_cache_ = new SqliteStatementCache(db_); |
| 83 | 83 |
| 84 // Initialize the tables for this test. | 84 // Initialize the tables for this test. |
| 85 CreateURLTable(false); | 85 CreateURLTable(false); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 | 284 |
| 285 // Fix up the table. | 285 // Fix up the table. |
| 286 ASSERT_TRUE(EnsureStarredIntegrity()); | 286 ASSERT_TRUE(EnsureStarredIntegrity()); |
| 287 | 287 |
| 288 // The entry we just created should have been nuked. | 288 // The entry we just created should have been nuked. |
| 289 ASSERT_EQ(initial_count, GetStarredEntryCount()); | 289 ASSERT_EQ(initial_count, GetStarredEntryCount()); |
| 290 } | 290 } |
| 291 | 291 |
| 292 } // namespace history | 292 } // namespace history |
| 293 | 293 |
| OLD | NEW |