Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(584)

Side by Side Diff: chrome/browser/extensions/api/storage/settings_sync_unittest.cc

Issue 23129007: sync: Add GetAllSyncData to sync/api (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/files/scoped_temp_dir.h" 6 #include "base/files/scoped_temp_dir.h"
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 "MockSyncChangeProcessor: configured to fail", 101 "MockSyncChangeProcessor: configured to fail",
102 change_list[0].sync_data().GetDataType()); 102 change_list[0].sync_data().GetDataType());
103 } 103 }
104 for (syncer::SyncChangeList::const_iterator it = change_list.begin(); 104 for (syncer::SyncChangeList::const_iterator it = change_list.begin();
105 it != change_list.end(); ++it) { 105 it != change_list.end(); ++it) {
106 changes_.push_back(SettingSyncData(*it)); 106 changes_.push_back(SettingSyncData(*it));
107 } 107 }
108 return syncer::SyncError(); 108 return syncer::SyncError();
109 } 109 }
110 110
111 virtual syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const {
112 return syncer::SyncDataList();
113 }
114
111 // Mock methods. 115 // Mock methods.
112 116
113 const SettingSyncDataList& changes() { return changes_; } 117 const SettingSyncDataList& changes() { return changes_; }
114 118
115 void ClearChanges() { 119 void ClearChanges() {
116 changes_.clear(); 120 changes_.clear();
117 } 121 }
118 122
119 void SetFailAllRequests(bool fail_all_requests) { 123 void SetFailAllRequests(bool fail_all_requests) {
120 fail_all_requests_ = fail_all_requests; 124 fail_all_requests_ = fail_all_requests;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 163 }
160 virtual ~SyncChangeProcessorDelegate() {} 164 virtual ~SyncChangeProcessorDelegate() {}
161 165
162 // syncer::SyncChangeProcessor implementation. 166 // syncer::SyncChangeProcessor implementation.
163 virtual syncer::SyncError ProcessSyncChanges( 167 virtual syncer::SyncError ProcessSyncChanges(
164 const tracked_objects::Location& from_here, 168 const tracked_objects::Location& from_here,
165 const syncer::SyncChangeList& change_list) OVERRIDE { 169 const syncer::SyncChangeList& change_list) OVERRIDE {
166 return recipient_->ProcessSyncChanges(from_here, change_list); 170 return recipient_->ProcessSyncChanges(from_here, change_list);
167 } 171 }
168 172
173 virtual syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const {
174 return recipient_->GetAllSyncData(type);
175 }
176
169 private: 177 private:
170 // The recipient of all sync changes. 178 // The recipient of all sync changes.
171 syncer::SyncChangeProcessor* recipient_; 179 syncer::SyncChangeProcessor* recipient_;
172 180
173 DISALLOW_COPY_AND_ASSIGN(SyncChangeProcessorDelegate); 181 DISALLOW_COPY_AND_ASSIGN(SyncChangeProcessorDelegate);
174 }; 182 };
175 183
176 // SettingsStorageFactory which always returns TestingValueStore objects, 184 // SettingsStorageFactory which always returns TestingValueStore objects,
177 // and allows individually created objects to be returned. 185 // and allows individually created objects to be returned.
178 class TestingValueStoreFactory : public SettingsStorageFactory { 186 class TestingValueStoreFactory : public SettingsStorageFactory {
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1422 ASSERT_EQ(1u, sync_processor_->changes().size()); 1430 ASSERT_EQ(1u, sync_processor_->changes().size());
1423 SettingSyncData sync_data = sync_processor_->changes()[0]; 1431 SettingSyncData sync_data = sync_processor_->changes()[0];
1424 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, sync_data.change_type()); 1432 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, sync_data.change_type());
1425 EXPECT_EQ("ext", sync_data.extension_id()); 1433 EXPECT_EQ("ext", sync_data.extension_id());
1426 EXPECT_EQ("key.with.spot", sync_data.key()); 1434 EXPECT_EQ("key.with.spot", sync_data.key());
1427 EXPECT_TRUE(sync_data.value().Equals(string_value.get())); 1435 EXPECT_TRUE(sync_data.value().Equals(string_value.get()));
1428 } 1436 }
1429 } 1437 }
1430 1438
1431 } // namespace extensions 1439 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698