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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "chrome/browser/extensions/app_notification.h" | 9 #include "chrome/browser/extensions/app_notification.h" |
10 #include "chrome/browser/extensions/app_notification_manager.h" | 10 #include "chrome/browser/extensions/app_notification_manager.h" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 return AppNotificationManager::CreateSyncDataFromNotification(*notif); | 199 return AppNotificationManager::CreateSyncDataFromNotification(*notif); |
200 } | 200 } |
201 | 201 |
202 // Helper to create syncer::SyncChange. Takes ownership of |notif|. | 202 // Helper to create syncer::SyncChange. Takes ownership of |notif|. |
203 static syncer::SyncChange CreateSyncChange( | 203 static syncer::SyncChange CreateSyncChange( |
204 syncer::SyncChange::SyncChangeType type, | 204 syncer::SyncChange::SyncChangeType type, |
205 AppNotification* notif) { | 205 AppNotification* notif) { |
206 // Take control of notif to clean it up after we create data out of it. | 206 // Take control of notif to clean it up after we create data out of it. |
207 scoped_ptr<AppNotification> scoped_notif(notif); | 207 scoped_ptr<AppNotification> scoped_notif(notif); |
208 return syncer::SyncChange( | 208 return syncer::SyncChange( |
209 type, AppNotificationManager::CreateSyncDataFromNotification(*notif)); | 209 FROM_HERE, |
| 210 type, |
| 211 AppNotificationManager::CreateSyncDataFromNotification(*notif)); |
210 } | 212 } |
211 | 213 |
212 void AssertSyncChange(const syncer::SyncChange& change, | 214 void AssertSyncChange(const syncer::SyncChange& change, |
213 syncer::SyncChange::SyncChangeType type, | 215 syncer::SyncChange::SyncChangeType type, |
214 const AppNotification& notif) { | 216 const AppNotification& notif) { |
215 ASSERT_EQ(type, change.change_type()); | 217 ASSERT_EQ(type, change.change_type()); |
216 scoped_ptr<AppNotification> notif2( | 218 scoped_ptr<AppNotification> notif2( |
217 AppNotificationManager::CreateNotificationFromSyncData( | 219 AppNotificationManager::CreateNotificationFromSyncData( |
218 change.sync_data())); | 220 change.sync_data())); |
219 ASSERT_TRUE(notif.Equals(*notif2)); | 221 ASSERT_TRUE(notif.Equals(*notif2)); |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 | 742 |
741 EXPECT_EQ(3U, processor()->change_list_size()); | 743 EXPECT_EQ(3U, processor()->change_list_size()); |
742 EXPECT_TRUE(processor()->ContainsGuid(n1->guid())); | 744 EXPECT_TRUE(processor()->ContainsGuid(n1->guid())); |
743 syncer::SyncChange c1 = processor()->GetChangeByGuid(n1->guid()); | 745 syncer::SyncChange c1 = processor()->GetChangeByGuid(n1->guid()); |
744 AssertSyncChange(c1, syncer::SyncChange::ACTION_DELETE, *n1); | 746 AssertSyncChange(c1, syncer::SyncChange::ACTION_DELETE, *n1); |
745 syncer::SyncChange c2 = processor()->GetChangeByGuid(n2->guid()); | 747 syncer::SyncChange c2 = processor()->GetChangeByGuid(n2->guid()); |
746 AssertSyncChange(c2, syncer::SyncChange::ACTION_DELETE, *n2); | 748 AssertSyncChange(c2, syncer::SyncChange::ACTION_DELETE, *n2); |
747 syncer::SyncChange c3 = processor()->GetChangeByGuid(n3->guid()); | 749 syncer::SyncChange c3 = processor()->GetChangeByGuid(n3->guid()); |
748 AssertSyncChange(c3, syncer::SyncChange::ACTION_DELETE, *n3); | 750 AssertSyncChange(c3, syncer::SyncChange::ACTION_DELETE, *n3); |
749 } | 751 } |
OLD | NEW |