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 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
|
// Copyright 2013 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_ENGINE_FAKE_SYNC_ENGINE_H_
#define COMPONENTS_SYNC_ENGINE_FAKE_SYNC_ENGINE_H_
#include <memory>
#include <string>
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "components/sync/base/weak_handle.h"
#include "components/sync/engine/sync_engine.h"
namespace syncer {
// A mock of the SyncEngine.
//
// This class implements the bare minimum required for the ProfileSyncService to
// get through initialization. It often returns null pointers or nonesense
// values; it is not intended to be used in tests that depend on SyncEngine
// behavior.
class FakeSyncEngine : public SyncEngine {
public:
FakeSyncEngine();
~FakeSyncEngine() override;
void Initialize(InitParams params) override;
void TriggerRefresh(const ModelTypeSet& types) override;
void UpdateCredentials(const SyncCredentials& credentials) override;
void StartSyncingWithServer() override;
void SetEncryptionPassphrase(const std::string& passphrase,
bool is_explicit) override;
bool SetDecryptionPassphrase(const std::string& passphrase) override;
void StopSyncingForShutdown() override;
void Shutdown(ShutdownReason reason) override;
void ConfigureDataTypes(ConfigureParams params) override;
void EnableEncryptEverything() override;
void ActivateDirectoryDataType(ModelType type,
ModelSafeGroup group,
ChangeProcessor* change_processor) override;
void DeactivateDirectoryDataType(ModelType type) override;
void ActivateNonBlockingDataType(ModelType type,
std::unique_ptr<ActivationContext>) override;
void DeactivateNonBlockingDataType(ModelType type) override;
UserShare* GetUserShare() const override;
Status GetDetailedStatus() override;
bool HasUnsyncedItems() const override;
bool IsNigoriEnabled() const override;
PassphraseType GetPassphraseType() const override;
base::Time GetExplicitPassphraseTime() const override;
bool IsCryptographerReady(const BaseTransaction* trans) const override;
void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) const override;
void FlushDirectory() const override;
void RequestBufferedProtocolEventsAndEnableForwarding() override;
void DisableProtocolEventForwarding() override;
void EnableDirectoryTypeDebugInfoForwarding() override;
void DisableDirectoryTypeDebugInfoForwarding() override;
void RefreshTypesForTest(ModelTypeSet types) override;
void ClearServerData(
const SyncManager::ClearServerDataCallback& callback) override;
void OnCookieJarChanged(bool account_mismatch, bool empty_jar) override;
void set_fail_initial_download(bool should_fail);
private:
bool fail_initial_download_;
};
} // namespace syncer
#endif // COMPONENTS_SYNC_ENGINE_FAKE_SYNC_ENGINE_H_
|