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

Side by Side Diff: components/sync_driver/shared_change_processor_unittest.cc

Issue 1966023002: [Sync] Move DataTypeErrorHandler to //sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Found an unsaved buffer :( Created 4 years, 7 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
OLDNEW
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"
11 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/location.h" 13 #include "base/location.h"
14 #include "base/single_thread_task_runner.h" 14 #include "base/single_thread_task_runner.h"
15 #include "base/synchronization/waitable_event.h" 15 #include "base/synchronization/waitable_event.h"
16 #include "base/threading/thread.h" 16 #include "base/threading/thread.h"
17 #include "components/sync_driver/data_type_error_handler_mock.h"
18 #include "components/sync_driver/fake_sync_client.h" 17 #include "components/sync_driver/fake_sync_client.h"
19 #include "components/sync_driver/generic_change_processor.h" 18 #include "components/sync_driver/generic_change_processor.h"
20 #include "components/sync_driver/generic_change_processor_factory.h" 19 #include "components/sync_driver/generic_change_processor_factory.h"
21 #include "components/sync_driver/local_device_info_provider.h" 20 #include "components/sync_driver/local_device_info_provider.h"
22 #include "components/sync_driver/sync_api_component_factory.h" 21 #include "components/sync_driver/sync_api_component_factory.h"
23 #include "sync/api/attachments/attachment_id.h" 22 #include "sync/api/attachments/attachment_id.h"
24 #include "sync/api/attachments/attachment_store.h" 23 #include "sync/api/attachments/attachment_store.h"
25 #include "sync/api/fake_syncable_service.h" 24 #include "sync/api/fake_syncable_service.h"
26 #include "sync/internal_api/public/attachments/attachment_service_impl.h" 25 #include "sync/internal_api/public/attachments/attachment_service_impl.h"
27 #include "sync/internal_api/public/base/model_type.h" 26 #include "sync/internal_api/public/base/model_type.h"
27 #include "sync/internal_api/public/test/data_type_error_handler_mock.h"
28 #include "sync/internal_api/public/test/test_user_share.h" 28 #include "sync/internal_api/public/test/test_user_share.h"
29 #include "testing/gmock/include/gmock/gmock.h" 29 #include "testing/gmock/include/gmock/gmock.h"
30 #include "testing/gtest/include/gtest/gtest.h" 30 #include "testing/gtest/include/gtest/gtest.h"
31 31
32 namespace sync_driver { 32 namespace sync_driver {
33 33
34 namespace { 34 namespace {
35 35
36 using ::testing::NiceMock; 36 using ::testing::NiceMock;
37 using ::testing::StrictMock; 37 using ::testing::StrictMock;
(...skipping 22 matching lines...) Expand all
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 std::unique_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 syncer::DataTypeErrorHandler* error_handler) override {
71 return SyncApiComponentFactory::SyncComponents(nullptr, nullptr); 71 return SyncApiComponentFactory::SyncComponents(nullptr, nullptr);
72 } 72 }
73 std::unique_ptr<syncer::AttachmentService> CreateAttachmentService( 73 std::unique_ptr<syncer::AttachmentService> CreateAttachmentService(
74 std::unique_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 }
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 has_attachment_service_ = !!db_syncable_service_->attachment_service(); 200 has_attachment_service_ = !!db_syncable_service_->attachment_service();
201 event->Signal(); 201 event->Signal();
202 } 202 }
203 203
204 base::MessageLoop frontend_loop_; 204 base::MessageLoop frontend_loop_;
205 base::Thread backend_thread_; 205 base::Thread backend_thread_;
206 syncer::TestUserShare test_user_share_; 206 syncer::TestUserShare test_user_share_;
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<syncer::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 std::unique_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
OLDNEW
« no previous file with comments | « components/sync_driver/shared_change_processor.cc ('k') | components/sync_driver/sync_api_component_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698