#include "components/sync/test/fake_data_type_sync_bridge.h"
#include <set>
#include <utility>
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/string_number_conversions.h"
#include "components/sync/base/client_tag_hash.h"
#include "components/sync/base/data_type.h"
#include "components/sync/base/deletion_origin.h"
#include "components/sync/model/conflict_resolution.h"
#include "components/sync/model/data_type_store.h"
#include "components/sync/model/in_memory_metadata_change_list.h"
#include "components/sync/model/metadata_batch.h"
#include "components/sync/model/mutable_data_batch.h"
#include "components/sync/protocol/data_type_state.pb.h"
#include "components/sync/protocol/entity_data.h"
#include "components/sync/protocol/entity_metadata.pb.h"
#include "components/sync/protocol/entity_specifics.pb.h"
#include "components/sync/protocol/unique_position.pb.h"
#include "testing/gtest/include/gtest/gtest.h"
DataTypeState;
EntityMetadata;
EntitySpecifics;
namespace syncer {
namespace {
class TestMetadataChangeList : public MetadataChangeList { … };
}
std::string FakeDataTypeSyncBridge::ClientTagFromKey(const std::string& key) { … }
FakeDataTypeSyncBridge::Store::Store() = default;
FakeDataTypeSyncBridge::Store::~Store() = default;
void FakeDataTypeSyncBridge::Store::PutData(const std::string& key,
const EntityData& data) { … }
void FakeDataTypeSyncBridge::Store::PutMetadata(
const std::string& key,
const EntityMetadata& metadata) { … }
void FakeDataTypeSyncBridge::Store::RemoveData(const std::string& key) { … }
void FakeDataTypeSyncBridge::Store::ClearAllData() { … }
void FakeDataTypeSyncBridge::Store::RemoveMetadata(const std::string& key) { … }
bool FakeDataTypeSyncBridge::Store::HasData(const std::string& key) const { … }
bool FakeDataTypeSyncBridge::Store::HasMetadata(const std::string& key) const { … }
const EntityData& FakeDataTypeSyncBridge::Store::GetData(
const std::string& key) const { … }
const sync_pb::EntityMetadata& FakeDataTypeSyncBridge::Store::GetMetadata(
const std::string& key) const { … }
std::unique_ptr<MetadataBatch>
FakeDataTypeSyncBridge::Store::CreateMetadataBatch() const { … }
void FakeDataTypeSyncBridge::Store::Reset() { … }
FakeDataTypeSyncBridge::FakeDataTypeSyncBridge(
DataType type,
std::unique_ptr<DataTypeLocalChangeProcessor> change_processor)
: … { … }
FakeDataTypeSyncBridge::~FakeDataTypeSyncBridge() { … }
void FakeDataTypeSyncBridge::WriteItem(
const std::string& key,
std::unique_ptr<EntityData> entity_data) { … }
void FakeDataTypeSyncBridge::DeleteItem(const std::string& key) { … }
void FakeDataTypeSyncBridge::MimicBugToLooseItemWithoutNotifyingProcessor(
const std::string& key) { … }
std::unique_ptr<MetadataChangeList>
FakeDataTypeSyncBridge::CreateMetadataChangeList() { … }
std::optional<ModelError> FakeDataTypeSyncBridge::MergeFullSyncData(
std::unique_ptr<MetadataChangeList> metadata_change_list,
EntityChangeList entity_data) { … }
std::optional<ModelError> FakeDataTypeSyncBridge::ApplyIncrementalSyncChanges(
std::unique_ptr<MetadataChangeList> metadata_changes,
EntityChangeList entity_changes) { … }
void FakeDataTypeSyncBridge::ApplyMetadataChangeList(
std::unique_ptr<MetadataChangeList> mcl) { … }
std::unique_ptr<DataBatch> FakeDataTypeSyncBridge::GetDataForCommit(
StorageKeyList keys) { … }
std::unique_ptr<DataBatch> FakeDataTypeSyncBridge::GetAllDataForDebugging() { … }
std::string FakeDataTypeSyncBridge::GetClientTag(
const EntityData& entity_data) { … }
std::string FakeDataTypeSyncBridge::GetStorageKey(
const EntityData& entity_data) { … }
std::string FakeDataTypeSyncBridge::GetStorageKeyInternal(
const EntityData& entity_data) { … }
std::string FakeDataTypeSyncBridge::GenerateStorageKey(
const EntityData& entity_data) { … }
bool FakeDataTypeSyncBridge::SupportsGetClientTag() const { … }
bool FakeDataTypeSyncBridge::SupportsGetStorageKey() const { … }
bool FakeDataTypeSyncBridge::SupportsUniquePositions() const { … }
sync_pb::UniquePosition FakeDataTypeSyncBridge::GetUniquePosition(
const sync_pb::EntitySpecifics& specifics) const { … }
ConflictResolution FakeDataTypeSyncBridge::ResolveConflict(
const std::string& storage_key,
const EntityData& remote_data) const { … }
sync_pb::EntitySpecifics
FakeDataTypeSyncBridge::TrimAllSupportedFieldsFromRemoteSpecifics(
const sync_pb::EntitySpecifics& entity_specifics) const { … }
bool FakeDataTypeSyncBridge::IsEntityDataValid(
const EntityData& entity_data) const { … }
void FakeDataTypeSyncBridge::SetConflictResolution(
ConflictResolution resolution) { … }
void FakeDataTypeSyncBridge::ErrorOnNextCall() { … }
std::unique_ptr<EntityData> FakeDataTypeSyncBridge::CopyEntityData(
const EntityData& old_data) { … }
void FakeDataTypeSyncBridge::SetSupportsGetClientTag(
bool supports_get_client_tag) { … }
bool FakeDataTypeSyncBridge::EntityHasClientTag(const EntityData& entity) { … }
void FakeDataTypeSyncBridge::SetSupportsGetStorageKey(
bool supports_get_storage_key) { … }
std::string FakeDataTypeSyncBridge::GetLastGeneratedStorageKey() const { … }
void FakeDataTypeSyncBridge::AddPrefValueToIgnore(const std::string& value) { … }
void FakeDataTypeSyncBridge::TreatRemoteUpdateAsInvalid(
const ClientTagHash& client_tag_hash) { … }
void FakeDataTypeSyncBridge::EnableUniquePositionSupport(
ExtractUniquePositionCallback callback) { … }
}