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 <map> | 5 #include <map> |
6 | 6 |
7 #include "base/gtest_prod_util.h" | 7 #include "base/gtest_prod_util.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 change_map_.clear(); | 147 change_map_.clear(); |
148 for (SyncChangeList::const_iterator iter = change_list.begin(); | 148 for (SyncChangeList::const_iterator iter = change_list.begin(); |
149 iter != change_list.end(); ++iter) { | 149 iter != change_list.end(); ++iter) { |
150 // Put the data into the change tracking map. | 150 // Put the data into the change tracking map. |
151 change_map_[GetNotificationId(iter->sync_data())] = *iter; | 151 change_map_[GetNotificationId(iter->sync_data())] = *iter; |
152 } | 152 } |
153 | 153 |
154 return syncer::SyncError(); | 154 return syncer::SyncError(); |
155 } | 155 } |
156 | 156 |
| 157 virtual syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const { |
| 158 return syncer::SyncDataList(); |
| 159 } |
| 160 |
157 size_t change_list_size() { return change_map_.size(); } | 161 size_t change_list_size() { return change_map_.size(); } |
158 | 162 |
159 bool ContainsId(const std::string& id) { | 163 bool ContainsId(const std::string& id) { |
160 return change_map_.find(id) != change_map_.end(); | 164 return change_map_.find(id) != change_map_.end(); |
161 } | 165 } |
162 | 166 |
163 SyncChange GetChangeById(const std::string& id) { | 167 SyncChange GetChangeById(const std::string& id) { |
164 EXPECT_TRUE(ContainsId(id)); | 168 EXPECT_TRUE(ContainsId(id)); |
165 return change_map_[id]; | 169 return change_map_[id]; |
166 } | 170 } |
(...skipping 13 matching lines...) Expand all Loading... |
180 } | 184 } |
181 virtual ~SyncChangeProcessorDelegate() {} | 185 virtual ~SyncChangeProcessorDelegate() {} |
182 | 186 |
183 // syncer::SyncChangeProcessor implementation. | 187 // syncer::SyncChangeProcessor implementation. |
184 virtual syncer::SyncError ProcessSyncChanges( | 188 virtual syncer::SyncError ProcessSyncChanges( |
185 const tracked_objects::Location& from_here, | 189 const tracked_objects::Location& from_here, |
186 const SyncChangeList& change_list) OVERRIDE { | 190 const SyncChangeList& change_list) OVERRIDE { |
187 return recipient_->ProcessSyncChanges(from_here, change_list); | 191 return recipient_->ProcessSyncChanges(from_here, change_list); |
188 } | 192 } |
189 | 193 |
| 194 virtual syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const { |
| 195 return recipient_->GetAllSyncData(type); |
| 196 } |
| 197 |
190 private: | 198 private: |
191 // The recipient of all sync changes. | 199 // The recipient of all sync changes. |
192 SyncChangeProcessor* recipient_; | 200 SyncChangeProcessor* recipient_; |
193 | 201 |
194 DISALLOW_COPY_AND_ASSIGN(SyncChangeProcessorDelegate); | 202 DISALLOW_COPY_AND_ASSIGN(SyncChangeProcessorDelegate); |
195 }; | 203 }; |
196 | 204 |
197 class ChromeNotifierServiceTest : public testing::Test { | 205 class ChromeNotifierServiceTest : public testing::Test { |
198 public: | 206 public: |
199 ChromeNotifierServiceTest() | 207 ChromeNotifierServiceTest() |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 notifier.OnSyncedNotificationServiceEnabled(kTestNotificationProvider, false); | 633 notifier.OnSyncedNotificationServiceEnabled(kTestNotificationProvider, false); |
626 iter = find(notifier.enabled_sending_services_.begin(), | 634 iter = find(notifier.enabled_sending_services_.begin(), |
627 notifier.enabled_sending_services_.end(), | 635 notifier.enabled_sending_services_.end(), |
628 kTestNotificationProvider); | 636 kTestNotificationProvider); |
629 EXPECT_EQ(notifier.enabled_sending_services_.end(), iter); | 637 EXPECT_EQ(notifier.enabled_sending_services_.end(), iter); |
630 EXPECT_EQ(notification_manager.dismissed_id(), std::string(kKey1)); | 638 EXPECT_EQ(notification_manager.dismissed_id(), std::string(kKey1)); |
631 | 639 |
632 } | 640 } |
633 | 641 |
634 } // namespace notifier | 642 } // namespace notifier |
OLD | NEW |