| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 void ConstructGenericChangeProcessor(syncer::ModelType type) { | 149 void ConstructGenericChangeProcessor(syncer::ModelType type) { |
| 150 scoped_refptr<syncer::AttachmentStore> attachment_store = | 150 scoped_refptr<syncer::AttachmentStore> attachment_store = |
| 151 syncer::AttachmentStore::CreateInMemoryStore(); | 151 syncer::AttachmentStore::CreateInMemoryStore(); |
| 152 scoped_ptr<MockAttachmentService> mock_attachment_service( | 152 scoped_ptr<MockAttachmentService> mock_attachment_service( |
| 153 new MockAttachmentService(attachment_store)); | 153 new MockAttachmentService(attachment_store)); |
| 154 // GenericChangeProcessor takes ownership of the AttachmentService, but we | 154 // GenericChangeProcessor takes ownership of the AttachmentService, but we |
| 155 // need to have a pointer to it so we can see that it was used properly. | 155 // need to have a pointer to it so we can see that it was used properly. |
| 156 // Take a pointer and trust that GenericChangeProcessor does not prematurely | 156 // Take a pointer and trust that GenericChangeProcessor does not prematurely |
| 157 // destroy it. | 157 // destroy it. |
| 158 mock_attachment_service_ = mock_attachment_service.get(); | 158 mock_attachment_service_ = mock_attachment_service.get(); |
| 159 sync_factory_.reset(new MockSyncApiComponentFactory( | 159 sync_factory_.reset( |
| 160 mock_attachment_service.PassAs<syncer::AttachmentService>())); | 160 new MockSyncApiComponentFactory(mock_attachment_service.Pass())); |
| 161 change_processor_.reset( | 161 change_processor_.reset( |
| 162 new GenericChangeProcessor(type, | 162 new GenericChangeProcessor(type, |
| 163 &data_type_error_handler_, | 163 &data_type_error_handler_, |
| 164 syncable_service_ptr_factory_.GetWeakPtr(), | 164 syncable_service_ptr_factory_.GetWeakPtr(), |
| 165 merge_result_ptr_factory_->GetWeakPtr(), | 165 merge_result_ptr_factory_->GetWeakPtr(), |
| 166 test_user_share_->user_share(), | 166 test_user_share_->user_share(), |
| 167 sync_factory_.get(), | 167 sync_factory_.get(), |
| 168 attachment_store)); | 168 attachment_store)); |
| 169 } | 169 } |
| 170 | 170 |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 // AttachmentService to upload id1 only. | 476 // AttachmentService to upload id1 only. |
| 477 ConstructGenericChangeProcessor(kType); | 477 ConstructGenericChangeProcessor(kType); |
| 478 ASSERT_EQ(1U, mock_attachment_service()->attachment_id_sets()->size()); | 478 ASSERT_EQ(1U, mock_attachment_service()->attachment_id_sets()->size()); |
| 479 ASSERT_THAT(mock_attachment_service()->attachment_id_sets()->front(), | 479 ASSERT_THAT(mock_attachment_service()->attachment_id_sets()->front(), |
| 480 testing::UnorderedElementsAre(id1)); | 480 testing::UnorderedElementsAre(id1)); |
| 481 } | 481 } |
| 482 | 482 |
| 483 } // namespace | 483 } // namespace |
| 484 | 484 |
| 485 } // namespace sync_driver | 485 } // namespace sync_driver |
| OLD | NEW |