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 19 matching lines...) Expand all Loading... |
30 // Dummy SyncChangeProcessor used to help review what SyncChanges are pushed | 30 // Dummy SyncChangeProcessor used to help review what SyncChanges are pushed |
31 // back up to Sync. | 31 // back up to Sync. |
32 class TestChangeProcessor : public syncer::SyncChangeProcessor { | 32 class TestChangeProcessor : public syncer::SyncChangeProcessor { |
33 public: | 33 public: |
34 TestChangeProcessor() { } | 34 TestChangeProcessor() { } |
35 virtual ~TestChangeProcessor() { } | 35 virtual ~TestChangeProcessor() { } |
36 | 36 |
37 // Store a copy of all the changes passed in so we can examine them later. | 37 // Store a copy of all the changes passed in so we can examine them later. |
38 virtual syncer::SyncError ProcessSyncChanges( | 38 virtual syncer::SyncError ProcessSyncChanges( |
39 const tracked_objects::Location& from_here, | 39 const tracked_objects::Location& from_here, |
40 const syncer::SyncChangeList& change_list) { | 40 const syncer::SyncChangeList& change_list) OVERRIDE { |
41 // change_map_.erase(change_map_.begin(), change_map_.end()); | 41 // change_map_.erase(change_map_.begin(), change_map_.end()); |
42 for (syncer::SyncChangeList::const_iterator iter = change_list.begin(); | 42 for (syncer::SyncChangeList::const_iterator iter = change_list.begin(); |
43 iter != change_list.end(); ++iter) { | 43 iter != change_list.end(); ++iter) { |
44 change_map_[GetGuid(iter->sync_data())] = *iter; | 44 change_map_[GetGuid(iter->sync_data())] = *iter; |
45 } | 45 } |
46 | 46 |
47 return syncer::SyncError(); | 47 return syncer::SyncError(); |
48 } | 48 } |
49 | 49 |
50 bool ContainsGuid(const std::string& guid) { | 50 bool ContainsGuid(const std::string& guid) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 93 |
94 class AppNotificationManagerSyncTest : public testing::Test { | 94 class AppNotificationManagerSyncTest : public testing::Test { |
95 public: | 95 public: |
96 AppNotificationManagerSyncTest() | 96 AppNotificationManagerSyncTest() |
97 : ui_thread_(BrowserThread::UI, &ui_loop_), | 97 : ui_thread_(BrowserThread::UI, &ui_loop_), |
98 file_thread_(BrowserThread::FILE), | 98 file_thread_(BrowserThread::FILE), |
99 sync_processor_(new TestChangeProcessor), | 99 sync_processor_(new TestChangeProcessor), |
100 sync_processor_delegate_(new SyncChangeProcessorDelegate( | 100 sync_processor_delegate_(new SyncChangeProcessorDelegate( |
101 sync_processor_.get())) {} | 101 sync_processor_.get())) {} |
102 | 102 |
103 ~AppNotificationManagerSyncTest() { | 103 virtual ~AppNotificationManagerSyncTest() { |
104 model_ = NULL; | 104 model_ = NULL; |
105 } | 105 } |
106 | 106 |
107 virtual void SetUp() { | 107 virtual void SetUp() { |
108 ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 108 ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
109 file_thread_.Start(); | 109 file_thread_.Start(); |
110 | 110 |
111 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 111 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
112 profile_.reset(new TestingProfile(temp_dir_.path())); | 112 profile_.reset(new TestingProfile(temp_dir_.path())); |
113 model_ = new AppNotificationManager(profile_.get()); | 113 model_ = new AppNotificationManager(profile_.get()); |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 EXPECT_TRUE(processor()->ContainsGuid(n1->guid())); | 750 EXPECT_TRUE(processor()->ContainsGuid(n1->guid())); |
751 syncer::SyncChange c1 = processor()->GetChangeByGuid(n1->guid()); | 751 syncer::SyncChange c1 = processor()->GetChangeByGuid(n1->guid()); |
752 AssertSyncChange(c1, syncer::SyncChange::ACTION_DELETE, *n1); | 752 AssertSyncChange(c1, syncer::SyncChange::ACTION_DELETE, *n1); |
753 syncer::SyncChange c2 = processor()->GetChangeByGuid(n2->guid()); | 753 syncer::SyncChange c2 = processor()->GetChangeByGuid(n2->guid()); |
754 AssertSyncChange(c2, syncer::SyncChange::ACTION_DELETE, *n2); | 754 AssertSyncChange(c2, syncer::SyncChange::ACTION_DELETE, *n2); |
755 syncer::SyncChange c3 = processor()->GetChangeByGuid(n3->guid()); | 755 syncer::SyncChange c3 = processor()->GetChangeByGuid(n3->guid()); |
756 AssertSyncChange(c3, syncer::SyncChange::ACTION_DELETE, *n3); | 756 AssertSyncChange(c3, syncer::SyncChange::ACTION_DELETE, *n3); |
757 } | 757 } |
758 | 758 |
759 } // namespace extensions | 759 } // namespace extensions |
OLD | NEW |