#ifndef SYNC_INTERNAL_API_PUBLIC_TEST_FAKE_SYNC_MANAGER_H_
#define SYNC_INTERNAL_API_PUBLIC_TEST_FAKE_SYNC_MANAGER_H_
#include <string>
#include "base/memory/ref_counted.h"
#include "base/observer_list.h"
#include "sync/internal_api/public/sync_manager.h"
#include "sync/internal_api/public/test/test_user_share.h"
#include "sync/notifier/invalidator_registrar.h"
namespace base {
class SequencedTaskRunner;
}
namespace syncer {
class FakeSyncEncryptionHandler;
class FakeSyncManager : public SyncManager {
public:
FakeSyncManager(ModelTypeSet initial_sync_ended_types,
ModelTypeSet progress_marker_types,
ModelTypeSet configure_fail_types);
virtual ~FakeSyncManager();
ModelTypeSet GetAndResetCleanedTypes();
ModelTypeSet GetAndResetDownloadedTypes();
ModelTypeSet GetAndResetEnabledTypes();
ModelTypeSet GetLastRefreshRequestTypes();
ConfigureReason GetAndResetConfigureReason();
virtual void OnIncomingInvalidation(
const ObjectIdInvalidationMap& invalidation_map) OVERRIDE;
virtual void OnInvalidatorStateChange(InvalidatorState state) OVERRIDE;
virtual std::string GetOwnerName() const OVERRIDE;
void WaitForSyncThread();
virtual void Init(
const base::FilePath& database_location,
const WeakHandle<JsEventHandler>& event_handler,
const std::string& sync_server_and_path,
int sync_server_port,
bool use_ssl,
scoped_ptr<HttpPostProviderFactory> post_factory,
const std::vector<scoped_refptr<ModelSafeWorker> >& workers,
ExtensionsActivity* extensions_activity,
ChangeDelegate* change_delegate,
const SyncCredentials& credentials,
const std::string& invalidator_client_id,
const std::string& restored_key_for_bootstrapping,
const std::string& restored_keystore_key_for_bootstrapping,
InternalComponentsFactory* internal_components_factory,
Encryptor* encryptor,
scoped_ptr<UnrecoverableErrorHandler> unrecoverable_error_handler,
ReportUnrecoverableErrorFunction report_unrecoverable_error_function,
CancelationSignal* cancelation_signal) OVERRIDE;
virtual void ThrowUnrecoverableError() OVERRIDE;
virtual ModelTypeSet InitialSyncEndedTypes() OVERRIDE;
virtual ModelTypeSet GetTypesWithEmptyProgressMarkerToken(
ModelTypeSet types) OVERRIDE;
virtual bool PurgePartiallySyncedTypes() OVERRIDE;
virtual void UpdateCredentials(const SyncCredentials& credentials) OVERRIDE;
virtual void StartSyncingNormally(
const ModelSafeRoutingInfo& routing_info) OVERRIDE;
virtual void ConfigureSyncer(
ConfigureReason reason,
ModelTypeSet to_download,
ModelTypeSet to_purge,
ModelTypeSet to_journal,
ModelTypeSet to_unapply,
const ModelSafeRoutingInfo& new_routing_info,
const base::Closure& ready_task,
const base::Closure& retry_task) OVERRIDE;
virtual void AddObserver(Observer* observer) OVERRIDE;
virtual void RemoveObserver(Observer* observer) OVERRIDE;
virtual SyncStatus GetDetailedStatus() const OVERRIDE;
virtual void SaveChanges() OVERRIDE;
virtual void ShutdownOnSyncThread() OVERRIDE;
virtual UserShare* GetUserShare() OVERRIDE;
virtual base::WeakPtr<syncer::SyncCore> GetSyncCore() OVERRIDE;
virtual const std::string cache_guid() OVERRIDE;
virtual bool ReceivedExperiment(Experiments* experiments) OVERRIDE;
virtual bool HasUnsyncedItems() OVERRIDE;
virtual SyncEncryptionHandler* GetEncryptionHandler() OVERRIDE;
virtual ScopedVector<syncer::ProtocolEvent>
GetBufferedProtocolEvents() OVERRIDE;
virtual void RefreshTypes(ModelTypeSet types) OVERRIDE;
private:
scoped_refptr<base::SequencedTaskRunner> sync_task_runner_;
ObserverList<SyncManager::Observer> observers_;
ModelTypeSet initial_sync_ended_types_;
ModelTypeSet progress_marker_types_;
ModelTypeSet configure_fail_types_;
ModelTypeSet cleaned_types_;
ModelTypeSet downloaded_types_;
ModelTypeSet enabled_types_;
InvalidatorRegistrar registrar_;
ModelTypeSet last_refresh_request_types_;
ConfigureReason last_configure_reason_;
scoped_ptr<FakeSyncEncryptionHandler> fake_encryption_handler_;
TestUserShare test_user_share_;
DISALLOW_COPY_AND_ASSIGN(FakeSyncManager);
};
}
#endif