| 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/shared_change_processor.h" | 5 #include "components/sync_driver/shared_change_processor.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 sync_driver::DataTypeManagerObserver* observer) override { | 54 sync_driver::DataTypeManagerObserver* observer) override { |
| 55 return nullptr; | 55 return nullptr; |
| 56 } | 56 } |
| 57 browser_sync::SyncBackendHost* CreateSyncBackendHost( | 57 browser_sync::SyncBackendHost* CreateSyncBackendHost( |
| 58 const std::string& name, | 58 const std::string& name, |
| 59 invalidation::InvalidationService* invalidator, | 59 invalidation::InvalidationService* invalidator, |
| 60 const base::WeakPtr<sync_driver::SyncPrefs>& sync_prefs, | 60 const base::WeakPtr<sync_driver::SyncPrefs>& sync_prefs, |
| 61 const base::FilePath& sync_folder) override { | 61 const base::FilePath& sync_folder) override { |
| 62 return nullptr; | 62 return nullptr; |
| 63 } | 63 } |
| 64 scoped_ptr<sync_driver::LocalDeviceInfoProvider> | 64 std::unique_ptr<sync_driver::LocalDeviceInfoProvider> |
| 65 CreateLocalDeviceInfoProvider() override { | 65 CreateLocalDeviceInfoProvider() override { |
| 66 return nullptr; | 66 return nullptr; |
| 67 } | 67 } |
| 68 SyncApiComponentFactory::SyncComponents CreateBookmarkSyncComponents( | 68 SyncApiComponentFactory::SyncComponents CreateBookmarkSyncComponents( |
| 69 sync_driver::SyncService* sync_service, | 69 sync_driver::SyncService* sync_service, |
| 70 sync_driver::DataTypeErrorHandler* error_handler) override { | 70 sync_driver::DataTypeErrorHandler* error_handler) override { |
| 71 return SyncApiComponentFactory::SyncComponents(nullptr, nullptr); | 71 return SyncApiComponentFactory::SyncComponents(nullptr, nullptr); |
| 72 } | 72 } |
| 73 scoped_ptr<syncer::AttachmentService> CreateAttachmentService( | 73 std::unique_ptr<syncer::AttachmentService> CreateAttachmentService( |
| 74 scoped_ptr<syncer::AttachmentStoreForSync> attachment_store, | 74 std::unique_ptr<syncer::AttachmentStoreForSync> attachment_store, |
| 75 const syncer::UserShare& user_share, | 75 const syncer::UserShare& user_share, |
| 76 const std::string& store_birthday, | 76 const std::string& store_birthday, |
| 77 syncer::ModelType model_type, | 77 syncer::ModelType model_type, |
| 78 syncer::AttachmentService::Delegate* delegate) override { | 78 syncer::AttachmentService::Delegate* delegate) override { |
| 79 return syncer::AttachmentServiceImpl::CreateForTest(); | 79 return syncer::AttachmentServiceImpl::CreateForTest(); |
| 80 } | 80 } |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 class SyncSharedChangeProcessorTest : | 83 class SyncSharedChangeProcessorTest : |
| 84 public testing::Test, | 84 public testing::Test, |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 TestSyncApiComponentFactory factory_; | 207 TestSyncApiComponentFactory factory_; |
| 208 | 208 |
| 209 scoped_refptr<SharedChangeProcessor> shared_change_processor_; | 209 scoped_refptr<SharedChangeProcessor> shared_change_processor_; |
| 210 StrictMock<DataTypeErrorHandlerMock> error_handler_; | 210 StrictMock<DataTypeErrorHandlerMock> error_handler_; |
| 211 | 211 |
| 212 GenericChangeProcessorFactory processor_factory_; | 212 GenericChangeProcessorFactory processor_factory_; |
| 213 bool did_connect_; | 213 bool did_connect_; |
| 214 bool has_attachment_service_; | 214 bool has_attachment_service_; |
| 215 | 215 |
| 216 // Used only on DB thread. | 216 // Used only on DB thread. |
| 217 scoped_ptr<syncer::FakeSyncableService> db_syncable_service_; | 217 std::unique_ptr<syncer::FakeSyncableService> db_syncable_service_; |
| 218 }; | 218 }; |
| 219 | 219 |
| 220 // Simply connect the shared change processor. It should succeed, and | 220 // Simply connect the shared change processor. It should succeed, and |
| 221 // nothing further should happen. | 221 // nothing further should happen. |
| 222 TEST_F(SyncSharedChangeProcessorTest, Basic) { | 222 TEST_F(SyncSharedChangeProcessorTest, Basic) { |
| 223 Connect(); | 223 Connect(); |
| 224 } | 224 } |
| 225 | 225 |
| 226 // Connect the shared change processor to a syncable service with | 226 // Connect the shared change processor to a syncable service with |
| 227 // AttachmentStore. Verify that shared change processor implementation | 227 // AttachmentStore. Verify that shared change processor implementation |
| 228 // creates AttachmentService and passes it back to the syncable service. | 228 // creates AttachmentService and passes it back to the syncable service. |
| 229 TEST_F(SyncSharedChangeProcessorTest, ConnectWithAttachmentStore) { | 229 TEST_F(SyncSharedChangeProcessorTest, ConnectWithAttachmentStore) { |
| 230 SetAttachmentStore(); | 230 SetAttachmentStore(); |
| 231 Connect(); | 231 Connect(); |
| 232 EXPECT_TRUE(HasAttachmentService()); | 232 EXPECT_TRUE(HasAttachmentService()); |
| 233 } | 233 } |
| 234 | 234 |
| 235 } // namespace | 235 } // namespace |
| 236 | 236 |
| 237 } // namespace sync_driver | 237 } // namespace sync_driver |
| OLD | NEW |