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

// Copyright 2020 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/memory/raw_ptr.h"
#include "base/time/time.h"
#include "chrome/browser/sync/device_info_sync_service_factory.h"
#include "chrome/browser/sync/sync_invalidations_service_factory.h"
#include "chrome/browser/sync/test/integration/bookmarks_helper.h"
#include "chrome/browser/sync/test/integration/device_info_helper.h"
#include "chrome/browser/sync/test/integration/fake_server_match_status_checker.h"
#include "chrome/browser/sync/test/integration/single_client_status_change_checker.h"
#include "chrome/browser/sync/test/integration/sync_service_impl_harness.h"
#include "chrome/browser/sync/test/integration/sync_test.h"
#include "components/bookmarks/browser/bookmark_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/cycle/sync_cycle_snapshot.h"
#include "components/sync/invalidations/sync_invalidations_service.h"
#include "components/sync/protocol/data_type_progress_marker.pb.h"
#include "components/sync/protocol/device_info_specifics.pb.h"
#include "components/sync/protocol/entity_specifics.pb.h"
#include "components/sync/protocol/sync.pb.h"
#include "components/sync/protocol/sync_entity.pb.h"
#include "components/sync/protocol/sync_enums.pb.h"
#include "components/sync/service/glue/sync_transport_data_prefs.h"
#include "components/sync/test/bookmark_entity_builder.h"
#include "components/sync/test/entity_builder_factory.h"
#include "components/sync_device_info/device_info_sync_service.h"
#include "components/sync_device_info/device_info_tracker.h"
#include "components/sync_device_info/device_info_util.h"
#include "content/public/test/browser_test.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace {

AddFolder;
GetBookmarkBarNode;
ServerBookmarksEqualityChecker;
DataType;
AllOf;
Contains;
ElementsAre;
IsEmpty;
Not;
NotNull;
SizeIs;

constexpr char kSyncedBookmarkURL[] =;
constexpr char kSyncedBookmarkTitle[] =;

syncer::DataTypeSet DefaultInterestedDataTypes() {}

// Injects a new bookmark into the |fake_server| and returns a UUID of a created
// entity. Note that this trigges an invalidations from the server.
base::Uuid InjectSyncedBookmark(fake_server::FakeServer* fake_server) {}

MATCHER_P(HasBeenUpdatedAfter, last_updated_timestamp, "") {}

MATCHER_P(HasCacheGuid, expected_cache_guid, "") {}

MATCHER_P(InterestedDataTypesAre, expected_data_types, "") {}

MATCHER_P(InterestedDataTypesContain, expected_data_type, "") {}

MATCHER(HasInstanceIdToken, "") {}

MATCHER_P(HasInstanceIdToken, expected_token, "") {}

sync_pb::DataTypeProgressMarker GetProgressMarkerForType(
    const sync_pb::GetUpdatesMessage& gu_message,
    DataType type) {}

class GetUpdatesFailureChecker : public SingleClientStatusChangeChecker {};

// Waits for a successful GetUpdates request containing a notification for the
// given |type|.
class NotificationHintChecker
    : public fake_server::FakeServerMatchStatusChecker {};

// This class helps to count the number of GU_TRIGGER events for the |type|
// since the object has been created.
class GetUpdatesTriggeredObserver : public fake_server::FakeServer::Observer {};

sync_pb::DeviceInfoSpecifics CreateDeviceInfoSpecifics(
    const std::string& cache_guid,
    syncer::DataTypeSet interested_data_types,
    const std::string& fcm_registration_token) {}

class SingleClientSyncInvalidationsTest : public SyncTest {};

IN_PROC_BROWSER_TEST_F(SingleClientSyncInvalidationsTest,
                       SendInterestedDataTypesAndFCMTokenAsPartOfDeviceInfo) {}

IN_PROC_BROWSER_TEST_F(SingleClientSyncInvalidationsTest,
                       ShouldPropagateInvalidationHints) {}

IN_PROC_BROWSER_TEST_F(SingleClientSyncInvalidationsTest,
                       ShouldPopulateFCMRegistrationTokens) {}

IN_PROC_BROWSER_TEST_F(
    SingleClientSyncInvalidationsTest,
    ShouldNotPopulateFCMRegistrationTokensForInterestedDataTypes) {}

IN_PROC_BROWSER_TEST_F(SingleClientSyncInvalidationsTest,
                       ShouldProvideNotificationsEnabledInGetUpdates) {}

// PRE_* tests aren't supported on Android browser tests.
#if !BUILDFLAG(IS_ANDROID)
IN_PROC_BROWSER_TEST_F(SingleClientSyncInvalidationsTest,
                       PRE_ShouldNotSendAdditionalGetUpdates) {}

IN_PROC_BROWSER_TEST_F(SingleClientSyncInvalidationsTest,
                       ShouldNotSendAdditionalGetUpdates) {}

IN_PROC_BROWSER_TEST_F(SingleClientSyncInvalidationsTest,
                       PRE_ShouldReceiveInvalidationSentBeforeSetupClients) {}

IN_PROC_BROWSER_TEST_F(SingleClientSyncInvalidationsTest,
                       ShouldReceiveInvalidationSentBeforeSetupClients) {}

IN_PROC_BROWSER_TEST_F(SingleClientSyncInvalidationsTest,
                       PRE_PersistBookmarkInvalidation) {}

IN_PROC_BROWSER_TEST_F(SingleClientSyncInvalidationsTest,
                       PersistBookmarkInvalidation) {}

IN_PROC_BROWSER_TEST_F(SingleClientSyncInvalidationsTest,
                       PRE_PersistDeviceInfoInvalidation) {}

IN_PROC_BROWSER_TEST_F(SingleClientSyncInvalidationsTest,
                       PersistDeviceInfoInvalidation) {}
#endif  // !BUILDFLAG(IS_ANDROID)

IN_PROC_BROWSER_TEST_F(SingleClientSyncInvalidationsTest,
                       EnableAndDisableADataType) {}

// ChromeOS doesn't have the concept of sign-out.
#if !BUILDFLAG(IS_CHROMEOS_ASH)

// TODO(crbug.com/40833316): Enable test on Android once signout is supported.
#if BUILDFLAG(IS_ANDROID)
#define MAYBE_SignoutAndSignin
#else
#define MAYBE_SignoutAndSignin
#endif
IN_PROC_BROWSER_TEST_F(SingleClientSyncInvalidationsTest,
                       MAYBE_SignoutAndSignin) {}
#endif  // !BUILDFLAG(IS_CHROMEOS_ASH)

}  // namespace