#include "components/sync/nigori/nigori_data_type_processor.h"
#include <memory>
#include <string>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/mock_callback.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "components/sync/base/client_tag_hash.h"
#include "components/sync/base/time.h"
#include "components/sync/engine/data_type_activation_response.h"
#include "components/sync/model/type_entities_count.h"
#include "components/sync/nigori/nigori_sync_bridge.h"
#include "components/sync/protocol/nigori_specifics.pb.h"
#include "components/sync/test/mock_commit_queue.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace syncer {
namespace {
_;
Eq;
Ne;
NotNull;
const char kRawNigoriClientTagHash[] = …;
const char kNigoriNonUniqueName[] = …;
const char kNigoriServerId[] = …;
const char kCacheGuid[] = …;
MATCHER_P(OptionalEntityDataHasDecryptorTokenKeyName, expected_key_name, "") { … }
void CaptureCommitRequest(CommitRequestDataList* dst,
CommitRequestDataList&& src) { … }
sync_pb::DataTypeState CreateDataTypeState() { … }
syncer::UpdateResponseData CreateFakeNigoriUpdateResponseData(
const std::string keystore_decryptor_token_key_name,
int response_version) { … }
CommitResponseData CreateNigoriCommitResponseData(
const CommitRequestData& commit_request_data,
int response_version) { … }
class MockNigoriSyncBridge : public NigoriSyncBridge { … };
class NigoriDataTypeProcessorTest : public testing::Test { … };
TEST_F(NigoriDataTypeProcessorTest,
ShouldTrackTheMetadataWhenInitialSyncDone) { … }
TEST_F(NigoriDataTypeProcessorTest, ShouldIncrementSequenceNumberWhenPut) { … }
TEST_F(NigoriDataTypeProcessorTest, ShouldGetEmptyLocalChanges) { … }
TEST_F(NigoriDataTypeProcessorTest, ShouldGetLocalChangesWhenPut) { … }
TEST_F(NigoriDataTypeProcessorTest,
ShouldSquashCommitRequestUponCommitCompleted) { … }
TEST_F(NigoriDataTypeProcessorTest,
ShouldNotSquashCommitRequestUponEmptyCommitResponse) { … }
TEST_F(NigoriDataTypeProcessorTest,
ShouldKeepAnotherCommitRequestUponCommitCompleted) { … }
TEST_F(NigoriDataTypeProcessorTest,
ShouldNudgeForCommitUponConnectSyncIfReadyToSyncAndLocalChanges) { … }
TEST_F(NigoriDataTypeProcessorTest, ShouldNudgeForCommitUponPutIfReadyToSync) { … }
TEST_F(NigoriDataTypeProcessorTest, ShouldInvokeSyncStartCallback) { … }
TEST_F(NigoriDataTypeProcessorTest, ShouldMergeFullSyncData) { … }
TEST_F(NigoriDataTypeProcessorTest, ShouldApplyIncrementalSyncChanges) { … }
TEST_F(NigoriDataTypeProcessorTest,
ShouldApplyIncrementalSyncChangesWhenEmptyUpdates) { … }
TEST_F(NigoriDataTypeProcessorTest,
ShouldApplyIncrementalSyncChangesWhenReflection) { … }
TEST_F(NigoriDataTypeProcessorTest, ShouldStopSyncingAndKeepMetadata) { … }
TEST_F(NigoriDataTypeProcessorTest, ShouldStopSyncingAndClearMetadata) { … }
TEST_F(NigoriDataTypeProcessorTest, ShouldResetDataOnCacheGuidMismatch) { … }
TEST_F(NigoriDataTypeProcessorTest,
ShouldDisconnectWhenMergeFullSyncDataFails) { … }
TEST_F(NigoriDataTypeProcessorTest,
ShouldDisconnectWhenApplyIncrementalSyncChangesFails) { … }
TEST_F(NigoriDataTypeProcessorTest,
ShouldCallErrorHandlerIfModelErrorBeforeSyncStarts) { … }
TEST_F(NigoriDataTypeProcessorTest,
ShouldUpdateDataTypeStateUponHandlingInvalidations) { … }
}
}