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/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 Loading... |
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 OVERRIDE { |
| 98 return syncer::SyncDataList(); |
| 99 } |
| 100 |
96 bool contains_guid(const std::string& guid) const { | 101 bool contains_guid(const std::string& guid) const { |
97 return change_map_.count(guid) != 0; | 102 return change_map_.count(guid) != 0; |
98 } | 103 } |
99 | 104 |
100 syncer::SyncChange change_for_guid(const std::string& guid) const { | 105 syncer::SyncChange change_for_guid(const std::string& guid) const { |
101 DCHECK(contains_guid(guid)); | 106 DCHECK(contains_guid(guid)); |
102 return change_map_.find(guid)->second; | 107 return change_map_.find(guid)->second; |
103 } | 108 } |
104 | 109 |
105 size_t change_list_size() { return change_map_.size(); } | 110 size_t change_list_size() { return change_map_.size(); } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 class SyncChangeProcessorDelegate : public syncer::SyncChangeProcessor { | 148 class SyncChangeProcessorDelegate : public syncer::SyncChangeProcessor { |
144 public: | 149 public: |
145 explicit SyncChangeProcessorDelegate(syncer::SyncChangeProcessor* recipient); | 150 explicit SyncChangeProcessorDelegate(syncer::SyncChangeProcessor* recipient); |
146 virtual ~SyncChangeProcessorDelegate(); | 151 virtual ~SyncChangeProcessorDelegate(); |
147 | 152 |
148 // syncer::SyncChangeProcessor implementation. | 153 // syncer::SyncChangeProcessor implementation. |
149 virtual syncer::SyncError ProcessSyncChanges( | 154 virtual syncer::SyncError ProcessSyncChanges( |
150 const tracked_objects::Location& from_here, | 155 const tracked_objects::Location& from_here, |
151 const syncer::SyncChangeList& change_list) OVERRIDE; | 156 const syncer::SyncChangeList& change_list) OVERRIDE; |
152 | 157 |
| 158 virtual syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const |
| 159 OVERRIDE { |
| 160 return recipient_->GetAllSyncData(type); |
| 161 } |
| 162 |
153 private: | 163 private: |
154 // The recipient of all sync changes. | 164 // The recipient of all sync changes. |
155 syncer::SyncChangeProcessor* recipient_; | 165 syncer::SyncChangeProcessor* recipient_; |
156 | 166 |
157 DISALLOW_COPY_AND_ASSIGN(SyncChangeProcessorDelegate); | 167 DISALLOW_COPY_AND_ASSIGN(SyncChangeProcessorDelegate); |
158 }; | 168 }; |
159 | 169 |
160 SyncChangeProcessorDelegate::SyncChangeProcessorDelegate( | 170 SyncChangeProcessorDelegate::SyncChangeProcessorDelegate( |
161 syncer::SyncChangeProcessor* recipient) | 171 syncer::SyncChangeProcessor* recipient) |
162 : recipient_(recipient) { | 172 : recipient_(recipient) { |
(...skipping 2102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2265 syncer::SyncMergeResult merge_result = model()->MergeDataAndStartSyncing( | 2275 syncer::SyncMergeResult merge_result = model()->MergeDataAndStartSyncing( |
2266 syncer::SEARCH_ENGINES, list, PassProcessor(), | 2276 syncer::SEARCH_ENGINES, list, PassProcessor(), |
2267 CreateAndPassSyncErrorFactory()); | 2277 CreateAndPassSyncErrorFactory()); |
2268 | 2278 |
2269 const TemplateURL* result_turl = model()->GetTemplateURLForGUID("default"); | 2279 const TemplateURL* result_turl = model()->GetTemplateURLForGUID("default"); |
2270 EXPECT_TRUE(result_turl); | 2280 EXPECT_TRUE(result_turl); |
2271 EXPECT_EQ(default_turl->keyword(), result_turl->keyword()); | 2281 EXPECT_EQ(default_turl->keyword(), result_turl->keyword()); |
2272 EXPECT_EQ(default_turl->short_name(), result_turl->short_name()); | 2282 EXPECT_EQ(default_turl->short_name(), result_turl->short_name()); |
2273 EXPECT_EQ(default_turl->url(), result_turl->url()); | 2283 EXPECT_EQ(default_turl->url(), result_turl->url()); |
2274 } | 2284 } |
OLD | NEW |