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 OVERRIDE { |
| 159 return syncer::SyncDataList(); |
| 160 } |
| 161 |
157 size_t change_list_size() { return change_map_.size(); } | 162 size_t change_list_size() { return change_map_.size(); } |
158 | 163 |
159 bool ContainsId(const std::string& id) { | 164 bool ContainsId(const std::string& id) { |
160 return change_map_.find(id) != change_map_.end(); | 165 return change_map_.find(id) != change_map_.end(); |
161 } | 166 } |
162 | 167 |
163 SyncChange GetChangeById(const std::string& id) { | 168 SyncChange GetChangeById(const std::string& id) { |
164 EXPECT_TRUE(ContainsId(id)); | 169 EXPECT_TRUE(ContainsId(id)); |
165 return change_map_[id]; | 170 return change_map_[id]; |
166 } | 171 } |
(...skipping 13 matching lines...) Expand all Loading... |
180 } | 185 } |
181 virtual ~SyncChangeProcessorDelegate() {} | 186 virtual ~SyncChangeProcessorDelegate() {} |
182 | 187 |
183 // syncer::SyncChangeProcessor implementation. | 188 // syncer::SyncChangeProcessor implementation. |
184 virtual syncer::SyncError ProcessSyncChanges( | 189 virtual syncer::SyncError ProcessSyncChanges( |
185 const tracked_objects::Location& from_here, | 190 const tracked_objects::Location& from_here, |
186 const SyncChangeList& change_list) OVERRIDE { | 191 const SyncChangeList& change_list) OVERRIDE { |
187 return recipient_->ProcessSyncChanges(from_here, change_list); | 192 return recipient_->ProcessSyncChanges(from_here, change_list); |
188 } | 193 } |
189 | 194 |
| 195 virtual syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const |
| 196 OVERRIDE { |
| 197 return recipient_->GetAllSyncData(type); |
| 198 } |
| 199 |
190 private: | 200 private: |
191 // The recipient of all sync changes. | 201 // The recipient of all sync changes. |
192 SyncChangeProcessor* recipient_; | 202 SyncChangeProcessor* recipient_; |
193 | 203 |
194 DISALLOW_COPY_AND_ASSIGN(SyncChangeProcessorDelegate); | 204 DISALLOW_COPY_AND_ASSIGN(SyncChangeProcessorDelegate); |
195 }; | 205 }; |
196 | 206 |
197 class ChromeNotifierServiceTest : public testing::Test { | 207 class ChromeNotifierServiceTest : public testing::Test { |
198 public: | 208 public: |
199 ChromeNotifierServiceTest() | 209 ChromeNotifierServiceTest() |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 notifier.OnSyncedNotificationServiceEnabled(kTestNotificationProvider, false); | 635 notifier.OnSyncedNotificationServiceEnabled(kTestNotificationProvider, false); |
626 iter = find(notifier.enabled_sending_services_.begin(), | 636 iter = find(notifier.enabled_sending_services_.begin(), |
627 notifier.enabled_sending_services_.end(), | 637 notifier.enabled_sending_services_.end(), |
628 kTestNotificationProvider); | 638 kTestNotificationProvider); |
629 EXPECT_EQ(notifier.enabled_sending_services_.end(), iter); | 639 EXPECT_EQ(notifier.enabled_sending_services_.end(), iter); |
630 EXPECT_EQ(notification_manager.dismissed_id(), std::string(kKey1)); | 640 EXPECT_EQ(notification_manager.dismissed_id(), std::string(kKey1)); |
631 | 641 |
632 } | 642 } |
633 | 643 |
634 } // namespace notifier | 644 } // namespace notifier |
OLD | NEW |