| 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 "base/file_util.h" | 5 #include "base/file_util.h" |
| 6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "chrome/browser/history/url_database.h" | 8 #include "chrome/browser/history/url_database.h" |
| 9 #include "chrome/browser/history/visit_database.h" | 9 #include "chrome/browser/history/visit_database.h" |
| 10 #include "chrome/common/sqlite_compiled_statement.h" | 10 #include "chrome/common/sqlite_compiled_statement.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 public URLDatabase, | 34 public URLDatabase, |
| 35 public VisitDatabase { | 35 public VisitDatabase { |
| 36 public: | 36 public: |
| 37 VisitDatabaseTest() : db_(NULL), statement_cache_(NULL) { | 37 VisitDatabaseTest() : db_(NULL), statement_cache_(NULL) { |
| 38 } | 38 } |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 // Test setup. | 41 // Test setup. |
| 42 void SetUp() { | 42 void SetUp() { |
| 43 PathService::Get(base::DIR_TEMP, &db_file_); | 43 PathService::Get(base::DIR_TEMP, &db_file_); |
| 44 db_file_.push_back(file_util::kPathSeparator); | 44 db_file_.push_back(FilePath::kSeparators[0]); |
| 45 db_file_.append(L"VisitTest.db"); | 45 db_file_.append(L"VisitTest.db"); |
| 46 file_util::Delete(db_file_, false); | 46 file_util::Delete(db_file_, false); |
| 47 | 47 |
| 48 EXPECT_EQ(SQLITE_OK, sqlite3_open(WideToUTF8(db_file_).c_str(), &db_)); | 48 EXPECT_EQ(SQLITE_OK, sqlite3_open(WideToUTF8(db_file_).c_str(), &db_)); |
| 49 statement_cache_ = new SqliteStatementCache(db_); | 49 statement_cache_ = new SqliteStatementCache(db_); |
| 50 | 50 |
| 51 // Initialize the tables for this test. | 51 // Initialize the tables for this test. |
| 52 CreateURLTable(false); | 52 CreateURLTable(false); |
| 53 CreateMainURLIndex(); | 53 CreateMainURLIndex(); |
| 54 CreateSupplimentaryURLIndices(); | 54 CreateSupplimentaryURLIndices(); |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 EXPECT_TRUE(IsVisitInfoEqual(results[0], visit_info2)); | 234 EXPECT_TRUE(IsVisitInfoEqual(results[0], visit_info2)); |
| 235 | 235 |
| 236 // Query for a max count and make sure we get only that number. | 236 // Query for a max count and make sure we get only that number. |
| 237 GetVisibleVisitsInRange(Time(), Time(), false, 2, &results); | 237 GetVisibleVisitsInRange(Time(), Time(), false, 2, &results); |
| 238 ASSERT_EQ(2, results.size()); | 238 ASSERT_EQ(2, results.size()); |
| 239 EXPECT_TRUE(IsVisitInfoEqual(results[0], visit_info4) && | 239 EXPECT_TRUE(IsVisitInfoEqual(results[0], visit_info4) && |
| 240 IsVisitInfoEqual(results[1], visit_info2)); | 240 IsVisitInfoEqual(results[1], visit_info2)); |
| 241 } | 241 } |
| 242 | 242 |
| 243 } // namespace history | 243 } // namespace history |
| OLD | NEW |