OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/sync_driver/generic_change_processor.h" | 5 #include "components/sync_driver/generic_change_processor.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 change_processor_.reset(new GenericChangeProcessor( | 163 change_processor_.reset(new GenericChangeProcessor( |
164 type, &data_type_error_handler_, | 164 type, &data_type_error_handler_, |
165 syncable_service_ptr_factory_.GetWeakPtr(), | 165 syncable_service_ptr_factory_.GetWeakPtr(), |
166 merge_result_ptr_factory_->GetWeakPtr(), test_user_share_->user_share(), | 166 merge_result_ptr_factory_->GetWeakPtr(), test_user_share_->user_share(), |
167 &sync_factory, attachment_store->CreateAttachmentStoreForSync())); | 167 &sync_factory, attachment_store->CreateAttachmentStoreForSync())); |
168 mock_attachment_service_ = sync_factory.GetMockAttachmentService(); | 168 mock_attachment_service_ = sync_factory.GetMockAttachmentService(); |
169 } | 169 } |
170 | 170 |
171 void BuildChildNodes(syncer::ModelType type, int n) { | 171 void BuildChildNodes(syncer::ModelType type, int n) { |
172 syncer::WriteTransaction trans(FROM_HERE, user_share()); | 172 syncer::WriteTransaction trans(FROM_HERE, user_share()); |
173 syncer::ReadNode root(&trans); | |
174 ASSERT_EQ(syncer::BaseNode::INIT_OK, root.InitTypeRoot(type)); | |
175 for (int i = 0; i < n; ++i) { | 173 for (int i = 0; i < n; ++i) { |
176 syncer::WriteNode node(&trans); | 174 syncer::WriteNode node(&trans); |
177 node.InitUniqueByCreation(type, root, base::StringPrintf("node%05d", i)); | 175 node.InitUniqueByCreation(type, base::StringPrintf("node%05d", i)); |
178 } | 176 } |
179 } | 177 } |
180 | 178 |
181 GenericChangeProcessor* change_processor() { | 179 GenericChangeProcessor* change_processor() { |
182 return change_processor_.get(); | 180 return change_processor_.get(); |
183 } | 181 } |
184 | 182 |
185 syncer::UserShare* user_share() { | 183 syncer::UserShare* user_share() { |
186 return test_user_share_->user_share(); | 184 return test_user_share_->user_share(); |
187 } | 185 } |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 syncer::SyncDataList sync_data = | 508 syncer::SyncDataList sync_data = |
511 change_processor()->GetAllSyncData(syncer::SESSIONS); | 509 change_processor()->GetAllSyncData(syncer::SESSIONS); |
512 ASSERT_EQ(sync_data.size(), 1U); | 510 ASSERT_EQ(sync_data.size(), 1U); |
513 ASSERT_EQ("session tag 2", | 511 ASSERT_EQ("session tag 2", |
514 sync_data[0].GetSpecifics().session().session_tag()); | 512 sync_data[0].GetSpecifics().session().session_tag()); |
515 } | 513 } |
516 | 514 |
517 } // namespace | 515 } // namespace |
518 | 516 |
519 } // namespace sync_driver | 517 } // namespace sync_driver |
OLD | NEW |