Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: components/sync/driver/glue/sync_backend_host_mock.h

Issue 2533083002: [Sync] SyncEngine refactor part 1: interfaces. (Closed)
Patch Set: Rebase. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 #ifndef COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_MOCK_H_
6 #define COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_MOCK_H_
7
8 #include <memory>
9 #include <string>
10
11 #include "base/callback.h"
12 #include "base/compiler_specific.h"
13 #include "components/sync/base/weak_handle.h"
14 #include "components/sync/driver/glue/sync_backend_host.h"
15
16 namespace syncer {
17
18 // A mock of the SyncBackendHost.
19 //
20 // This class implements the bare minimum required for the ProfileSyncService to
21 // get through initialization. It often returns null pointers or nonesense
22 // values; it is not intended to be used in tests that depend on SyncBackendHost
23 // behavior.
24 class SyncBackendHostMock : public SyncBackendHost {
25 public:
26 SyncBackendHostMock();
27 ~SyncBackendHostMock() override;
28
29 void Initialize(
30 SyncFrontend* frontend,
31 scoped_refptr<base::SingleThreadTaskRunner> sync_task_runner,
32 const WeakHandle<JsEventHandler>& event_handler,
33 const GURL& service_url,
34 const std::string& sync_user_agent,
35 const SyncCredentials& credentials,
36 bool delete_sync_data_folder,
37 bool enable_local_sync_backend,
38 const base::FilePath& local_sync_backend_folder,
39 std::unique_ptr<SyncManagerFactory> sync_manager_factory,
40 const WeakHandle<UnrecoverableErrorHandler>& unrecoverable_error_handler,
41 const base::Closure& report_unrecoverable_error_function,
42 const HttpPostProviderFactoryGetter& http_post_provider_factory_getter,
43 std::unique_ptr<SyncEncryptionHandler::NigoriState> saved_nigori_state)
44 override;
45
46 void TriggerRefresh(const ModelTypeSet& types) override;
47
48 void UpdateCredentials(const SyncCredentials& credentials) override;
49
50 void StartSyncingWithServer() override;
51
52 void SetEncryptionPassphrase(const std::string& passphrase,
53 bool is_explicit) override;
54
55 bool SetDecryptionPassphrase(const std::string& passphrase) override;
56
57 void StopSyncingForShutdown() override;
58
59 void Shutdown(ShutdownReason reason) override;
60
61 void UnregisterInvalidationIds() override;
62
63 ModelTypeSet ConfigureDataTypes(
64 ConfigureReason reason,
65 const DataTypeConfigStateMap& config_state_map,
66 const base::Callback<void(ModelTypeSet, ModelTypeSet)>& ready_task,
67 const base::Callback<void()>& retry_callback) override;
68
69 void EnableEncryptEverything() override;
70
71 void ActivateDirectoryDataType(ModelType type,
72 ModelSafeGroup group,
73 ChangeProcessor* change_processor) override;
74 void DeactivateDirectoryDataType(ModelType type) override;
75
76 void ActivateNonBlockingDataType(ModelType type,
77 std::unique_ptr<ActivationContext>) override;
78 void DeactivateNonBlockingDataType(ModelType type) override;
79
80 UserShare* GetUserShare() const override;
81
82 Status GetDetailedStatus() override;
83
84 SyncCycleSnapshot GetLastCycleSnapshot() const override;
85
86 bool HasUnsyncedItems() const override;
87
88 bool IsNigoriEnabled() const override;
89
90 PassphraseType GetPassphraseType() const override;
91
92 base::Time GetExplicitPassphraseTime() const override;
93
94 bool IsCryptographerReady(const BaseTransaction* trans) const override;
95
96 void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) const override;
97
98 void FlushDirectory() const override;
99
100 void RequestBufferedProtocolEventsAndEnableForwarding() override;
101 void DisableProtocolEventForwarding() override;
102
103 void EnableDirectoryTypeDebugInfoForwarding() override;
104 void DisableDirectoryTypeDebugInfoForwarding() override;
105
106 void RefreshTypesForTest(ModelTypeSet types) override;
107
108 void ClearServerData(
109 const SyncManager::ClearServerDataCallback& callback) override;
110
111 void OnCookieJarChanged(bool account_mismatch, bool empty_jar) override;
112
113 void set_fail_initial_download(bool should_fail);
114
115 private:
116 bool fail_initial_download_;
117 };
118
119 } // namespace syncer
120
121 #endif // COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_MOCK_H_
OLDNEW
« no previous file with comments | « components/sync/driver/glue/sync_backend_host_impl_unittest.cc ('k') | components/sync/driver/glue/sync_backend_host_mock.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698