OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/notifications/sync_notifier/sync_notifier_test_utils.h" | 5 #include "chrome/browser/notifications/sync_notifier/sync_notifier_test_utils.h" |
6 | 6 |
| 7 // Test data for App Info structures. |
| 8 const char kSendingService1Name[] = "TestService1"; |
| 9 const char kSendingService2Name[] = "TestService2"; |
| 10 const char kSendingService3Name[] = "TestService3"; |
| 11 const char kTestIconUrl[] = "https://www.google.com/someicon.png"; |
| 12 |
7 // Fake data for creating a SyncData object to use in creating a | 13 // Fake data for creating a SyncData object to use in creating a |
8 // SyncedNotification. | 14 // SyncedNotification. |
9 const char kAppId1[] = "fboilmbenheemaomgaeehigklolhkhnf"; | 15 const char kAppId1[] = "fboilmbenheemaomgaeehigklolhkhnf"; |
10 const char kAppId2[] = "fbcmoldooppoahjhfflnmljoanccekpf"; | 16 const char kAppId2[] = "fbcmoldooppoahjhfflnmljoanccekpf"; |
11 const char kAppId3[] = "fbcmoldooppoahjhfflnmljoanccek33"; | 17 const char kAppId3[] = "fbcmoldooppoahjhfflnmljoanccek33"; |
12 const char kAppId4[] = "fbcmoldooppoahjhfflnmljoanccek44"; | 18 const char kAppId4[] = "fbcmoldooppoahjhfflnmljoanccek44"; |
13 const char kAppId5[] = "fbcmoldooppoahjhfflnmljoanccek55"; | 19 const char kAppId5[] = "fbcmoldooppoahjhfflnmljoanccek55"; |
14 const char kAppId6[] = "fbcmoldooppoahjhfflnmljoanccek66"; | 20 const char kAppId6[] = "fbcmoldooppoahjhfflnmljoanccek66"; |
15 const char kAppId7[] = "fbcmoldooppoahjhfflnmljoanccek77"; | 21 const char kAppId7[] = "fbcmoldooppoahjhfflnmljoanccek77"; |
16 const char kKey1[] = "foo"; | 22 const char kKey1[] = "foo"; |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 action2->mutable_icon()->set_alt_text(kButtonTwoTitle); | 195 action2->mutable_icon()->set_alt_text(kButtonTwoTitle); |
190 action2->set_url(kButtonTwoUrl); | 196 action2->set_url(kButtonTwoUrl); |
191 | 197 |
192 syncer::SyncData sync_data = syncer::SyncData::CreateLocalData( | 198 syncer::SyncData sync_data = syncer::SyncData::CreateLocalData( |
193 "syncer::SYNCED_NOTIFICATIONS", | 199 "syncer::SYNCED_NOTIFICATIONS", |
194 "ChromeNotifierServiceUnitTest", | 200 "ChromeNotifierServiceUnitTest", |
195 entity_specifics); | 201 entity_specifics); |
196 | 202 |
197 return sync_data; | 203 return sync_data; |
198 } | 204 } |
| 205 |
| 206 namespace notifier { |
| 207 |
| 208 StubSyncedNotificationAppInfoService::StubSyncedNotificationAppInfoService( |
| 209 Profile* profile) : SyncedNotificationAppInfoService(profile) { |
| 210 on_bitmap_fetches_done_called_ = false; |
| 211 } |
| 212 |
| 213 StubSyncedNotificationAppInfoService::~StubSyncedNotificationAppInfoService() { |
| 214 } |
| 215 |
| 216 syncer::SyncMergeResult |
| 217 StubSyncedNotificationAppInfoService::MergeDataAndStartSyncing( |
| 218 syncer::ModelType type, |
| 219 const syncer::SyncDataList& initial_sync_data, |
| 220 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, |
| 221 scoped_ptr<syncer::SyncErrorFactory> error_handler) { |
| 222 return syncer::SyncMergeResult(syncer::SYNCED_NOTIFICATION_APP_INFO); |
| 223 } |
| 224 |
| 225 syncer::SyncError StubSyncedNotificationAppInfoService::ProcessSyncChanges( |
| 226 const tracked_objects::Location& from_here, |
| 227 const syncer::SyncChangeList& change_list) { |
| 228 return syncer::SyncError(); |
| 229 } |
| 230 |
| 231 syncer::SyncDataList StubSyncedNotificationAppInfoService::GetAllSyncData( |
| 232 syncer::ModelType type) const { |
| 233 return syncer::SyncDataList(); |
| 234 } |
| 235 |
| 236 void StubSyncedNotificationAppInfoService::OnBitmapFetchesDone( |
| 237 std::vector<std::string> added_app_ids, |
| 238 std::vector<std::string> removed_app_ids) { |
| 239 added_app_ids_ = added_app_ids; |
| 240 removed_app_ids_ = removed_app_ids; |
| 241 on_bitmap_fetches_done_called_ = true; |
| 242 } |
| 243 |
| 244 scoped_ptr<SyncedNotificationAppInfo> |
| 245 StubSyncedNotificationAppInfoService:: |
| 246 CreateSyncedNotificationAppInfoFromProtobuf( |
| 247 const sync_pb::SyncedNotificationAppInfo& app_info) { |
| 248 return scoped_ptr<SyncedNotificationAppInfo>(); |
| 249 } |
| 250 |
| 251 SyncedNotificationAppInfo* |
| 252 StubSyncedNotificationAppInfoService::FindSyncedNotificationAppInfoByName( |
| 253 const std::string& name) { |
| 254 return NULL; |
| 255 } |
| 256 |
| 257 SyncedNotificationAppInfo* |
| 258 StubSyncedNotificationAppInfoService::FindSyncedNotificationAppInfoByAppId( |
| 259 const std::string& app_id) { |
| 260 return NULL; |
| 261 } |
| 262 |
| 263 std::string |
| 264 StubSyncedNotificationAppInfoService::FindSendingServiceNameFromAppId( |
| 265 const std::string app_id) { |
| 266 return std::string(); |
| 267 } |
| 268 std::vector<std::string> |
| 269 StubSyncedNotificationAppInfoService::GetAllSendingServiceNames() { |
| 270 std::vector<std::string> empty; |
| 271 return empty; |
| 272 } |
| 273 |
| 274 |
| 275 // Probe functions to return data. |
| 276 std::vector<std::string> StubSyncedNotificationAppInfoService::added_app_ids() { |
| 277 return added_app_ids_; |
| 278 } |
| 279 |
| 280 std::vector<std::string> |
| 281 StubSyncedNotificationAppInfoService::removed_app_ids() { |
| 282 return removed_app_ids_; |
| 283 } |
| 284 bool StubSyncedNotificationAppInfoService::on_bitmap_fetches_done_called() { |
| 285 return on_bitmap_fetches_done_called_; |
| 286 } |
| 287 |
| 288 } // namespace notifier |
OLD | NEW |