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 "chrome/browser/history/android/android_provider_backend.h" | 5 #include "chrome/browser/history/android/android_provider_backend.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 case chrome::NOTIFICATION_FAVICON_CHANGED: | 68 case chrome::NOTIFICATION_FAVICON_CHANGED: |
69 favicon_details_.reset(static_cast<FaviconChangeDetails*>(details)); | 69 favicon_details_.reset(static_cast<FaviconChangeDetails*>(details)); |
70 break; | 70 break; |
71 case chrome::NOTIFICATION_HISTORY_URLS_MODIFIED: | 71 case chrome::NOTIFICATION_HISTORY_URLS_MODIFIED: |
72 modified_details_.reset(static_cast<URLsModifiedDetails*>(details)); | 72 modified_details_.reset(static_cast<URLsModifiedDetails*>(details)); |
73 break; | 73 break; |
74 } | 74 } |
75 } | 75 } |
76 virtual void DBLoaded(int backend_id) OVERRIDE {} | 76 virtual void DBLoaded(int backend_id) OVERRIDE {} |
77 virtual void StartTopSitesMigration(int backend_id) OVERRIDE {} | 77 virtual void StartTopSitesMigration(int backend_id) OVERRIDE {} |
| 78 virtual void NotifyVisitDBObserversOnAddVisit( |
| 79 const history::BriefVisitInfo& info) OVERRIDE {} |
78 | 80 |
79 URLsDeletedDetails* deleted_details() const { | 81 URLsDeletedDetails* deleted_details() const { |
80 return deleted_details_.get(); | 82 return deleted_details_.get(); |
81 } | 83 } |
82 | 84 |
83 URLsModifiedDetails* modified_details() const { | 85 URLsModifiedDetails* modified_details() const { |
84 return modified_details_.get(); | 86 return modified_details_.get(); |
85 } | 87 } |
86 | 88 |
87 FaviconChangeDetails* favicon_details() const { | 89 FaviconChangeDetails* favicon_details() const { |
(...skipping 1549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1637 } | 1639 } |
1638 | 1640 |
1639 TEST_F(AndroidProviderBackendTest, TestAndroidCTSComplianceForZeroVisitCount) { | 1641 TEST_F(AndroidProviderBackendTest, TestAndroidCTSComplianceForZeroVisitCount) { |
1640 // This is to verify the last visit time and created time are same when visit | 1642 // This is to verify the last visit time and created time are same when visit |
1641 // count is 0. | 1643 // count is 0. |
1642 ASSERT_EQ(sql::INIT_OK, history_db_.Init(history_db_name_, bookmark_temp_)); | 1644 ASSERT_EQ(sql::INIT_OK, history_db_.Init(history_db_name_, bookmark_temp_)); |
1643 ASSERT_EQ(sql::INIT_OK, thumbnail_db_.Init(thumbnail_db_name_, NULL, | 1645 ASSERT_EQ(sql::INIT_OK, thumbnail_db_.Init(thumbnail_db_name_, NULL, |
1644 &history_db_)); | 1646 &history_db_)); |
1645 scoped_ptr<AndroidProviderBackend> backend( | 1647 scoped_ptr<AndroidProviderBackend> backend( |
1646 new AndroidProviderBackend(android_cache_db_name_, &history_db_, | 1648 new AndroidProviderBackend(android_cache_db_name_, &history_db_, |
1647 &thumbnail_db_, &bookmark_model_, &delegate_)); | 1649 &thumbnail_db_, bookmark_model_, &delegate_)); |
1648 URLRow url_row(GURL("http://www.google.com")); | 1650 URLRow url_row(GURL("http://www.google.com")); |
1649 url_row.set_last_visit(Time::Now()); | 1651 url_row.set_last_visit(Time::Now()); |
1650 url_row.set_visit_count(0); | 1652 url_row.set_visit_count(0); |
1651 history_db_.AddURL(url_row); | 1653 history_db_.AddURL(url_row); |
1652 | 1654 |
1653 std::vector<HistoryAndBookmarkRow::ColumnID> projections; | 1655 std::vector<HistoryAndBookmarkRow::ColumnID> projections; |
1654 | 1656 |
1655 projections.push_back(HistoryAndBookmarkRow::ID); | 1657 projections.push_back(HistoryAndBookmarkRow::ID); |
1656 projections.push_back(HistoryAndBookmarkRow::URL); | 1658 projections.push_back(HistoryAndBookmarkRow::URL); |
1657 projections.push_back(HistoryAndBookmarkRow::TITLE); | 1659 projections.push_back(HistoryAndBookmarkRow::TITLE); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1723 // Query by folder=1, the row2 should returned. | 1725 // Query by folder=1, the row2 should returned. |
1724 statement.reset(backend->QueryHistoryAndBookmarks( | 1726 statement.reset(backend->QueryHistoryAndBookmarks( |
1725 projections, std::string("folder=1"), std::vector<string16>(), | 1727 projections, std::string("folder=1"), std::vector<string16>(), |
1726 std::string("url ASC"))); | 1728 std::string("url ASC"))); |
1727 ASSERT_TRUE(statement->statement()->Step()); | 1729 ASSERT_TRUE(statement->statement()->Step()); |
1728 EXPECT_EQ(row2.url(), GURL(statement->statement()->ColumnString(0))); | 1730 EXPECT_EQ(row2.url(), GURL(statement->statement()->ColumnString(0))); |
1729 EXPECT_FALSE(statement->statement()->Step()); | 1731 EXPECT_FALSE(statement->statement()->Step()); |
1730 } | 1732 } |
1731 | 1733 |
1732 } // namespace history | 1734 } // namespace history |
OLD | NEW |