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