OLD | NEW |
| (Empty) |
1 // Copyright 2015 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_FAKE_SYNC_SERVICE_H_ | |
6 #define COMPONENTS_SYNC_DRIVER_FAKE_SYNC_SERVICE_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "components/sync/sessions/sync_session_snapshot.h" | |
11 #include "components/sync_driver/sync_service.h" | |
12 #include "google_apis/gaia/google_service_auth_error.h" | |
13 | |
14 namespace syncer { | |
15 class BaseTransaction; | |
16 struct UserShare; | |
17 } | |
18 | |
19 namespace sync_driver { | |
20 | |
21 // Fake implementation of sync_driver::SyncService, used for testing. | |
22 class FakeSyncService : public sync_driver::SyncService { | |
23 public: | |
24 FakeSyncService(); | |
25 ~FakeSyncService() override; | |
26 | |
27 private: | |
28 // sync_driver::SyncService: | |
29 bool IsFirstSetupComplete() const override; | |
30 bool IsSyncAllowed() const override; | |
31 bool IsSyncActive() const override; | |
32 void TriggerRefresh(const syncer::ModelTypeSet& types) override; | |
33 syncer::ModelTypeSet GetActiveDataTypes() const override; | |
34 SyncClient* GetSyncClient() const override; | |
35 void AddObserver(SyncServiceObserver* observer) override; | |
36 void RemoveObserver(SyncServiceObserver* observer) override; | |
37 bool HasObserver(const SyncServiceObserver* observer) const override; | |
38 void OnDataTypeRequestsSyncStartup(syncer::ModelType type) override; | |
39 bool CanSyncStart() const override; | |
40 void RequestStop( | |
41 sync_driver::SyncService::SyncStopDataFate data_fate) override; | |
42 void RequestStart() override; | |
43 syncer::ModelTypeSet GetPreferredDataTypes() const override; | |
44 void OnUserChoseDatatypes(bool sync_everything, | |
45 syncer::ModelTypeSet chosen_types) override; | |
46 void SetFirstSetupComplete() override; | |
47 bool IsFirstSetupInProgress() const override; | |
48 std::unique_ptr<SyncSetupInProgressHandle> GetSetupInProgressHandle() | |
49 override; | |
50 bool IsSetupInProgress() const override; | |
51 bool ConfigurationDone() const override; | |
52 const GoogleServiceAuthError& GetAuthError() const override; | |
53 bool HasUnrecoverableError() const override; | |
54 bool IsBackendInitialized() const override; | |
55 OpenTabsUIDelegate* GetOpenTabsUIDelegate() override; | |
56 bool IsPassphraseRequiredForDecryption() const override; | |
57 base::Time GetExplicitPassphraseTime() const override; | |
58 bool IsUsingSecondaryPassphrase() const override; | |
59 void EnableEncryptEverything() override; | |
60 bool IsEncryptEverythingEnabled() const override; | |
61 void SetEncryptionPassphrase(const std::string& passphrase, | |
62 PassphraseType type) override; | |
63 bool SetDecryptionPassphrase(const std::string& passphrase) override; | |
64 bool IsCryptographerReady( | |
65 const syncer::BaseTransaction* trans) const override; | |
66 syncer::UserShare* GetUserShare() const override; | |
67 LocalDeviceInfoProvider* GetLocalDeviceInfoProvider() const override; | |
68 void RegisterDataTypeController( | |
69 sync_driver::DataTypeController* data_type_controller) override; | |
70 void ReenableDatatype(syncer::ModelType type) override; | |
71 SyncTokenStatus GetSyncTokenStatus() const override; | |
72 std::string QuerySyncStatusSummaryString() override; | |
73 bool QueryDetailedSyncStatus(syncer::SyncStatus* result) override; | |
74 base::string16 GetLastSyncedTimeString() const override; | |
75 std::string GetBackendInitializationStateString() const override; | |
76 syncer::sessions::SyncSessionSnapshot GetLastSessionSnapshot() const override; | |
77 base::Value* GetTypeStatusMap() const override; | |
78 const GURL& sync_service_url() const override; | |
79 std::string unrecoverable_error_message() const override; | |
80 tracked_objects::Location unrecoverable_error_location() const override; | |
81 void AddProtocolEventObserver( | |
82 browser_sync::ProtocolEventObserver* observer) override; | |
83 void RemoveProtocolEventObserver( | |
84 browser_sync::ProtocolEventObserver* observer) override; | |
85 void AddTypeDebugInfoObserver( | |
86 syncer::TypeDebugInfoObserver* observer) override; | |
87 void RemoveTypeDebugInfoObserver( | |
88 syncer::TypeDebugInfoObserver* observer) override; | |
89 base::WeakPtr<syncer::JsController> GetJsController() override; | |
90 void GetAllNodes(const base::Callback<void(std::unique_ptr<base::ListValue>)>& | |
91 callback) override; | |
92 | |
93 // DataTypeEncryptionHandler: | |
94 bool IsPassphraseRequired() const override; | |
95 syncer::ModelTypeSet GetEncryptedDataTypes() const override; | |
96 | |
97 GoogleServiceAuthError error_; | |
98 GURL sync_service_url_; | |
99 std::string unrecoverable_error_message_; | |
100 std::unique_ptr<syncer::UserShare> user_share_; | |
101 }; | |
102 | |
103 } // namespace sync_driver | |
104 | |
105 #endif // COMPONENTS_SYNC_DRIVER_FAKE_SYNC_SERVICE_H_ | |
OLD | NEW |