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

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: review comments Created 7 years, 3 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 OVERRIDE {
113 return syncer::SyncDataList();
114 }
115
111 // Mock methods. 116 // Mock methods.
112 117
113 const SettingSyncDataList& changes() { return changes_; } 118 const SettingSyncDataList& changes() { return changes_; }
114 119
115 void ClearChanges() { 120 void ClearChanges() {
116 changes_.clear(); 121 changes_.clear();
117 } 122 }
118 123
119 void SetFailAllRequests(bool fail_all_requests) { 124 void SetFailAllRequests(bool fail_all_requests) {
120 fail_all_requests_ = fail_all_requests; 125 fail_all_requests_ = fail_all_requests;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 164 }
160 virtual ~SyncChangeProcessorDelegate() {} 165 virtual ~SyncChangeProcessorDelegate() {}
161 166
162 // syncer::SyncChangeProcessor implementation. 167 // syncer::SyncChangeProcessor implementation.
163 virtual syncer::SyncError ProcessSyncChanges( 168 virtual syncer::SyncError ProcessSyncChanges(
164 const tracked_objects::Location& from_here, 169 const tracked_objects::Location& from_here,
165 const syncer::SyncChangeList& change_list) OVERRIDE { 170 const syncer::SyncChangeList& change_list) OVERRIDE {
166 return recipient_->ProcessSyncChanges(from_here, change_list); 171 return recipient_->ProcessSyncChanges(from_here, change_list);
167 } 172 }
168 173
174 virtual syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const
175 OVERRIDE {
176 return recipient_->GetAllSyncData(type);
177 }
178
169 private: 179 private:
170 // The recipient of all sync changes. 180 // The recipient of all sync changes.
171 syncer::SyncChangeProcessor* recipient_; 181 syncer::SyncChangeProcessor* recipient_;
172 182
173 DISALLOW_COPY_AND_ASSIGN(SyncChangeProcessorDelegate); 183 DISALLOW_COPY_AND_ASSIGN(SyncChangeProcessorDelegate);
174 }; 184 };
175 185
176 // SettingsStorageFactory which always returns TestingValueStore objects, 186 // SettingsStorageFactory which always returns TestingValueStore objects,
177 // and allows individually created objects to be returned. 187 // and allows individually created objects to be returned.
178 class TestingValueStoreFactory : public SettingsStorageFactory { 188 class TestingValueStoreFactory : public SettingsStorageFactory {
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1422 ASSERT_EQ(1u, sync_processor_->changes().size()); 1432 ASSERT_EQ(1u, sync_processor_->changes().size());
1423 SettingSyncData sync_data = sync_processor_->changes()[0]; 1433 SettingSyncData sync_data = sync_processor_->changes()[0];
1424 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, sync_data.change_type()); 1434 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, sync_data.change_type());
1425 EXPECT_EQ("ext", sync_data.extension_id()); 1435 EXPECT_EQ("ext", sync_data.extension_id());
1426 EXPECT_EQ("key.with.spot", sync_data.key()); 1436 EXPECT_EQ("key.with.spot", sync_data.key());
1427 EXPECT_TRUE(sync_data.value().Equals(string_value.get())); 1437 EXPECT_TRUE(sync_data.value().Equals(string_value.get()));
1428 } 1438 }
1429 } 1439 }
1430 1440
1431 } // namespace extensions 1441 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/storage/settings_apitest.cc ('k') | chrome/browser/extensions/extension_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698