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