| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <set> | 5 #include <set> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 CreateURLTable(false); | 54 CreateURLTable(false); |
| 55 CreateMainURLIndex(); | 55 CreateMainURLIndex(); |
| 56 InitVisitTable(); | 56 InitVisitTable(); |
| 57 } | 57 } |
| 58 virtual void TearDown() { | 58 virtual void TearDown() { |
| 59 db_.Close(); | 59 db_.Close(); |
| 60 PlatformTest::TearDown(); | 60 PlatformTest::TearDown(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 // Provided for URL/VisitDatabase. | 63 // Provided for URL/VisitDatabase. |
| 64 virtual sql::Connection& GetDB() OVERRIDE { | 64 virtual sql::Connection& GetDB() override { |
| 65 return db_; | 65 return db_; |
| 66 } | 66 } |
| 67 | 67 |
| 68 base::ScopedTempDir temp_dir_; | 68 base::ScopedTempDir temp_dir_; |
| 69 sql::Connection db_; | 69 sql::Connection db_; |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 TEST_F(VisitDatabaseTest, Add) { | 72 TEST_F(VisitDatabaseTest, Add) { |
| 73 // Add one visit. | 73 // Add one visit. |
| 74 VisitRow visit_info1(1, Time::Now(), 0, ui::PAGE_TRANSITION_LINK, 0); | 74 VisitRow visit_info1(1, Time::Now(), 0, ui::PAGE_TRANSITION_LINK, 0); |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 // Now try without de-duping, expect to see all visible visits to url id 1. | 413 // Now try without de-duping, expect to see all visible visits to url id 1. |
| 414 options.duplicate_policy = QueryOptions::KEEP_ALL_DUPLICATES; | 414 options.duplicate_policy = QueryOptions::KEEP_ALL_DUPLICATES; |
| 415 GetVisibleVisitsForURL(url_id, options, &results); | 415 GetVisibleVisitsForURL(url_id, options, &results); |
| 416 ASSERT_EQ(static_cast<size_t>(3), results.size()); | 416 ASSERT_EQ(static_cast<size_t>(3), results.size()); |
| 417 EXPECT_TRUE(IsVisitInfoEqual(results[0], test_visit_rows[5])); | 417 EXPECT_TRUE(IsVisitInfoEqual(results[0], test_visit_rows[5])); |
| 418 EXPECT_TRUE(IsVisitInfoEqual(results[1], test_visit_rows[1])); | 418 EXPECT_TRUE(IsVisitInfoEqual(results[1], test_visit_rows[1])); |
| 419 EXPECT_TRUE(IsVisitInfoEqual(results[2], test_visit_rows[0])); | 419 EXPECT_TRUE(IsVisitInfoEqual(results[2], test_visit_rows[0])); |
| 420 } | 420 } |
| 421 | 421 |
| 422 } // namespace history | 422 } // namespace history |
| OLD | NEW |