chromium/chrome/browser/sync/test/integration/single_client_reading_list_sync_test.cc

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/location.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/reading_list/reading_list_model_factory.h"
#include "chrome/browser/sync/test/integration/fake_server_match_status_checker.h"
#include "chrome/browser/sync/test/integration/sync_service_impl_harness.h"
#include "chrome/browser/sync/test/integration/sync_test.h"
#include "components/reading_list/core/mock_reading_list_model_observer.h"
#include "components/reading_list/core/reading_list_entry.h"
#include "components/reading_list/core/reading_list_model.h"
#include "components/sync/base/data_type.h"
#include "components/sync/base/features.h"
#include "components/sync/base/time.h"
#include "components/sync/engine/loopback_server/persistent_unique_client_entity.h"
#include "components/sync/protocol/entity_specifics.pb.h"
#include "components/sync/protocol/proto_value_conversions.h"
#include "components/sync/protocol/reading_list_specifics.pb.h"
#include "components/sync/test/test_matchers.h"
#include "components/version_info/version_info.h"
#include "content/public/test/browser_test.h"

namespace {

MatchesDeletionOrigin;
ElementsAre;
Eq;

// Checker used to block until the reading list URLs on the server match a
// given set of expected reading list URLs.
class ServerReadingListURLsEqualityChecker
    : public fake_server::FakeServerMatchStatusChecker {};

class LocalReadingListURLsEqualityChecker
    : public StatusChangeChecker,
      public testing::NiceMock<MockReadingListModelObserver> {};

// Checker used to block until the reading set titles on the server match a
// given set of expected reading list titles.
class ServerReadingListTitlesEqualityChecker
    : public fake_server::FakeServerMatchStatusChecker {};

void WaitForReadingListModelLoaded(ReadingListModel* reading_list_model) {}

std::unique_ptr<syncer::LoopbackServerEntity> CreateTestReadingListEntity(
    const GURL& url,
    const std::string& entry_title) {}

class SingleClientReadingListSyncTest : public SyncTest {};

IN_PROC_BROWSER_TEST_F(SingleClientReadingListSyncTest,
                       ShouldDownloadAccountDataUponSignin) {}

IN_PROC_BROWSER_TEST_F(SingleClientReadingListSyncTest,
                       ShouldUploadOnlyEntriesCreatedAfterSignin) {}

IN_PROC_BROWSER_TEST_F(SingleClientReadingListSyncTest,
                       ShouldDeleteTheDeletedEntryFromTheServer) {}

IN_PROC_BROWSER_TEST_F(SingleClientReadingListSyncTest,
                       ShouldDeleteAllEntriesFromTheServer) {}

// ChromeOS doesn't have the concept of sign-out, so this only exists on other
// platforms.
#if !BUILDFLAG(IS_CHROMEOS_ASH)

IN_PROC_BROWSER_TEST_F(SingleClientReadingListSyncTest,
                       ShouldDeleteAccountDataUponSignout) {}

IN_PROC_BROWSER_TEST_F(SingleClientReadingListSyncTest,
                       ShouldUpdateEntriesLocallyAndServerSide) {}

IN_PROC_BROWSER_TEST_F(SingleClientReadingListSyncTest,
                       ShouldUploadAllEntriesToTheSyncServer) {}

IN_PROC_BROWSER_TEST_F(
    SingleClientReadingListSyncTest,
    ShouldFilterEntriesWithEmptyEntryIdUponIncrementalRemoteCreation) {}

IN_PROC_BROWSER_TEST_F(
    SingleClientReadingListSyncTest,
    ShouldFilterEntriesWithEmptyUrlUponIncrementalRemoteCreation) {}

IN_PROC_BROWSER_TEST_F(
    SingleClientReadingListSyncTest,
    ShouldFilterEntriesWithUnequalEntryIdAndUrlUponIncrementalRemoteCreation) {}

IN_PROC_BROWSER_TEST_F(
    SingleClientReadingListSyncTest,
    ShouldFilterEntriesWithInvalidUrlUponIncrementalRemoteCreation) {}

// TODO: crbug.com/41490059 - Flaky on Android
#if BUILDFLAG(IS_ANDROID)
#define MAYBE_ShouldFilterEntriesWithEmptyEntryIdUponIncrementalRemoteUpdate
#else
#define MAYBE_ShouldFilterEntriesWithEmptyEntryIdUponIncrementalRemoteUpdate
#endif
IN_PROC_BROWSER_TEST_F(
    SingleClientReadingListSyncTest,
    MAYBE_ShouldFilterEntriesWithEmptyEntryIdUponIncrementalRemoteUpdate) {}

IN_PROC_BROWSER_TEST_F(
    SingleClientReadingListSyncTest,
    ShouldFilterEntriesWithEmptyUrlUponIncrementalRemoteUpdate) {}

IN_PROC_BROWSER_TEST_F(
    SingleClientReadingListSyncTest,
    ShouldFilterEntriesWithUnequalEntryIdAndUrlUponIncrementalRemoteUpdate) {}

IN_PROC_BROWSER_TEST_F(
    SingleClientReadingListSyncTest,
    ShouldFilterEntriesWithInvalidUrlUponIncrementalRemoteUpdate) {}

#endif  // !BUILDFLAG(IS_CHROMEOS_ASH)

}  // namespace