#include "components/sync/test/mock_data_type_worker.h"
#include <map>
#include <set>
#include <utility>
#include "base/check_op.h"
#include "base/containers/adapters.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/ptr_util.h"
#include "base/notreached.h"
#include "base/run_loop.h"
#include "components/sync/base/data_type.h"
#include "components/sync/protocol/data_type_progress_marker.pb.h"
#include "components/sync/protocol/entity_specifics.pb.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace syncer {
namespace {
UnorderedElementsAreArray;
class ForwardingCommitQueue : public CommitQueue { … };
}
std::unique_ptr<MockDataTypeWorker>
MockDataTypeWorker::CreateWorkerAndConnectSync(
std::unique_ptr<DataTypeActivationResponse> context) { … }
MockDataTypeWorker::MockDataTypeWorker(
std::unique_ptr<DataTypeActivationResponse> context)
: … { … }
MockDataTypeWorker::~MockDataTypeWorker() = default;
void MockDataTypeWorker::NudgeForCommit() { … }
void MockDataTypeWorker::LocalChangesReceived(
CommitRequestDataList&& commit_request) { … }
size_t MockDataTypeWorker::GetNumPendingCommits() const { … }
std::vector<const CommitRequestData*> MockDataTypeWorker::GetNthPendingCommit(
size_t n) const { … }
bool MockDataTypeWorker::HasPendingCommitForHash(
const ClientTagHash& tag_hash) const { … }
const CommitRequestData* MockDataTypeWorker::GetLatestPendingCommitForHash(
const ClientTagHash& tag_hash) const { … }
void MockDataTypeWorker::VerifyNthPendingCommit(
size_t n,
const std::vector<ClientTagHash>& tag_hashes,
const std::vector<sync_pb::EntitySpecifics>& specifics_list) { … }
void MockDataTypeWorker::VerifyPendingCommits(
const std::vector<std::vector<ClientTagHash>>& tag_hashes) { … }
void MockDataTypeWorker::UpdateDataTypeState(
const sync_pb::DataTypeState& data_type_state) { … }
void MockDataTypeWorker::UpdateFromServer() { … }
void MockDataTypeWorker::UpdateFromServer(
const ClientTagHash& tag_hash,
const sync_pb::EntitySpecifics& specifics) { … }
void MockDataTypeWorker::UpdateFromServer(
const ClientTagHash& tag_hash,
const sync_pb::EntitySpecifics& specifics,
int64_t version_offset) { … }
void MockDataTypeWorker::UpdateFromServer(
const ClientTagHash& tag_hash,
const sync_pb::EntitySpecifics& specifics,
int64_t version_offset,
const std::string& ekn) { … }
void MockDataTypeWorker::UpdateFromServer(
UpdateResponseDataList updates,
std::optional<sync_pb::GarbageCollectionDirective> gc_directive) { … }
syncer::UpdateResponseData MockDataTypeWorker::GenerateUpdateData(
const ClientTagHash& tag_hash,
const sync_pb::EntitySpecifics& specifics,
int64_t version_offset,
const std::string& ekn) { … }
syncer::UpdateResponseData MockDataTypeWorker::GenerateUpdateData(
const ClientTagHash& tag_hash,
const sync_pb::EntitySpecifics& specifics) { … }
syncer::UpdateResponseData MockDataTypeWorker::GenerateSharedUpdateData(
const ClientTagHash& tag_hash,
const sync_pb::EntitySpecifics& specifics,
const std::string& collaboration_id) { … }
syncer::UpdateResponseData MockDataTypeWorker::GenerateTypeRootUpdateData(
const DataType& data_type) { … }
syncer::UpdateResponseData MockDataTypeWorker::GenerateTombstoneUpdateData(
const ClientTagHash& tag_hash) { … }
void MockDataTypeWorker::TombstoneFromServer(const ClientTagHash& tag_hash) { … }
void MockDataTypeWorker::AckOnePendingCommit() { … }
void MockDataTypeWorker::AckOnePendingCommit(int64_t version_offset) { … }
void MockDataTypeWorker::FailOneCommit() { … }
void MockDataTypeWorker::FailFullCommitRequest() { … }
CommitResponseData MockDataTypeWorker::SuccessfulCommitResponse(
const CommitRequestData& request_data,
int64_t version_offset) { … }
FailedCommitResponseData MockDataTypeWorker::FailedCommitResponse(
const CommitRequestData& request_data) { … }
void MockDataTypeWorker::UpdateWithEncryptionKey(const std::string& ekn) { … }
void MockDataTypeWorker::UpdateWithEncryptionKey(
const std::string& ekn,
UpdateResponseDataList update) { … }
void MockDataTypeWorker::DisableGetLocalChangesUponNudge() { … }
std::string MockDataTypeWorker::GenerateId(const ClientTagHash& tag_hash) { … }
int64_t MockDataTypeWorker::GetServerVersion(const ClientTagHash& tag_hash) { … }
void MockDataTypeWorker::SetServerVersion(const ClientTagHash& tag_hash,
int64_t version) { … }
}