#include "components/sync_bookmarks/local_bookmark_model_merger.h"
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "base/strings/utf_ostream_operators.h"
#include "base/strings/utf_string_conversions.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/test/test_bookmark_client.h"
#include "components/sync/base/features.h"
#include "components/sync_bookmarks/bookmark_model_view.h"
#include "components/sync_bookmarks/test_bookmark_model_view.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
#include "url/gurl.h"
namespace sync_bookmarks {
namespace {
ElementsAre;
IsEmpty;
Ne;
MATCHER_P2(MatchesUrl, title, url, "") { … }
MATCHER_P2(MatchesFolder, title, children_matcher, "") { … }
MATCHER_P(HasUuid, uuid, "") { … }
MATCHER_P3(MatchesUrlWithUuid, title, url, uuid, "") { … }
MATCHER_P3(MatchesFolderWithUuid, title, uuid, children_matcher, "") { … }
class UrlBuilder { … };
class FolderBuilder { … };
std::unique_ptr<TestBookmarkModelView> BuildLocalModel(
const std::vector<FolderBuilder::FolderOrUrl>& children_of_bookmark_bar) { … }
std::unique_ptr<TestBookmarkModelView> BuildAccountModel(
const std::vector<FolderBuilder::FolderOrUrl>& children_of_bookmark_bar) { … }
class LocalBookmarkModelMergerTest : public testing::Test { … };
TEST_F(LocalBookmarkModelMergerTest,
ShouldUploadEntireLocalModelIfAccountModelEmpty) { … }
TEST_F(LocalBookmarkModelMergerTest, ShouldIgnoreManagedNodes) { … }
TEST_F(LocalBookmarkModelMergerTest, ShouldUploadLocalUuid) { … }
TEST_F(LocalBookmarkModelMergerTest, ShouldNotUploadDuplicateBySemantics) { … }
TEST_F(LocalBookmarkModelMergerTest, ShouldMergeLocalAndAccountModels) { … }
TEST_F(LocalBookmarkModelMergerTest,
ShouldMergeLocalAndAccountNodesWhenAccountHasLegacyTruncatedTitle) { … }
TEST_F(LocalBookmarkModelMergerTest,
ShouldMergeLocalAndAccountNodesWhenLocalHasLegacyTruncatedTitle) { … }
TEST_F(LocalBookmarkModelMergerTest, ShouldMergeBookmarkByUuid) { … }
TEST_F(LocalBookmarkModelMergerTest,
ShouldMergeBookmarkByUuidDespiteDifferentParent) { … }
TEST_F(LocalBookmarkModelMergerTest,
ShouldNotMergeBySemanticsIfDifferentParent) { … }
TEST_F(LocalBookmarkModelMergerTest, ShouldMergeFolderByUuidAndNotSemantics) { … }
TEST_F(
LocalBookmarkModelMergerTest,
ShouldIgnoreFolderSemanticsMatchAndLaterMatchByUuidWithSemanticsNodeFirst) { … }
TEST_F(LocalBookmarkModelMergerTest,
ShouldIgnoreFolderSemanticsMatchAndLaterMatchByUuidWithUuidNodeFirst) { … }
TEST_F(LocalBookmarkModelMergerTest,
ShouldReplaceBookmarkUuidWithConflictingURLs) { … }
TEST_F(LocalBookmarkModelMergerTest,
ShouldReplaceBookmarkUuidWithConflictingTypes) { … }
TEST_F(LocalBookmarkModelMergerTest,
ShouldReplaceBookmarkUuidWithConflictingTypesAndLocalChildren) { … }
}
}