blob: d0cc5520efa88dd3129447379a15a8172992e34f [file] [log] [blame]
// 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 <memory>
#include <string>
#include "components/sync/driver/sync_service.h"
#include "google_apis/gaia/google_service_auth_error.h"
#include "url/gurl.h"
namespace syncer {
// Minimal fake implementation of SyncService. All methods return inactive/
// empty/null etc. Tests can subclass this to override the parts they need, but
// should consider using TestSyncService instead.
class FakeSyncService : public SyncService {
public:
FakeSyncService();
~FakeSyncService() override;
// Dummy methods.
// SyncService implementation.
syncer::SyncUserSettings* GetUserSettings() override;
const syncer::SyncUserSettings* GetUserSettings() const override;
int GetDisableReasons() const override;
TransportState GetTransportState() const override;
CoreAccountInfo GetAuthenticatedAccountInfo() const override;
bool IsAuthenticatedAccountPrimary() const override;
bool IsLocalSyncEnabled() const override;
void TriggerRefresh(const ModelTypeSet& types) override;
ModelTypeSet GetActiveDataTypes() const override;
void AddObserver(SyncServiceObserver* observer) override;
void RemoveObserver(SyncServiceObserver* observer) override;
bool HasObserver(const SyncServiceObserver* observer) const override;
void OnDataTypeRequestsSyncStartup(ModelType type) override;
void StopAndClear() override;
ModelTypeSet GetRegisteredDataTypes() const override;
ModelTypeSet GetPreferredDataTypes() const override;
std::unique_ptr<SyncSetupInProgressHandle> GetSetupInProgressHandle()
override;
bool IsSetupInProgress() const override;
GoogleServiceAuthError GetAuthError() const override;
base::Time GetAuthErrorTime() const override;
bool RequiresClientUpgrade() const override;
UserShare* GetUserShare() const override;
void DataTypePreconditionChanged(syncer::ModelType type) override;
SyncTokenStatus GetSyncTokenStatusForDebugging() const override;
bool QueryDetailedSyncStatusForDebugging(SyncStatus* result) const override;
base::Time GetLastSyncedTimeForDebugging() const override;
SyncCycleSnapshot GetLastCycleSnapshotForDebugging() const override;
std::unique_ptr<base::Value> GetTypeStatusMapForDebugging() override;
const GURL& GetSyncServiceUrlForDebugging() const override;
std::string GetUnrecoverableErrorMessageForDebugging() const override;
base::Location GetUnrecoverableErrorLocationForDebugging() const override;
void AddProtocolEventObserver(ProtocolEventObserver* observer) override;
void RemoveProtocolEventObserver(ProtocolEventObserver* observer) override;
void AddTypeDebugInfoObserver(TypeDebugInfoObserver* observer) override;
void RemoveTypeDebugInfoObserver(TypeDebugInfoObserver* observer) override;
base::WeakPtr<JsController> GetJsController() override;
void GetAllNodesForDebugging(
const base::Callback<void(std::unique_ptr<base::ListValue>)>& callback)
override;
void SetInvalidationsForSessionsEnabled(bool enabled) override;
UserDemographicsResult GetUserDemographics(base::Time now) override;
// KeyedService implementation.
void Shutdown() override;
private:
GURL sync_service_url_;
std::unique_ptr<UserShare> user_share_;
};
} // namespace syncer
#endif // COMPONENTS_SYNC_DRIVER_FAKE_SYNC_SERVICE_H_