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

Side by Side Diff: chrome/browser/search_engines/template_url_service_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/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "base/memory/scoped_vector.h" 6 #include "base/memory/scoped_vector.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 class TestChangeProcessor : public syncer::SyncChangeProcessor { 86 class TestChangeProcessor : public syncer::SyncChangeProcessor {
87 public: 87 public:
88 TestChangeProcessor(); 88 TestChangeProcessor();
89 virtual ~TestChangeProcessor(); 89 virtual ~TestChangeProcessor();
90 90
91 // Store a copy of all the changes passed in so we can examine them later. 91 // Store a copy of all the changes passed in so we can examine them later.
92 virtual syncer::SyncError ProcessSyncChanges( 92 virtual syncer::SyncError ProcessSyncChanges(
93 const tracked_objects::Location& from_here, 93 const tracked_objects::Location& from_here,
94 const syncer::SyncChangeList& change_list) OVERRIDE; 94 const syncer::SyncChangeList& change_list) OVERRIDE;
95 95
96 virtual syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const {
97 return syncer::SyncDataList();
98 }
99
96 bool contains_guid(const std::string& guid) const { 100 bool contains_guid(const std::string& guid) const {
97 return change_map_.count(guid) != 0; 101 return change_map_.count(guid) != 0;
98 } 102 }
99 103
100 syncer::SyncChange change_for_guid(const std::string& guid) const { 104 syncer::SyncChange change_for_guid(const std::string& guid) const {
101 DCHECK(contains_guid(guid)); 105 DCHECK(contains_guid(guid));
102 return change_map_.find(guid)->second; 106 return change_map_.find(guid)->second;
103 } 107 }
104 108
105 size_t change_list_size() { return change_map_.size(); } 109 size_t change_list_size() { return change_map_.size(); }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 class SyncChangeProcessorDelegate : public syncer::SyncChangeProcessor { 147 class SyncChangeProcessorDelegate : public syncer::SyncChangeProcessor {
144 public: 148 public:
145 explicit SyncChangeProcessorDelegate(syncer::SyncChangeProcessor* recipient); 149 explicit SyncChangeProcessorDelegate(syncer::SyncChangeProcessor* recipient);
146 virtual ~SyncChangeProcessorDelegate(); 150 virtual ~SyncChangeProcessorDelegate();
147 151
148 // syncer::SyncChangeProcessor implementation. 152 // syncer::SyncChangeProcessor implementation.
149 virtual syncer::SyncError ProcessSyncChanges( 153 virtual syncer::SyncError ProcessSyncChanges(
150 const tracked_objects::Location& from_here, 154 const tracked_objects::Location& from_here,
151 const syncer::SyncChangeList& change_list) OVERRIDE; 155 const syncer::SyncChangeList& change_list) OVERRIDE;
152 156
157 virtual syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const {
158 return recipient_->GetAllSyncData(type);
159 }
160
153 private: 161 private:
154 // The recipient of all sync changes. 162 // The recipient of all sync changes.
155 syncer::SyncChangeProcessor* recipient_; 163 syncer::SyncChangeProcessor* recipient_;
156 164
157 DISALLOW_COPY_AND_ASSIGN(SyncChangeProcessorDelegate); 165 DISALLOW_COPY_AND_ASSIGN(SyncChangeProcessorDelegate);
158 }; 166 };
159 167
160 SyncChangeProcessorDelegate::SyncChangeProcessorDelegate( 168 SyncChangeProcessorDelegate::SyncChangeProcessorDelegate(
161 syncer::SyncChangeProcessor* recipient) 169 syncer::SyncChangeProcessor* recipient)
162 : recipient_(recipient) { 170 : recipient_(recipient) {
(...skipping 2102 matching lines...) Expand 10 before | Expand all | Expand 10 after
2265 syncer::SyncMergeResult merge_result = model()->MergeDataAndStartSyncing( 2273 syncer::SyncMergeResult merge_result = model()->MergeDataAndStartSyncing(
2266 syncer::SEARCH_ENGINES, list, PassProcessor(), 2274 syncer::SEARCH_ENGINES, list, PassProcessor(),
2267 CreateAndPassSyncErrorFactory()); 2275 CreateAndPassSyncErrorFactory());
2268 2276
2269 const TemplateURL* result_turl = model()->GetTemplateURLForGUID("default"); 2277 const TemplateURL* result_turl = model()->GetTemplateURLForGUID("default");
2270 EXPECT_TRUE(result_turl); 2278 EXPECT_TRUE(result_turl);
2271 EXPECT_EQ(default_turl->keyword(), result_turl->keyword()); 2279 EXPECT_EQ(default_turl->keyword(), result_turl->keyword());
2272 EXPECT_EQ(default_turl->short_name(), result_turl->short_name()); 2280 EXPECT_EQ(default_turl->short_name(), result_turl->short_name());
2273 EXPECT_EQ(default_turl->url(), result_turl->url()); 2281 EXPECT_EQ(default_turl->url(), result_turl->url());
2274 } 2282 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698