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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // This must be a separate object since HistoryBackend manages its lifetime. | 85 // This must be a separate object since HistoryBackend manages its lifetime. |
86 // This just forwards the messages we're interested in to the test object. | 86 // This just forwards the messages we're interested in to the test object. |
87 class HistoryBackendTestDelegate : public HistoryBackend::Delegate { | 87 class HistoryBackendTestDelegate : public HistoryBackend::Delegate { |
88 public: | 88 public: |
89 explicit HistoryBackendTestDelegate(HistoryBackendTestBase* test) | 89 explicit HistoryBackendTestDelegate(HistoryBackendTestBase* test) |
90 : test_(test) {} | 90 : test_(test) {} |
91 | 91 |
92 virtual void NotifyProfileError(sql::InitStatus init_status) override {} | 92 virtual void NotifyProfileError(sql::InitStatus init_status) override {} |
93 virtual void SetInMemoryBackend( | 93 virtual void SetInMemoryBackend( |
94 scoped_ptr<InMemoryHistoryBackend> backend) override; | 94 scoped_ptr<InMemoryHistoryBackend> backend) override; |
| 95 virtual void NotifyAddVisit(const BriefVisitInfo& info) override {} |
95 virtual void NotifyFaviconChanged(const std::set<GURL>& urls) override; | 96 virtual void NotifyFaviconChanged(const std::set<GURL>& urls) override; |
96 virtual void BroadcastNotifications( | 97 virtual void BroadcastNotifications( |
97 int type, | 98 int type, |
98 scoped_ptr<HistoryDetails> details) override; | 99 scoped_ptr<HistoryDetails> details) override; |
99 virtual void DBLoaded() override; | 100 virtual void DBLoaded() override; |
100 virtual void NotifyVisitDBObserversOnAddVisit( | |
101 const BriefVisitInfo& info) override {} | |
102 | 101 |
103 private: | 102 private: |
104 // Not owned by us. | 103 // Not owned by us. |
105 HistoryBackendTestBase* test_; | 104 HistoryBackendTestBase* test_; |
106 | 105 |
107 DISALLOW_COPY_AND_ASSIGN(HistoryBackendTestDelegate); | 106 DISALLOW_COPY_AND_ASSIGN(HistoryBackendTestDelegate); |
108 }; | 107 }; |
109 | 108 |
110 class HistoryBackendTestBase : public testing::Test { | 109 class HistoryBackendTestBase : public testing::Test { |
111 public: | 110 public: |
(...skipping 3103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3215 // Verify that the second term is no longer returned as result, and also check | 3214 // Verify that the second term is no longer returned as result, and also check |
3216 // at the low level that it is gone for good. The term corresponding to the | 3215 // at the low level that it is gone for good. The term corresponding to the |
3217 // first URLRow should not be affected. | 3216 // first URLRow should not be affected. |
3218 EXPECT_EQ(1u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term1)); | 3217 EXPECT_EQ(1u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term1)); |
3219 EXPECT_EQ(0u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term2)); | 3218 EXPECT_EQ(0u, GetNumberOfMatchingSearchTerms(kTestKeywordId, term2)); |
3220 EXPECT_TRUE(mem_backend_->db()->GetKeywordSearchTermRow(row1.id(), NULL)); | 3219 EXPECT_TRUE(mem_backend_->db()->GetKeywordSearchTermRow(row1.id(), NULL)); |
3221 EXPECT_FALSE(mem_backend_->db()->GetKeywordSearchTermRow(row2.id(), NULL)); | 3220 EXPECT_FALSE(mem_backend_->db()->GetKeywordSearchTermRow(row2.id(), NULL)); |
3222 } | 3221 } |
3223 | 3222 |
3224 } // namespace history | 3223 } // namespace history |
OLD | NEW |