#include "components/sync/model/processor_entity_tracker.h"
#include <utility>
#include "base/test/protobuf_matchers.h"
#include "base/test/scoped_feature_list.h"
#include "components/sync/base/features.h"
#include "components/sync/base/hash_util.h"
#include "components/sync/model/metadata_batch.h"
#include "components/sync/model/processor_entity.h"
#include "components/sync/protocol/unique_position.pb.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace syncer {
namespace {
EqualsProto;
ElementsAre;
IsNull;
NotNull;
UnorderedElementsAre;
constexpr char kEmptyStorageKey[] = …;
constexpr char kStorageKey1[] = …;
constexpr char kStorageKey2[] = …;
constexpr int64_t kServerVersion = …;
sync_pb::DataTypeState GenerateDataTypeState() { … }
std::unique_ptr<sync_pb::EntityMetadata> GenerateMetadata(
const std::string& storage_key,
const ClientTagHash& client_tag_hash) { … }
std::unique_ptr<sync_pb::EntityMetadata> GenerateTombstoneMetadata(
const std::string& storage_key,
const ClientTagHash& client_tag_hash) { … }
EntityData GenerateEntityData(const std::string& storage_key,
const ClientTagHash& client_tag_hash) { … }
UpdateResponseData GenerateUpdate(const std::string& storage_key,
const ClientTagHash& client_tag_hash,
int64_t response_version) { … }
EntityData GenerateSharedTabGroupDataEntityData(
const std::string& storage_key,
const ClientTagHash& client_tag_hash,
const std::string& collaboration_id) { … }
UpdateResponseData GenerateSharedTabGroupDataUpdate(
const std::string& storage_key,
const ClientTagHash& client_tag_hash,
const std::string& collaboration_id) { … }
sync_pb::UniquePosition GenerateUniquePosition(const ClientTagHash& hash) { … }
class ProcessorEntityTrackerTest : public ::testing::Test { … };
TEST_F(ProcessorEntityTrackerTest, ShouldLoadFromMetadata) { … }
TEST_F(ProcessorEntityTrackerTest, ShouldAddNewLocalEntity) { … }
TEST_F(ProcessorEntityTrackerTest, ShouldAddNewLocalEntityWithUniquePosition) { … }
TEST_F(ProcessorEntityTrackerTest, ShouldAddNewRemoteEntity) { … }
TEST_F(ProcessorEntityTrackerTest, ShouldAddNewRemoteEntityWithUniquePosition) { … }
TEST_F(ProcessorEntityTrackerTest, ShouldAddEntityWithoutStorageKey) { … }
TEST_F(ProcessorEntityTrackerTest, ShouldClearStorageKeyForTombstone) { … }
TEST_F(ProcessorEntityTrackerTest, ShouldOverrideTombstone) { … }
TEST_F(ProcessorEntityTrackerTest, ShouldRemoveEntityForStorageKey) { … }
TEST_F(ProcessorEntityTrackerTest, ShouldRemoveEntityForClientTagHash) { … }
TEST_F(ProcessorEntityTrackerTest, ShouldReturnLocalChanges) { … }
TEST_F(ProcessorEntityTrackerTest, ShouldUpdateSpecificsCacheOnLocalCreation) { … }
TEST_F(ProcessorEntityTrackerTest, ShouldUpdateSpecificsCacheOnRemoteCreation) { … }
TEST_F(ProcessorEntityTrackerTest, ShouldRemoveInactiveCollaborations) { … }
}
}