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.
5 #ifndef COMPONENTS_SYNC_DRIVER_FAKE_SYNC_SERVICE_H_
6 #define COMPONENTS_SYNC_DRIVER_FAKE_SYNC_SERVICE_H_
8 #include "components/sync_driver/sync_service.h"
9 #include "google_apis/gaia/google_service_auth_error.h"
12 class BaseTransaction
;
16 namespace sync_driver
{
18 // Fake implementation of sync_driver::SyncService, used for testing.
19 class FakeSyncService
: public sync_driver::SyncService
{
22 ~FakeSyncService() override
;
25 // sync_driver::SyncService:
26 bool HasSyncSetupCompleted() const override
;
27 bool IsSyncAllowed() const override
;
28 bool IsSyncActive() const override
;
29 syncer::ModelTypeSet
GetActiveDataTypes() const override
;
30 void AddObserver(SyncServiceObserver
* observer
) override
;
31 void RemoveObserver(SyncServiceObserver
* observer
) override
;
32 bool HasObserver(const SyncServiceObserver
* observer
) const override
;
33 void OnDataTypeRequestsSyncStartup(syncer::ModelType type
) override
;
34 bool CanSyncStart() const override
;
36 sync_driver::SyncService::SyncStopDataFate data_fate
) override
;
37 void RequestStart() override
;
38 syncer::ModelTypeSet
GetPreferredDataTypes() const override
;
39 void OnUserChoseDatatypes(bool sync_everything
,
40 syncer::ModelTypeSet chosen_types
) override
;
41 void SetSyncSetupCompleted() override
;
42 bool FirstSetupInProgress() const override
;
43 void SetSetupInProgress(bool setup_in_progress
) override
;
44 bool setup_in_progress() const override
;
45 bool ConfigurationDone() const override
;
46 const GoogleServiceAuthError
& GetAuthError() const override
;
47 bool HasUnrecoverableError() const override
;
48 bool backend_initialized() const override
;
49 OpenTabsUIDelegate
* GetOpenTabsUIDelegate() override
;
50 bool IsPassphraseRequiredForDecryption() const override
;
51 base::Time
GetExplicitPassphraseTime() const override
;
52 bool IsUsingSecondaryPassphrase() const override
;
53 void EnableEncryptEverything() override
;
54 bool EncryptEverythingEnabled() const override
;
55 void SetEncryptionPassphrase(const std::string
& passphrase
,
56 PassphraseType type
) override
;
57 bool SetDecryptionPassphrase(const std::string
& passphrase
) override
;
58 bool IsCryptographerReady(
59 const syncer::BaseTransaction
* trans
) const override
;
60 syncer::UserShare
* GetUserShare() const override
;
61 LocalDeviceInfoProvider
* GetLocalDeviceInfoProvider() const override
;
62 void RegisterDataTypeController(
63 sync_driver::DataTypeController
* data_type_controller
) override
;
64 void ReenableDatatype(syncer::ModelType type
) override
;
65 void DeactivateDataType(syncer::ModelType type
) override
;
67 // DataTypeEncryptionHandler:
68 bool IsPassphraseRequired() const override
;
69 syncer::ModelTypeSet
GetEncryptedDataTypes() const override
;
71 GoogleServiceAuthError error_
;
74 } // namespace sync_driver
76 #endif // COMPONENTS_SYNC_DRIVER_FAKE_SYNC_SERVICE_H_