| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 107 |
| 108 class HistoryBackendTestBase; | 108 class HistoryBackendTestBase; |
| 109 | 109 |
| 110 // This must be a separate object since HistoryBackend manages its lifetime. | 110 // This must be a separate object since HistoryBackend manages its lifetime. |
| 111 // This just forwards the messages we're interested in to the test object. | 111 // This just forwards the messages we're interested in to the test object. |
| 112 class HistoryBackendTestDelegate : public HistoryBackend::Delegate { | 112 class HistoryBackendTestDelegate : public HistoryBackend::Delegate { |
| 113 public: | 113 public: |
| 114 explicit HistoryBackendTestDelegate(HistoryBackendTestBase* test) | 114 explicit HistoryBackendTestDelegate(HistoryBackendTestBase* test) |
| 115 : test_(test) {} | 115 : test_(test) {} |
| 116 | 116 |
| 117 virtual void NotifyProfileError(sql::InitStatus init_status) override {} | 117 void NotifyProfileError(sql::InitStatus init_status) override {} |
| 118 virtual void SetInMemoryBackend( | 118 void SetInMemoryBackend(scoped_ptr<InMemoryHistoryBackend> backend) override; |
| 119 scoped_ptr<InMemoryHistoryBackend> backend) override; | 119 void NotifyAddVisit(const BriefVisitInfo& info) override {} |
| 120 virtual void NotifyAddVisit(const BriefVisitInfo& info) override {} | 120 void NotifyFaviconChanged(const std::set<GURL>& urls) override; |
| 121 virtual void NotifyFaviconChanged(const std::set<GURL>& urls) override; | 121 void NotifyURLVisited(ui::PageTransition transition, |
| 122 virtual void NotifyURLVisited(ui::PageTransition transition, | 122 const URLRow& row, |
| 123 const URLRow& row, | 123 const RedirectList& redirects, |
| 124 const RedirectList& redirects, | 124 base::Time visit_time) override; |
| 125 base::Time visit_time) override; | 125 void BroadcastNotifications(int type, |
| 126 virtual void BroadcastNotifications( | 126 scoped_ptr<HistoryDetails> details) override; |
| 127 int type, | 127 void DBLoaded() override; |
| 128 scoped_ptr<HistoryDetails> details) override; | |
| 129 virtual void DBLoaded() override; | |
| 130 | 128 |
| 131 private: | 129 private: |
| 132 // Not owned by us. | 130 // Not owned by us. |
| 133 HistoryBackendTestBase* test_; | 131 HistoryBackendTestBase* test_; |
| 134 | 132 |
| 135 DISALLOW_COPY_AND_ASSIGN(HistoryBackendTestDelegate); | 133 DISALLOW_COPY_AND_ASSIGN(HistoryBackendTestDelegate); |
| 136 }; | 134 }; |
| 137 | 135 |
| 138 class HistoryBackendTestBase : public testing::Test { | 136 class HistoryBackendTestBase : public testing::Test { |
| 139 public: | 137 public: |
| (...skipping 3122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3262 // Verify that the second term is no longer returned as result, and also check | 3260 // Verify that the second term is no longer returned as result, and also check |
| 3263 // at the low level that it is gone for good. The term corresponding to the | 3261 // at the low level that it is gone for good. The term corresponding to the |
| 3264 // first URLRow should not be affected. | 3262 // first URLRow should not be affected. |
| 3265 EXPECT_EQ(1u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term1)); | 3263 EXPECT_EQ(1u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term1)); |
| 3266 EXPECT_EQ(0u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term2)); | 3264 EXPECT_EQ(0u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term2)); |
| 3267 EXPECT_TRUE(mem_backend_->db()->GetKeywordSearchTermRow(row1.id(), NULL)); | 3265 EXPECT_TRUE(mem_backend_->db()->GetKeywordSearchTermRow(row1.id(), NULL)); |
| 3268 EXPECT_FALSE(mem_backend_->db()->GetKeywordSearchTermRow(row2.id(), NULL)); | 3266 EXPECT_FALSE(mem_backend_->db()->GetKeywordSearchTermRow(row2.id(), NULL)); |
| 3269 } | 3267 } |
| 3270 | 3268 |
| 3271 } // namespace history | 3269 } // namespace history |
| OLD | NEW |