OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/glue/sync_backend_host_mock.h" | 5 #include "components/sync/driver/glue/sync_backend_host_mock.h" |
6 | 6 |
7 #include "components/sync/core/activation_context.h" | 7 #include "components/sync/core/activation_context.h" |
8 #include "components/sync/driver/sync_frontend.h" | 8 #include "components/sync/driver/sync_frontend.h" |
9 | 9 |
10 namespace syncer { | 10 namespace browser_sync { |
11 | 11 |
12 const char kTestCacheGuid[] = "test-guid"; | 12 const char kTestCacheGuid[] = "test-guid"; |
13 | 13 |
14 SyncBackendHostMock::SyncBackendHostMock() : fail_initial_download_(false) {} | 14 SyncBackendHostMock::SyncBackendHostMock() : fail_initial_download_(false) {} |
15 SyncBackendHostMock::~SyncBackendHostMock() {} | 15 SyncBackendHostMock::~SyncBackendHostMock() {} |
16 | 16 |
17 void SyncBackendHostMock::Initialize( | 17 void SyncBackendHostMock::Initialize( |
18 SyncFrontend* frontend, | 18 sync_driver::SyncFrontend* frontend, |
19 std::unique_ptr<base::Thread> sync_thread, | 19 std::unique_ptr<base::Thread> sync_thread, |
20 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, | 20 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, |
21 const scoped_refptr<base::SingleThreadTaskRunner>& file_thread, | 21 const scoped_refptr<base::SingleThreadTaskRunner>& file_thread, |
22 const WeakHandle<JsEventHandler>& event_handler, | 22 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, |
23 const GURL& service_url, | 23 const GURL& service_url, |
24 const std::string& sync_user_agent, | 24 const std::string& sync_user_agent, |
25 const SyncCredentials& credentials, | 25 const syncer::SyncCredentials& credentials, |
26 bool delete_sync_data_folder, | 26 bool delete_sync_data_folder, |
27 std::unique_ptr<SyncManagerFactory> sync_manager_factory, | 27 std::unique_ptr<syncer::SyncManagerFactory> sync_manager_factory, |
28 const WeakHandle<UnrecoverableErrorHandler>& unrecoverable_error_handler, | 28 const syncer::WeakHandle<syncer::UnrecoverableErrorHandler>& |
| 29 unrecoverable_error_handler, |
29 const base::Closure& report_unrecoverable_error_function, | 30 const base::Closure& report_unrecoverable_error_function, |
30 const HttpPostProviderFactoryGetter& http_post_provider_factory_getter, | 31 const HttpPostProviderFactoryGetter& http_post_provider_factory_getter, |
31 std::unique_ptr<SyncEncryptionHandler::NigoriState> saved_nigori_state) { | 32 std::unique_ptr<syncer::SyncEncryptionHandler::NigoriState> |
32 frontend->OnBackendInitialized(WeakHandle<JsBackend>(), | 33 saved_nigori_state) { |
33 WeakHandle<DataTypeDebugInfoListener>(), | 34 frontend->OnBackendInitialized( |
34 kTestCacheGuid, !fail_initial_download_); | 35 syncer::WeakHandle<syncer::JsBackend>(), |
| 36 syncer::WeakHandle<syncer::DataTypeDebugInfoListener>(), kTestCacheGuid, |
| 37 !fail_initial_download_); |
35 } | 38 } |
36 | 39 |
37 void SyncBackendHostMock::TriggerRefresh(const ModelTypeSet& types) {} | 40 void SyncBackendHostMock::TriggerRefresh(const syncer::ModelTypeSet& types) {} |
38 | 41 |
39 void SyncBackendHostMock::UpdateCredentials( | 42 void SyncBackendHostMock::UpdateCredentials( |
40 const SyncCredentials& credentials) {} | 43 const syncer::SyncCredentials& credentials) {} |
41 | 44 |
42 void SyncBackendHostMock::StartSyncingWithServer() {} | 45 void SyncBackendHostMock::StartSyncingWithServer() {} |
43 | 46 |
44 void SyncBackendHostMock::SetEncryptionPassphrase(const std::string& passphrase, | 47 void SyncBackendHostMock::SetEncryptionPassphrase(const std::string& passphrase, |
45 bool is_explicit) {} | 48 bool is_explicit) {} |
46 | 49 |
47 bool SyncBackendHostMock::SetDecryptionPassphrase( | 50 bool SyncBackendHostMock::SetDecryptionPassphrase( |
48 const std::string& passphrase) { | 51 const std::string& passphrase) { |
49 return false; | 52 return false; |
50 } | 53 } |
51 | 54 |
52 void SyncBackendHostMock::StopSyncingForShutdown() {} | 55 void SyncBackendHostMock::StopSyncingForShutdown() {} |
53 | 56 |
54 std::unique_ptr<base::Thread> SyncBackendHostMock::Shutdown( | 57 std::unique_ptr<base::Thread> SyncBackendHostMock::Shutdown( |
55 ShutdownReason reason) { | 58 syncer::ShutdownReason reason) { |
56 return std::unique_ptr<base::Thread>(); | 59 return std::unique_ptr<base::Thread>(); |
57 } | 60 } |
58 | 61 |
59 void SyncBackendHostMock::UnregisterInvalidationIds() {} | 62 void SyncBackendHostMock::UnregisterInvalidationIds() {} |
60 | 63 |
61 ModelTypeSet SyncBackendHostMock::ConfigureDataTypes( | 64 syncer::ModelTypeSet SyncBackendHostMock::ConfigureDataTypes( |
62 ConfigureReason reason, | 65 syncer::ConfigureReason reason, |
63 const DataTypeConfigStateMap& config_state_map, | 66 const DataTypeConfigStateMap& config_state_map, |
64 const base::Callback<void(ModelTypeSet, ModelTypeSet)>& ready_task, | 67 const base::Callback<void(syncer::ModelTypeSet, syncer::ModelTypeSet)>& |
| 68 ready_task, |
65 const base::Callback<void()>& retry_callback) { | 69 const base::Callback<void()>& retry_callback) { |
66 return ModelTypeSet(); | 70 return syncer::ModelTypeSet(); |
67 } | 71 } |
68 | 72 |
69 void SyncBackendHostMock::EnableEncryptEverything() {} | 73 void SyncBackendHostMock::EnableEncryptEverything() {} |
70 | 74 |
71 void SyncBackendHostMock::ActivateDirectoryDataType( | 75 void SyncBackendHostMock::ActivateDirectoryDataType( |
72 ModelType type, | 76 syncer::ModelType type, |
73 ModelSafeGroup group, | 77 syncer::ModelSafeGroup group, |
74 ChangeProcessor* change_processor) {} | 78 sync_driver::ChangeProcessor* change_processor) {} |
75 void SyncBackendHostMock::DeactivateDirectoryDataType(ModelType type) {} | 79 void SyncBackendHostMock::DeactivateDirectoryDataType(syncer::ModelType type) {} |
76 | 80 |
77 void SyncBackendHostMock::ActivateNonBlockingDataType( | 81 void SyncBackendHostMock::ActivateNonBlockingDataType( |
78 ModelType type, | 82 syncer::ModelType type, |
79 std::unique_ptr<ActivationContext> activation_context) {} | 83 std::unique_ptr<syncer_v2::ActivationContext> activation_context) {} |
80 | 84 |
81 void SyncBackendHostMock::DeactivateNonBlockingDataType(ModelType type) {} | 85 void SyncBackendHostMock::DeactivateNonBlockingDataType( |
| 86 syncer::ModelType type) {} |
82 | 87 |
83 UserShare* SyncBackendHostMock::GetUserShare() const { | 88 syncer::UserShare* SyncBackendHostMock::GetUserShare() const { |
84 return NULL; | 89 return NULL; |
85 } | 90 } |
86 | 91 |
87 SyncBackendHost::Status SyncBackendHostMock::GetDetailedStatus() { | 92 SyncBackendHost::Status SyncBackendHostMock::GetDetailedStatus() { |
88 return SyncBackendHost::Status(); | 93 return SyncBackendHost::Status(); |
89 } | 94 } |
90 | 95 |
91 SyncCycleSnapshot SyncBackendHostMock::GetLastCycleSnapshot() const { | 96 syncer::SyncCycleSnapshot SyncBackendHostMock::GetLastCycleSnapshot() const { |
92 return SyncCycleSnapshot(); | 97 return syncer::SyncCycleSnapshot(); |
93 } | 98 } |
94 | 99 |
95 bool SyncBackendHostMock::HasUnsyncedItems() const { | 100 bool SyncBackendHostMock::HasUnsyncedItems() const { |
96 return false; | 101 return false; |
97 } | 102 } |
98 | 103 |
99 bool SyncBackendHostMock::IsNigoriEnabled() const { | 104 bool SyncBackendHostMock::IsNigoriEnabled() const { |
100 return true; | 105 return true; |
101 } | 106 } |
102 | 107 |
103 PassphraseType SyncBackendHostMock::GetPassphraseType() const { | 108 syncer::PassphraseType SyncBackendHostMock::GetPassphraseType() const { |
104 return PassphraseType::IMPLICIT_PASSPHRASE; | 109 return syncer::PassphraseType::IMPLICIT_PASSPHRASE; |
105 } | 110 } |
106 | 111 |
107 base::Time SyncBackendHostMock::GetExplicitPassphraseTime() const { | 112 base::Time SyncBackendHostMock::GetExplicitPassphraseTime() const { |
108 return base::Time(); | 113 return base::Time(); |
109 } | 114 } |
110 | 115 |
111 bool SyncBackendHostMock::IsCryptographerReady( | 116 bool SyncBackendHostMock::IsCryptographerReady( |
112 const BaseTransaction* trans) const { | 117 const syncer::BaseTransaction* trans) const { |
113 return false; | 118 return false; |
114 } | 119 } |
115 | 120 |
116 void SyncBackendHostMock::GetModelSafeRoutingInfo( | 121 void SyncBackendHostMock::GetModelSafeRoutingInfo( |
117 ModelSafeRoutingInfo* out) const {} | 122 syncer::ModelSafeRoutingInfo* out) const {} |
118 | 123 |
119 void SyncBackendHostMock::FlushDirectory() const {} | 124 void SyncBackendHostMock::FlushDirectory() const {} |
120 | 125 |
121 base::MessageLoop* SyncBackendHostMock::GetSyncLoopForTesting() { | 126 base::MessageLoop* SyncBackendHostMock::GetSyncLoopForTesting() { |
122 return NULL; | 127 return NULL; |
123 } | 128 } |
124 | 129 |
125 void SyncBackendHostMock::RefreshTypesForTest(ModelTypeSet types) {} | 130 void SyncBackendHostMock::RefreshTypesForTest(syncer::ModelTypeSet types) {} |
126 | 131 |
127 void SyncBackendHostMock::RequestBufferedProtocolEventsAndEnableForwarding() {} | 132 void SyncBackendHostMock::RequestBufferedProtocolEventsAndEnableForwarding() {} |
128 | 133 |
129 void SyncBackendHostMock::DisableProtocolEventForwarding() {} | 134 void SyncBackendHostMock::DisableProtocolEventForwarding() {} |
130 | 135 |
131 void SyncBackendHostMock::EnableDirectoryTypeDebugInfoForwarding() {} | 136 void SyncBackendHostMock::EnableDirectoryTypeDebugInfoForwarding() {} |
132 | 137 |
133 void SyncBackendHostMock::DisableDirectoryTypeDebugInfoForwarding() {} | 138 void SyncBackendHostMock::DisableDirectoryTypeDebugInfoForwarding() {} |
134 | 139 |
135 void SyncBackendHostMock::set_fail_initial_download(bool should_fail) { | 140 void SyncBackendHostMock::set_fail_initial_download(bool should_fail) { |
136 fail_initial_download_ = should_fail; | 141 fail_initial_download_ = should_fail; |
137 } | 142 } |
138 | 143 |
139 void SyncBackendHostMock::ClearServerData( | 144 void SyncBackendHostMock::ClearServerData( |
140 const SyncManager::ClearServerDataCallback& callback) { | 145 const syncer::SyncManager::ClearServerDataCallback& callback) { |
141 callback.Run(); | 146 callback.Run(); |
142 } | 147 } |
143 | 148 |
144 void SyncBackendHostMock::OnCookieJarChanged(bool account_mismatch, | 149 void SyncBackendHostMock::OnCookieJarChanged(bool account_mismatch, |
145 bool empty_jar) {} | 150 bool empty_jar) {} |
146 | 151 |
147 } // namespace syncer | 152 } // namespace browser_sync |
OLD | NEW |