| 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/history_backend.h" | 5 #include "chrome/browser/history/history_backend.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 bool FaviconBitmapLessThan(const history::FaviconBitmap& a, | 75 bool FaviconBitmapLessThan(const history::FaviconBitmap& a, |
| 76 const history::FaviconBitmap& b) { | 76 const history::FaviconBitmap& b) { |
| 77 return a.pixel_size.GetArea() < b.pixel_size.GetArea(); | 77 return a.pixel_size.GetArea() < b.pixel_size.GetArea(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 class HistoryClientMock : public history::HistoryClientFakeBookmarks { | 80 class HistoryClientMock : public history::HistoryClientFakeBookmarks { |
| 81 public: | 81 public: |
| 82 MOCK_METHOD0(BlockUntilBookmarksLoaded, void()); | 82 MOCK_METHOD0(BlockUntilBookmarksLoaded, void()); |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 void SimulateNotificationURLVisited(history::HistoryServiceObserver* observer, | 85 void SimulateNotificationURLVisited(HistoryService::Observer* observer, |
| 86 const history::URLRow* row1, | 86 const history::URLRow* row1, |
| 87 const history::URLRow* row2, | 87 const history::URLRow* row2, |
| 88 const history::URLRow* row3) { | 88 const history::URLRow* row3) { |
| 89 history::URLRows rows; | 89 history::URLRows rows; |
| 90 rows.push_back(*row1); | 90 rows.push_back(*row1); |
| 91 if (row2) | 91 if (row2) |
| 92 rows.push_back(*row2); | 92 rows.push_back(*row2); |
| 93 if (row3) | 93 if (row3) |
| 94 rows.push_back(*row3); | 94 rows.push_back(*row3); |
| 95 | 95 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 115 : test_(test) {} | 115 : test_(test) {} |
| 116 | 116 |
| 117 virtual void NotifyProfileError(sql::InitStatus init_status) OVERRIDE {} | 117 virtual void NotifyProfileError(sql::InitStatus init_status) OVERRIDE {} |
| 118 virtual void SetInMemoryBackend( | 118 virtual void SetInMemoryBackend( |
| 119 scoped_ptr<InMemoryHistoryBackend> backend) OVERRIDE; | 119 scoped_ptr<InMemoryHistoryBackend> backend) OVERRIDE; |
| 120 virtual void NotifyFaviconChanged(const std::set<GURL>& urls) OVERRIDE; | 120 virtual void NotifyFaviconChanged(const std::set<GURL>& urls) OVERRIDE; |
| 121 virtual void NotifyURLVisited(ui::PageTransition transition, | 121 virtual void NotifyURLVisited(ui::PageTransition transition, |
| 122 const URLRow& row, | 122 const URLRow& row, |
| 123 const RedirectList& redirects, | 123 const RedirectList& redirects, |
| 124 base::Time visit_time) OVERRIDE; | 124 base::Time visit_time) OVERRIDE; |
| 125 virtual void NotifyAddVisit(const BriefVisitInfo& info) OVERRIDE {} |
| 125 virtual void BroadcastNotifications( | 126 virtual void BroadcastNotifications( |
| 126 int type, | 127 int type, |
| 127 scoped_ptr<HistoryDetails> details) OVERRIDE; | 128 scoped_ptr<HistoryDetails> details) OVERRIDE; |
| 128 virtual void DBLoaded() OVERRIDE; | 129 virtual void DBLoaded() OVERRIDE; |
| 129 virtual void NotifyVisitDBObserversOnAddVisit( | |
| 130 const BriefVisitInfo& info) OVERRIDE {} | |
| 131 | 130 |
| 132 private: | 131 private: |
| 133 // Not owned by us. | 132 // Not owned by us. |
| 134 HistoryBackendTestBase* test_; | 133 HistoryBackendTestBase* test_; |
| 135 | 134 |
| 136 DISALLOW_COPY_AND_ASSIGN(HistoryBackendTestDelegate); | 135 DISALLOW_COPY_AND_ASSIGN(HistoryBackendTestDelegate); |
| 137 }; | 136 }; |
| 138 | 137 |
| 139 class HistoryBackendTestBase : public testing::Test { | 138 class HistoryBackendTestBase : public testing::Test { |
| 140 public: | 139 public: |
| (...skipping 3124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3265 // Verify that the second term is no longer returned as result, and also check | 3264 // Verify that the second term is no longer returned as result, and also check |
| 3266 // at the low level that it is gone for good. The term corresponding to the | 3265 // at the low level that it is gone for good. The term corresponding to the |
| 3267 // first URLRow should not be affected. | 3266 // first URLRow should not be affected. |
| 3268 EXPECT_EQ(1u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term1)); | 3267 EXPECT_EQ(1u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term1)); |
| 3269 EXPECT_EQ(0u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term2)); | 3268 EXPECT_EQ(0u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term2)); |
| 3270 EXPECT_TRUE(mem_backend_->db()->GetKeywordSearchTermRow(row1.id(), NULL)); | 3269 EXPECT_TRUE(mem_backend_->db()->GetKeywordSearchTermRow(row1.id(), NULL)); |
| 3271 EXPECT_FALSE(mem_backend_->db()->GetKeywordSearchTermRow(row2.id(), NULL)); | 3270 EXPECT_FALSE(mem_backend_->db()->GetKeywordSearchTermRow(row2.id(), NULL)); |
| 3272 } | 3271 } |
| 3273 | 3272 |
| 3274 } // namespace history | 3273 } // namespace history |
| OLD | NEW |