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 return syncer::SyncDataList(); |
| 46 } |
| 47 |
44 bool contains_guid(const std::string& guid) const { | 48 bool contains_guid(const std::string& guid) const { |
45 return change_map_.count(guid) != 0; | 49 return change_map_.count(guid) != 0; |
46 } | 50 } |
47 | 51 |
48 syncer::SyncChange change_for_guid(const std::string& guid) const { | 52 syncer::SyncChange change_for_guid(const std::string& guid) const { |
49 DCHECK(contains_guid(guid)); | 53 DCHECK(contains_guid(guid)); |
50 return change_map_.find(guid)->second; | 54 return change_map_.find(guid)->second; |
51 } | 55 } |
52 | 56 |
53 // Returns the last change list received, and resets the internal list. | 57 // 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 { | 106 class SyncChangeProcessorDelegate : public syncer::SyncChangeProcessor { |
103 public: | 107 public: |
104 explicit SyncChangeProcessorDelegate(syncer::SyncChangeProcessor* recipient); | 108 explicit SyncChangeProcessorDelegate(syncer::SyncChangeProcessor* recipient); |
105 virtual ~SyncChangeProcessorDelegate(); | 109 virtual ~SyncChangeProcessorDelegate(); |
106 | 110 |
107 // syncer::SyncChangeProcessor implementation. | 111 // syncer::SyncChangeProcessor implementation. |
108 virtual syncer::SyncError ProcessSyncChanges( | 112 virtual syncer::SyncError ProcessSyncChanges( |
109 const tracked_objects::Location& from_here, | 113 const tracked_objects::Location& from_here, |
110 const syncer::SyncChangeList& change_list) OVERRIDE; | 114 const syncer::SyncChangeList& change_list) OVERRIDE; |
111 | 115 |
| 116 virtual syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const { |
| 117 return recipient_->GetAllSyncData(type); |
| 118 } |
| 119 |
112 private: | 120 private: |
113 // The recipient of all sync changes. | 121 // The recipient of all sync changes. |
114 syncer::SyncChangeProcessor* recipient_; | 122 syncer::SyncChangeProcessor* recipient_; |
115 | 123 |
116 DISALLOW_COPY_AND_ASSIGN(SyncChangeProcessorDelegate); | 124 DISALLOW_COPY_AND_ASSIGN(SyncChangeProcessorDelegate); |
117 }; | 125 }; |
118 | 126 |
119 SyncChangeProcessorDelegate::SyncChangeProcessorDelegate( | 127 SyncChangeProcessorDelegate::SyncChangeProcessorDelegate( |
120 syncer::SyncChangeProcessor* recipient) | 128 syncer::SyncChangeProcessor* recipient) |
121 : recipient_(recipient) { | 129 : recipient_(recipient) { |
(...skipping 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1700 changes[0].sync_data().GetSpecifics().favicon_tracking(). | 1708 changes[0].sync_data().GetSpecifics().favicon_tracking(). |
1701 favicon_url()); | 1709 favicon_url()); |
1702 EXPECT_NE(changes[0].sync_data().GetSpecifics().favicon_tracking(). | 1710 EXPECT_NE(changes[0].sync_data().GetSpecifics().favicon_tracking(). |
1703 last_visit_time_ms(), 0); | 1711 last_visit_time_ms(), 0); |
1704 } | 1712 } |
1705 EXPECT_EQ(0U, GetTaskCount()); | 1713 EXPECT_EQ(0U, GetTaskCount()); |
1706 EXPECT_EQ((unsigned long)kFaviconBatchSize, GetFaviconCount()); | 1714 EXPECT_EQ((unsigned long)kFaviconBatchSize, GetFaviconCount()); |
1707 } | 1715 } |
1708 | 1716 |
1709 } // namespace browser_sync | 1717 } // namespace browser_sync |
OLD | NEW |