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