Only grant permissions to new extensions from sync if they have the expected version
[chromium-blink-merge.git] / components / sync_driver / fake_sync_service.h
bloba71422294986ecc2b23e1c50abf4906630392c0c
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"
10 #include "sync/internal_api/public/sessions/sync_session_snapshot.h"
12 namespace syncer {
13 class BaseTransaction;
14 struct UserShare;
17 namespace sync_driver {
19 // Fake implementation of sync_driver::SyncService, used for testing.
20 class FakeSyncService : public sync_driver::SyncService {
21 public:
22 FakeSyncService();
23 ~FakeSyncService() override;
25 private:
26 // sync_driver::SyncService:
27 bool HasSyncSetupCompleted() const override;
28 bool IsSyncAllowed() const override;
29 bool IsSyncActive() const override;
30 syncer::ModelTypeSet GetActiveDataTypes() const override;
31 void AddObserver(SyncServiceObserver* observer) override;
32 void RemoveObserver(SyncServiceObserver* observer) override;
33 bool HasObserver(const SyncServiceObserver* observer) const override;
34 void OnDataTypeRequestsSyncStartup(syncer::ModelType type) override;
35 bool CanSyncStart() const override;
36 void RequestStop(
37 sync_driver::SyncService::SyncStopDataFate data_fate) override;
38 void RequestStart() override;
39 syncer::ModelTypeSet GetPreferredDataTypes() const override;
40 void OnUserChoseDatatypes(bool sync_everything,
41 syncer::ModelTypeSet chosen_types) override;
42 void SetSyncSetupCompleted() override;
43 bool IsFirstSetupInProgress() const override;
44 void SetSetupInProgress(bool setup_in_progress) override;
45 bool IsSetupInProgress() const override;
46 bool ConfigurationDone() const override;
47 const GoogleServiceAuthError& GetAuthError() const override;
48 bool HasUnrecoverableError() const override;
49 bool IsBackendInitialized() const override;
50 OpenTabsUIDelegate* GetOpenTabsUIDelegate() override;
51 bool IsPassphraseRequiredForDecryption() const override;
52 base::Time GetExplicitPassphraseTime() const override;
53 bool IsUsingSecondaryPassphrase() const override;
54 void EnableEncryptEverything() override;
55 bool IsEncryptEverythingEnabled() const override;
56 void SetEncryptionPassphrase(const std::string& passphrase,
57 PassphraseType type) override;
58 bool SetDecryptionPassphrase(const std::string& passphrase) override;
59 bool IsCryptographerReady(
60 const syncer::BaseTransaction* trans) const override;
61 syncer::UserShare* GetUserShare() const override;
62 LocalDeviceInfoProvider* GetLocalDeviceInfoProvider() const override;
63 void RegisterDataTypeController(
64 sync_driver::DataTypeController* data_type_controller) override;
65 void ReenableDatatype(syncer::ModelType type) override;
66 void DeactivateDataType(syncer::ModelType type) override;
67 SyncTokenStatus GetSyncTokenStatus() const override;
68 std::string QuerySyncStatusSummaryString() override;
69 bool QueryDetailedSyncStatus(syncer::SyncStatus* result) override;
70 base::string16 GetLastSyncedTimeString() const override;
71 std::string GetBackendInitializationStateString() const override;
72 syncer::sessions::SyncSessionSnapshot GetLastSessionSnapshot() const override;
73 base::Value* GetTypeStatusMap() const override;
74 const GURL& sync_service_url() const override;
75 std::string unrecoverable_error_message() const override;
76 tracked_objects::Location unrecoverable_error_location() const override;
78 // DataTypeEncryptionHandler:
79 bool IsPassphraseRequired() const override;
80 syncer::ModelTypeSet GetEncryptedDataTypes() const override;
82 GoogleServiceAuthError error_;
83 GURL sync_service_url_;
84 std::string unrecoverable_error_message_;
85 scoped_ptr<syncer::UserShare> user_share_;
88 } // namespace sync_driver
90 #endif // COMPONENTS_SYNC_DRIVER_FAKE_SYNC_SERVICE_H_