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/sync/glue/favicon_cache.h" | 5 #include "chrome/browser/sync/glue/favicon_cache.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 class TestChangeProcessor : public syncer::SyncChangeProcessor { | 34 class TestChangeProcessor : public syncer::SyncChangeProcessor { |
35 public: | 35 public: |
36 TestChangeProcessor(); | 36 TestChangeProcessor(); |
37 virtual ~TestChangeProcessor(); | 37 virtual ~TestChangeProcessor(); |
38 | 38 |
39 // Store a copy of all the changes passed in so we can examine them later. | 39 // Store a copy of all the changes passed in so we can examine them later. |
40 virtual syncer::SyncError ProcessSyncChanges( | 40 virtual syncer::SyncError ProcessSyncChanges( |
41 const tracked_objects::Location& from_here, | 41 const tracked_objects::Location& from_here, |
42 const syncer::SyncChangeList& change_list) OVERRIDE; | 42 const syncer::SyncChangeList& change_list) OVERRIDE; |
43 | 43 |
| 44 virtual syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const |
| 45 OVERRIDE { |
| 46 return syncer::SyncDataList(); |
| 47 } |
| 48 |
44 bool contains_guid(const std::string& guid) const { | 49 bool contains_guid(const std::string& guid) const { |
45 return change_map_.count(guid) != 0; | 50 return change_map_.count(guid) != 0; |
46 } | 51 } |
47 | 52 |
48 syncer::SyncChange change_for_guid(const std::string& guid) const { | 53 syncer::SyncChange change_for_guid(const std::string& guid) const { |
49 DCHECK(contains_guid(guid)); | 54 DCHECK(contains_guid(guid)); |
50 return change_map_.find(guid)->second; | 55 return change_map_.find(guid)->second; |
51 } | 56 } |
52 | 57 |
53 // Returns the last change list received, and resets the internal list. | 58 // Returns the last change list received, and resets the internal list. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 class SyncChangeProcessorDelegate : public syncer::SyncChangeProcessor { | 107 class SyncChangeProcessorDelegate : public syncer::SyncChangeProcessor { |
103 public: | 108 public: |
104 explicit SyncChangeProcessorDelegate(syncer::SyncChangeProcessor* recipient); | 109 explicit SyncChangeProcessorDelegate(syncer::SyncChangeProcessor* recipient); |
105 virtual ~SyncChangeProcessorDelegate(); | 110 virtual ~SyncChangeProcessorDelegate(); |
106 | 111 |
107 // syncer::SyncChangeProcessor implementation. | 112 // syncer::SyncChangeProcessor implementation. |
108 virtual syncer::SyncError ProcessSyncChanges( | 113 virtual syncer::SyncError ProcessSyncChanges( |
109 const tracked_objects::Location& from_here, | 114 const tracked_objects::Location& from_here, |
110 const syncer::SyncChangeList& change_list) OVERRIDE; | 115 const syncer::SyncChangeList& change_list) OVERRIDE; |
111 | 116 |
| 117 virtual syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const |
| 118 OVERRIDE { |
| 119 return recipient_->GetAllSyncData(type); |
| 120 } |
| 121 |
112 private: | 122 private: |
113 // The recipient of all sync changes. | 123 // The recipient of all sync changes. |
114 syncer::SyncChangeProcessor* recipient_; | 124 syncer::SyncChangeProcessor* recipient_; |
115 | 125 |
116 DISALLOW_COPY_AND_ASSIGN(SyncChangeProcessorDelegate); | 126 DISALLOW_COPY_AND_ASSIGN(SyncChangeProcessorDelegate); |
117 }; | 127 }; |
118 | 128 |
119 SyncChangeProcessorDelegate::SyncChangeProcessorDelegate( | 129 SyncChangeProcessorDelegate::SyncChangeProcessorDelegate( |
120 syncer::SyncChangeProcessor* recipient) | 130 syncer::SyncChangeProcessor* recipient) |
121 : recipient_(recipient) { | 131 : recipient_(recipient) { |
(...skipping 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1700 changes[0].sync_data().GetSpecifics().favicon_tracking(). | 1710 changes[0].sync_data().GetSpecifics().favicon_tracking(). |
1701 favicon_url()); | 1711 favicon_url()); |
1702 EXPECT_NE(changes[0].sync_data().GetSpecifics().favicon_tracking(). | 1712 EXPECT_NE(changes[0].sync_data().GetSpecifics().favicon_tracking(). |
1703 last_visit_time_ms(), 0); | 1713 last_visit_time_ms(), 0); |
1704 } | 1714 } |
1705 EXPECT_EQ(0U, GetTaskCount()); | 1715 EXPECT_EQ(0U, GetTaskCount()); |
1706 EXPECT_EQ((unsigned long)kFaviconBatchSize, GetFaviconCount()); | 1716 EXPECT_EQ((unsigned long)kFaviconBatchSize, GetFaviconCount()); |
1707 } | 1717 } |
1708 | 1718 |
1709 } // namespace browser_sync | 1719 } // namespace browser_sync |
OLD | NEW |