#include "components/sync_bookmarks/synced_bookmark_tracker.h"
#include "base/base64.h"
#include "base/hash/hash.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/uuid.h"
#include "components/bookmarks/browser/bookmark_model.h"
#include "components/bookmarks/browser/bookmark_node.h"
#include "components/bookmarks/browser/bookmark_utils.h"
#include "components/bookmarks/test/test_bookmark_client.h"
#include "components/sync/base/client_tag_hash.h"
#include "components/sync/base/features.h"
#include "components/sync/base/time.h"
#include "components/sync/base/unique_position.h"
#include "components/sync/protocol/bookmark_model_metadata.pb.h"
#include "components/sync/protocol/data_type_state.pb.h"
#include "components/sync/protocol/entity_data.h"
#include "components/sync/protocol/entity_specifics.pb.h"
#include "components/sync_bookmarks/bookmark_model_view.h"
#include "components/sync_bookmarks/switches.h"
#include "components/sync_bookmarks/synced_bookmark_tracker_entity.h"
#include "components/sync_bookmarks/test_bookmark_model_view.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
Eq;
IsNull;
NotNull;
namespace sync_bookmarks {
namespace {
constexpr int kNumPermanentNodes = …;
const char kBookmarkBarId[] = …;
const char kMobileBookmarksId[] = …;
const char kOtherBookmarksId[] = …;
enum class ExpectedCorruptionReason { … };
sync_pb::EntitySpecifics GenerateSpecifics(const std::string& title,
const std::string& url) { … }
sync_pb::BookmarkMetadata CreateNodeMetadata(
const bookmarks::BookmarkNode* node,
const std::string& server_id) { … }
sync_pb::BookmarkMetadata CreateTombstoneMetadata(
const std::string& server_id,
const syncer::ClientTagHash& client_tag_hash) { … }
sync_pb::BookmarkModelMetadata CreateMetadataForPermanentNodes(
const BookmarkModelView* bookmark_model) { … }
TEST(SyncedBookmarkTrackerTest, ShouldAddEntity) { … }
TEST(SyncedBookmarkTrackerTest, ShouldRemoveEntity) { … }
TEST(SyncedBookmarkTrackerTest, ShouldBuildBookmarkModelMetadata) { … }
TEST(SyncedBookmarkTrackerTest,
ShouldRequireCommitRequestWhenSequenceNumberIsIncremented) { … }
TEST(SyncedBookmarkTrackerTest, ShouldAckSequenceNumber) { … }
TEST(SyncedBookmarkTrackerTest, ShouldUpdateUponCommitResponseWithNewId) { … }
TEST(SyncedBookmarkTrackerTest, ShouldUpdateId) { … }
TEST(SyncedBookmarkTrackerTest,
ShouldMaintainTombstoneOrderBetweenCtorAndBuildBookmarkModelMetadata) { … }
TEST(SyncedBookmarkTrackerTest,
ShouldMaintainOrderOfMarkDeletedCallsWhenBuildBookmarkModelMetadata) { … }
TEST(SyncedBookmarkTrackerTest, ShouldMarkDeleted) { … }
TEST(SyncedBookmarkTrackerTest, ShouldUndeleteTombstone) { … }
TEST(SyncedBookmarkTrackerTest,
ShouldOrderParentUpdatesBeforeChildUpdatesAndDeletionsComeLast) { … }
TEST(SyncedBookmarkTrackerTest, ShouldNotInvalidateMetadata) { … }
TEST(SyncedBookmarkTrackerTest, ShouldNotRequireClientTagsForPermanentNodes) { … }
TEST(SyncedBookmarkTrackerTest, ShouldInvalidateMetadataIfMissingMobileFolder) { … }
TEST(SyncedBookmarkTrackerTest, ShouldInvalidateMetadataIfMissingServerId) { … }
TEST(SyncedBookmarkTrackerTest,
ShouldInvalidateMetadataIfMissingLocalBookmarkId) { … }
TEST(SyncedBookmarkTrackerTest,
ShouldInvalidateMetadataIfTombstoneHasBookmarkId) { … }
TEST(SyncedBookmarkTrackerTest,
ShouldInvalidateMetadataIfUnknownLocalBookmarkId) { … }
TEST(SyncedBookmarkTrackerTest, ShouldInvalidateMetadataIfGuidMismatch) { … }
TEST(SyncedBookmarkTrackerTest,
ShouldInvalidateMetadataIfTombstoneHasDuplicatedClientTagHash) { … }
TEST(SyncedBookmarkTrackerTest,
ShouldInvalidateMetadataIfMissingClientTagHash) { … }
TEST(SyncedBookmarkTrackerTest,
ShouldInvalidateMetadataIfUnsyncableNodeIsTracked) { … }
TEST(SyncedBookmarkTrackerTest, ShouldInvalidateMetadataIfMissingFaviconHash) { … }
TEST(SyncedBookmarkTrackerTest,
ShouldInvalidateMetadataIfPermanentFolderMissingLocally) { … }
TEST(SyncedBookmarkTrackerTest,
ShouldMatchModelWithUnsyncableNodesAndMetadata) { … }
TEST(SyncedBookmarkTrackerTest,
ShouldPopulateFaviconHashForNewlyAddedEntities) { … }
TEST(SyncedBookmarkTrackerTest, ShouldPopulateFaviconHashUponUpdate) { … }
TEST(SyncedBookmarkTrackerTest, ShouldNotReuploadEntitiesAfterMergeAndRestart) { … }
TEST(SyncedBookmarkTrackerTest,
ShouldReportZeroIgnoredUpdateDueToMissingParentForNewTracker) { … }
TEST(SyncedBookmarkTrackerTest,
ShouldResetReuploadFlagOnDisabledFeatureToggle) { … }
TEST(SyncedBookmarkTrackerTest,
ShouldRestoreZeroIgnoredUpdateDueToMissingParent) { … }
TEST(SyncedBookmarkTrackerTest,
ShouldRestoreUnknownIgnoredUpdateDueToMissingParent) { … }
TEST(SyncedBookmarkTrackerTest,
ShouldRestoreNonZeroIgnoredUpdateDueToMissingParent) { … }
TEST(SyncedBookmarkTrackerTest, ShouldRecordIgnoredUpdateDueToMissingParent) { … }
TEST(SyncedBookmarkTrackerTest,
ShouldPartiallyRecordIgnoredUpdateDueToMissingParentIfCounterUnknown) { … }
}
}