OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/typed_url_syncable_service.h" | 5 #include "chrome/browser/history/typed_url_syncable_service.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 // Visits with this timestamp are treated as expired. | 34 // Visits with this timestamp are treated as expired. |
35 const int EXPIRED_VISIT = -1; | 35 const int EXPIRED_VISIT = -1; |
36 | 36 |
37 // TestHistoryBackend ---------------------------------------------------------- | 37 // TestHistoryBackend ---------------------------------------------------------- |
38 | 38 |
39 class TestHistoryBackend : public HistoryBackend { | 39 class TestHistoryBackend : public HistoryBackend { |
40 public: | 40 public: |
41 TestHistoryBackend() : HistoryBackend(base::FilePath(), NULL, NULL) {} | 41 TestHistoryBackend() : HistoryBackend(base::FilePath(), NULL, NULL) {} |
42 | 42 |
43 // HistoryBackend test implementation. | 43 // HistoryBackend test implementation. |
44 virtual bool IsExpiredVisitTime(const base::Time& time) OVERRIDE { | 44 virtual bool IsExpiredVisitTime(const base::Time& time) override { |
45 return time.ToInternalValue() == EXPIRED_VISIT; | 45 return time.ToInternalValue() == EXPIRED_VISIT; |
46 } | 46 } |
47 | 47 |
48 virtual bool GetMostRecentVisitsForURL( | 48 virtual bool GetMostRecentVisitsForURL( |
49 URLID id, | 49 URLID id, |
50 int max_visits, | 50 int max_visits, |
51 VisitVector* visits) OVERRIDE { | 51 VisitVector* visits) override { |
52 if (local_db_visits_[id].empty()) | 52 if (local_db_visits_[id].empty()) |
53 return false; | 53 return false; |
54 | 54 |
55 visits->insert(visits->end(), | 55 visits->insert(visits->end(), |
56 local_db_visits_[id].begin(), | 56 local_db_visits_[id].begin(), |
57 local_db_visits_[id].end()); | 57 local_db_visits_[id].end()); |
58 return true; | 58 return true; |
59 } | 59 } |
60 | 60 |
61 // Helpers. | 61 // Helpers. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 unsigned int num_reload_urls, | 122 unsigned int num_reload_urls, |
123 URLRows* rows, | 123 URLRows* rows, |
124 std::vector<VisitVector>* visit_vectors, | 124 std::vector<VisitVector>* visit_vectors, |
125 const std::vector<const char*>& urls); | 125 const std::vector<const char*>& urls); |
126 | 126 |
127 protected: | 127 protected: |
128 TypedUrlSyncableServiceTest() {} | 128 TypedUrlSyncableServiceTest() {} |
129 | 129 |
130 virtual ~TypedUrlSyncableServiceTest() {} | 130 virtual ~TypedUrlSyncableServiceTest() {} |
131 | 131 |
132 virtual void SetUp() OVERRIDE { | 132 virtual void SetUp() override { |
133 fake_history_backend_ = new TestHistoryBackend(); | 133 fake_history_backend_ = new TestHistoryBackend(); |
134 typed_url_sync_service_.reset( | 134 typed_url_sync_service_.reset( |
135 new TypedUrlSyncableService(fake_history_backend_.get())); | 135 new TypedUrlSyncableService(fake_history_backend_.get())); |
136 fake_change_processor_.reset(new syncer::FakeSyncChangeProcessor); | 136 fake_change_processor_.reset(new syncer::FakeSyncChangeProcessor); |
137 } | 137 } |
138 | 138 |
139 scoped_refptr<HistoryBackend> fake_history_backend_; | 139 scoped_refptr<HistoryBackend> fake_history_backend_; |
140 scoped_ptr<TypedUrlSyncableService> typed_url_sync_service_; | 140 scoped_ptr<TypedUrlSyncableService> typed_url_sync_service_; |
141 scoped_ptr<syncer::FakeSyncChangeProcessor> fake_change_processor_; | 141 scoped_ptr<syncer::FakeSyncChangeProcessor> fake_change_processor_; |
142 }; | 142 }; |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 | 603 |
604 // Should throttle, so sync and local cache should not update. | 604 // Should throttle, so sync and local cache should not update. |
605 const syncer::SyncChangeList& changes = fake_change_processor_->changes(); | 605 const syncer::SyncChangeList& changes = fake_change_processor_->changes(); |
606 ASSERT_EQ(0u, changes.size()); | 606 ASSERT_EQ(0u, changes.size()); |
607 std::set<GURL> sync_state; | 607 std::set<GURL> sync_state; |
608 typed_url_sync_service_.get()->GetSyncedUrls(&sync_state); | 608 typed_url_sync_service_.get()->GetSyncedUrls(&sync_state); |
609 EXPECT_TRUE(sync_state.empty()); | 609 EXPECT_TRUE(sync_state.empty()); |
610 } | 610 } |
611 | 611 |
612 } // namespace history | 612 } // namespace history |
OLD | NEW |