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 <algorithm> | 5 #include <algorithm> |
6 #include <string> | 6 #include <string> |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // favicons) is gone, the reason being either that it was automatically | 72 // favicons) is gone, the reason being either that it was automatically |
73 // |expired|, or manually deleted. | 73 // |expired|, or manually deleted. |
74 void EnsureURLInfoGone(const URLRow& row, bool expired); | 74 void EnsureURLInfoGone(const URLRow& row, bool expired); |
75 | 75 |
76 // Returns whether HistoryBackendNotifier::NotifyURLsModified was | 76 // Returns whether HistoryBackendNotifier::NotifyURLsModified was |
77 // called for |url|. | 77 // called for |url|. |
78 bool ModifiedNotificationSent(const GURL& url); | 78 bool ModifiedNotificationSent(const GURL& url); |
79 | 79 |
80 // Clears the list of notifications received. | 80 // Clears the list of notifications received. |
81 void ClearLastNotifications() { | 81 void ClearLastNotifications() { |
82 STLDeleteValues(¬ifications_); | |
83 urls_modified_notifications_.clear(); | 82 urls_modified_notifications_.clear(); |
84 urls_deleted_notifications_.clear(); | 83 urls_deleted_notifications_.clear(); |
85 } | 84 } |
86 | 85 |
87 void StarURL(const GURL& url) { history_client_.AddBookmark(url); } | 86 void StarURL(const GURL& url) { history_client_.AddBookmark(url); } |
88 | 87 |
89 static bool IsStringInFile(const base::FilePath& filename, const char* str); | 88 static bool IsStringInFile(const base::FilePath& filename, const char* str); |
90 | 89 |
91 // Returns the path the db files are created in. | 90 // Returns the path the db files are created in. |
92 const base::FilePath& path() const { return tmp_dir_.path(); } | 91 const base::FilePath& path() const { return tmp_dir_.path(); } |
(...skipping 10 matching lines...) Expand all Loading... |
103 ExpireHistoryBackend expirer_; | 102 ExpireHistoryBackend expirer_; |
104 | 103 |
105 scoped_ptr<HistoryDatabase> main_db_; | 104 scoped_ptr<HistoryDatabase> main_db_; |
106 scoped_ptr<ThumbnailDatabase> thumb_db_; | 105 scoped_ptr<ThumbnailDatabase> thumb_db_; |
107 TestingProfile profile_; | 106 TestingProfile profile_; |
108 scoped_refptr<TopSites> top_sites_; | 107 scoped_refptr<TopSites> top_sites_; |
109 | 108 |
110 // Time at the beginning of the test, so everybody agrees what "now" is. | 109 // Time at the beginning of the test, so everybody agrees what "now" is. |
111 const Time now_; | 110 const Time now_; |
112 | 111 |
113 // Notifications intended to be broadcast, we can check these values to make | |
114 // sure that the deletor is doing the correct broadcasts. We own the details | |
115 // pointers. | |
116 typedef std::vector< std::pair<int, HistoryDetails*> > | |
117 NotificationList; | |
118 NotificationList notifications_; | |
119 | |
120 typedef std::vector<URLRows> URLsModifiedNotificationList; | 112 typedef std::vector<URLRows> URLsModifiedNotificationList; |
121 URLsModifiedNotificationList urls_modified_notifications_; | 113 URLsModifiedNotificationList urls_modified_notifications_; |
122 | 114 |
123 typedef std::vector<std::pair<bool, URLRows>> URLsDeletedNotificationList; | 115 typedef std::vector<std::pair<bool, URLRows>> URLsDeletedNotificationList; |
124 URLsDeletedNotificationList urls_deleted_notifications_; | 116 URLsDeletedNotificationList urls_deleted_notifications_; |
125 | 117 |
126 private: | 118 private: |
127 void SetUp() override { | 119 void SetUp() override { |
128 ASSERT_TRUE(tmp_dir_.CreateUniqueTempDir()); | 120 ASSERT_TRUE(tmp_dir_.CreateUniqueTempDir()); |
129 | 121 |
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 EXPECT_TRUE(all->Read(now, main_db_.get(), &visits, 1)); | 865 EXPECT_TRUE(all->Read(now, main_db_.get(), &visits, 1)); |
874 EXPECT_EQ(1U, visits.size()); | 866 EXPECT_EQ(1U, visits.size()); |
875 } | 867 } |
876 | 868 |
877 // TODO(brettw) add some visits with no URL to make sure everything is updated | 869 // TODO(brettw) add some visits with no URL to make sure everything is updated |
878 // properly. Have the visits also refer to nonexistent FTS rows. | 870 // properly. Have the visits also refer to nonexistent FTS rows. |
879 // | 871 // |
880 // Maybe also refer to invalid favicons. | 872 // Maybe also refer to invalid favicons. |
881 | 873 |
882 } // namespace history | 874 } // namespace history |
OLD | NEW |