#include "components/browser_sync/active_devices_provider_impl.h"
#include <memory>
#include <optional>
#include <string>
#include <vector>
#include "base/functional/callback.h"
#include "base/strings/string_number_conversions.h"
#include "base/test/mock_callback.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/simple_test_clock.h"
#include "base/time/time.h"
#include "base/uuid.h"
#include "components/browser_sync/browser_sync_switches.h"
#include "components/sync/base/data_type.h"
#include "components/sync/engine/active_devices_invalidation_info.h"
#include "components/sync/protocol/sync_enums.pb.h"
#include "components/sync_device_info/fake_device_info_tracker.h"
#include "testing/gtest/include/gtest/gtest.h"
ActiveDevicesInvalidationInfo;
DataTypeSet;
DeviceInfo;
FakeDeviceInfoTracker;
Contains;
IsEmpty;
SizeIs;
UnorderedElementsAre;
namespace browser_sync {
namespace {
constexpr int kPulseIntervalMinutes = …;
std::unique_ptr<DeviceInfo> CreateFakeDeviceInfo(
const std::string& name,
const std::string& fcm_registration_token,
const DataTypeSet& interested_data_types,
base::Time last_updated_timestamp) { … }
DataTypeSet DefaultInterestedDataTypes() { … }
class ActiveDevicesProviderImplTest : public testing::Test { … };
TEST_F(ActiveDevicesProviderImplTest, ShouldFilterInactiveDevices) { … }
TEST_F(ActiveDevicesProviderImplTest, ShouldReturnIfSingleDeviceByDataType) { … }
TEST_F(ActiveDevicesProviderImplTest,
ShouldReturnIfSingleClientWithStandaloneInvalidations) { … }
TEST_F(ActiveDevicesProviderImplTest,
ShouldReturnSingleClientForStandaloneInvalidationsOnly) { … }
TEST_F(ActiveDevicesProviderImplTest,
ShouldReturnSingleClientForOldInvalidations) { … }
TEST_F(ActiveDevicesProviderImplTest,
ShouldReturnSingleClientForOldInvalidationsForInterestedDataTypes) { … }
TEST_F(ActiveDevicesProviderImplTest, ShouldReturnZeroDevices) { … }
TEST_F(ActiveDevicesProviderImplTest, ShouldInvokeCallback) { … }
TEST_F(ActiveDevicesProviderImplTest, ShouldReturnActiveFCMRegistrationTokens) { … }
TEST_F(ActiveDevicesProviderImplTest, ShouldReturnEmptyListWhenTooManyDevices) { … }
TEST_F(ActiveDevicesProviderImplTest,
ShouldReturnFCMRegistrationTokensFromLatestDeviceInfo) { … }
}
}