summaryrefslogtreecommitdiffstats
path: root/components/sync_driver/fake_sync_service.h
blob: a6b6c72acb6b23356a86d38cc6f787ac3bef0ab7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_SYNC_DRIVER_FAKE_SYNC_SERVICE_H_
#define COMPONENTS_SYNC_DRIVER_FAKE_SYNC_SERVICE_H_

#include "components/sync_driver/sync_service.h"
#include "google_apis/gaia/google_service_auth_error.h"

namespace syncer {
class BaseTransaction;
struct UserShare;
}

namespace sync_driver {

// Fake implementation of sync_driver::SyncService, used for testing.
class FakeSyncService : public sync_driver::SyncService {
 public:
  FakeSyncService();
  ~FakeSyncService() override;

 private:
  // sync_driver::SyncService:
  bool HasSyncSetupCompleted() const override;
  bool IsSyncAllowed() const override;
  bool IsSyncActive() const override;
  syncer::ModelTypeSet GetActiveDataTypes() const override;
  void AddObserver(SyncServiceObserver* observer) override;
  void RemoveObserver(SyncServiceObserver* observer) override;
  bool HasObserver(const SyncServiceObserver* observer) const override;
  void OnDataTypeRequestsSyncStartup(syncer::ModelType type) override;
  bool CanSyncStart() const override;
  void RequestStop(
      sync_driver::SyncService::SyncStopDataFate data_fate) override;
  void RequestStart() override;
  syncer::ModelTypeSet GetPreferredDataTypes() const override;
  void OnUserChoseDatatypes(bool sync_everything,
                            syncer::ModelTypeSet chosen_types) override;
  void SetSyncSetupCompleted() override;
  bool FirstSetupInProgress() const override;
  void SetSetupInProgress(bool setup_in_progress) override;
  bool setup_in_progress() const override;
  bool ConfigurationDone() const override;
  const GoogleServiceAuthError& GetAuthError() const override;
  bool HasUnrecoverableError() const override;
  bool backend_initialized() const override;
  OpenTabsUIDelegate* GetOpenTabsUIDelegate() override;
  bool IsPassphraseRequiredForDecryption() const override;
  base::Time GetExplicitPassphraseTime() const override;
  bool IsUsingSecondaryPassphrase() const override;
  void EnableEncryptEverything() override;
  void SetEncryptionPassphrase(const std::string& passphrase,
                               PassphraseType type) override;
  bool SetDecryptionPassphrase(const std::string& passphrase) override;
  bool IsCryptographerReady(
      const syncer::BaseTransaction* trans) const override;
  syncer::UserShare* GetUserShare() const override;

  // DataTypeEncryptionHandler:
  bool IsPassphraseRequired() const override;
  syncer::ModelTypeSet GetEncryptedDataTypes() const override;

  GoogleServiceAuthError error_;
};

}  // namespace sync_driver

#endif  // COMPONENTS_SYNC_DRIVER_FAKE_SYNC_SERVICE_H_