OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/fake_sync_client.h" | 5 #include "components/sync/driver/fake_sync_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "components/sync/base/extensions_activity.h" | 9 #include "components/sync/base/extensions_activity.h" |
10 #include "components/sync/driver/fake_sync_service.h" | 10 #include "components/sync/driver/fake_sync_service.h" |
11 #include "components/sync/driver/sync_prefs.h" | 11 #include "components/sync/driver/sync_prefs.h" |
12 | 12 |
13 namespace sync_driver { | 13 namespace syncer { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 void DummyRegisterPlatformTypesCallback(SyncService* sync_service, | 17 void DummyRegisterPlatformTypesCallback(SyncService* sync_service, |
18 syncer::ModelTypeSet, | 18 ModelTypeSet, |
19 syncer::ModelTypeSet) {} | 19 ModelTypeSet) {} |
20 | 20 |
21 } // namespace | 21 } // namespace |
22 | 22 |
23 FakeSyncClient::FakeSyncClient() | 23 FakeSyncClient::FakeSyncClient() |
24 : model_type_service_(nullptr), | 24 : model_type_service_(nullptr), |
25 factory_(nullptr), | 25 factory_(nullptr), |
26 sync_service_(base::MakeUnique<FakeSyncService>()) { | 26 sync_service_(base::MakeUnique<FakeSyncService>()) { |
27 // Register sync preferences and set them to "Sync everything" state. | 27 // Register sync preferences and set them to "Sync everything" state. |
28 sync_driver::SyncPrefs::RegisterProfilePrefs(pref_service_.registry()); | 28 SyncPrefs::RegisterProfilePrefs(pref_service_.registry()); |
29 sync_driver::SyncPrefs sync_prefs(GetPrefService()); | 29 SyncPrefs sync_prefs(GetPrefService()); |
30 sync_prefs.SetFirstSetupComplete(); | 30 sync_prefs.SetFirstSetupComplete(); |
31 sync_prefs.SetKeepEverythingSynced(true); | 31 sync_prefs.SetKeepEverythingSynced(true); |
32 } | 32 } |
33 | 33 |
34 FakeSyncClient::FakeSyncClient(SyncApiComponentFactory* factory) | 34 FakeSyncClient::FakeSyncClient(SyncApiComponentFactory* factory) |
35 : factory_(factory), sync_service_(base::MakeUnique<FakeSyncService>()) { | 35 : factory_(factory), sync_service_(base::MakeUnique<FakeSyncService>()) { |
36 sync_driver::SyncPrefs::RegisterProfilePrefs(pref_service_.registry()); | 36 SyncPrefs::RegisterProfilePrefs(pref_service_.registry()); |
37 } | 37 } |
38 | 38 |
39 FakeSyncClient::~FakeSyncClient() {} | 39 FakeSyncClient::~FakeSyncClient() {} |
40 | 40 |
41 void FakeSyncClient::Initialize() {} | 41 void FakeSyncClient::Initialize() {} |
42 | 42 |
43 SyncService* FakeSyncClient::GetSyncService() { | 43 SyncService* FakeSyncClient::GetSyncService() { |
44 return sync_service_.get(); | 44 return sync_service_.get(); |
45 } | 45 } |
46 | 46 |
(...skipping 10 matching lines...) Expand all Loading... |
57 } | 57 } |
58 | 58 |
59 history::HistoryService* FakeSyncClient::GetHistoryService() { | 59 history::HistoryService* FakeSyncClient::GetHistoryService() { |
60 return nullptr; | 60 return nullptr; |
61 } | 61 } |
62 | 62 |
63 base::Closure FakeSyncClient::GetPasswordStateChangedCallback() { | 63 base::Closure FakeSyncClient::GetPasswordStateChangedCallback() { |
64 return base::Bind(&base::DoNothing); | 64 return base::Bind(&base::DoNothing); |
65 } | 65 } |
66 | 66 |
67 sync_driver::SyncApiComponentFactory::RegisterDataTypesMethod | 67 SyncApiComponentFactory::RegisterDataTypesMethod |
68 FakeSyncClient::GetRegisterPlatformTypesCallback() { | 68 FakeSyncClient::GetRegisterPlatformTypesCallback() { |
69 return base::Bind(&DummyRegisterPlatformTypesCallback); | 69 return base::Bind(&DummyRegisterPlatformTypesCallback); |
70 } | 70 } |
71 | 71 |
72 autofill::PersonalDataManager* FakeSyncClient::GetPersonalDataManager() { | 72 autofill::PersonalDataManager* FakeSyncClient::GetPersonalDataManager() { |
73 return nullptr; | 73 return nullptr; |
74 } | 74 } |
75 | 75 |
76 BookmarkUndoService* FakeSyncClient::GetBookmarkUndoServiceIfExists() { | 76 BookmarkUndoService* FakeSyncClient::GetBookmarkUndoServiceIfExists() { |
77 return nullptr; | 77 return nullptr; |
78 } | 78 } |
79 | 79 |
80 invalidation::InvalidationService* FakeSyncClient::GetInvalidationService() { | 80 invalidation::InvalidationService* FakeSyncClient::GetInvalidationService() { |
81 return nullptr; | 81 return nullptr; |
82 } | 82 } |
83 | 83 |
84 scoped_refptr<syncer::ExtensionsActivity> | 84 scoped_refptr<ExtensionsActivity> FakeSyncClient::GetExtensionsActivity() { |
85 FakeSyncClient::GetExtensionsActivity() { | 85 return scoped_refptr<ExtensionsActivity>(); |
86 return scoped_refptr<syncer::ExtensionsActivity>(); | |
87 } | 86 } |
88 | 87 |
89 sync_sessions::SyncSessionsClient* FakeSyncClient::GetSyncSessionsClient() { | 88 sync_sessions::SyncSessionsClient* FakeSyncClient::GetSyncSessionsClient() { |
90 return nullptr; | 89 return nullptr; |
91 } | 90 } |
92 | 91 |
93 base::WeakPtr<syncer::SyncableService> | 92 base::WeakPtr<SyncableService> FakeSyncClient::GetSyncableServiceForType( |
94 FakeSyncClient::GetSyncableServiceForType(syncer::ModelType type) { | 93 ModelType type) { |
95 return base::WeakPtr<syncer::SyncableService>(); | 94 return base::WeakPtr<SyncableService>(); |
96 } | 95 } |
97 | 96 |
98 base::WeakPtr<syncer_v2::ModelTypeService> | 97 base::WeakPtr<ModelTypeService> FakeSyncClient::GetModelTypeServiceForType( |
99 FakeSyncClient::GetModelTypeServiceForType(syncer::ModelType type) { | 98 ModelType type) { |
100 return model_type_service_->AsWeakPtr(); | 99 return model_type_service_->AsWeakPtr(); |
101 } | 100 } |
102 | 101 |
103 scoped_refptr<syncer::ModelSafeWorker> | 102 scoped_refptr<ModelSafeWorker> FakeSyncClient::CreateModelWorkerForGroup( |
104 FakeSyncClient::CreateModelWorkerForGroup( | 103 ModelSafeGroup group, |
105 syncer::ModelSafeGroup group, | 104 WorkerLoopDestructionObserver* observer) { |
106 syncer::WorkerLoopDestructionObserver* observer) { | 105 return scoped_refptr<ModelSafeWorker>(); |
107 return scoped_refptr<syncer::ModelSafeWorker>(); | |
108 } | 106 } |
109 | 107 |
110 SyncApiComponentFactory* FakeSyncClient::GetSyncApiComponentFactory() { | 108 SyncApiComponentFactory* FakeSyncClient::GetSyncApiComponentFactory() { |
111 return factory_; | 109 return factory_; |
112 } | 110 } |
113 | 111 |
114 void FakeSyncClient::SetModelTypeService( | 112 void FakeSyncClient::SetModelTypeService(ModelTypeService* model_type_service) { |
115 syncer_v2::ModelTypeService* model_type_service) { | |
116 model_type_service_ = model_type_service; | 113 model_type_service_ = model_type_service; |
117 } | 114 } |
118 | 115 |
119 } // namespace sync_driver | 116 } // namespace syncer |
OLD | NEW |