#include "components/sharing_message/sharing_device_source_sync.h"
#include <memory>
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "base/uuid.h"
#include "components/send_tab_to_self/features.h"
#include "components/send_tab_to_self/target_device_info.h"
#include "components/sharing_message/fake_device_info.h"
#include "components/sharing_message/features.h"
#include "components/sharing_message/sharing_constants.h"
#include "components/sharing_message/sharing_utils.h"
#include "components/sync/test/test_sync_service.h"
#include "components/sync_device_info/device_info.h"
#include "components/sync_device_info/fake_device_info_sync_service.h"
#include "components/sync_device_info/fake_device_info_tracker.h"
#include "components/sync_device_info/fake_local_device_info_provider.h"
#include "components/sync_device_info/local_device_info_util.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
const char kVapidFCMToken[] = …;
const char kSenderIdFCMToken[] = …;
const char kDevicep256dh[] = …;
const char kSenderIdP256dh[] = …;
const char kDeviceAuthSecret[] = …;
const char kSenderIdAuthSecret[] = …;
const char kChimeRepresentativeTargetId[] = …;
std::unique_ptr<syncer::DeviceInfo> CreateDeviceInfo(
const std::string& client_name,
sync_pb::SharingSpecificFields::EnabledFeatures enabled_feature,
const std::string& manufacturer_name = "manufacturer",
const std::string& model_name = "model",
syncer::DeviceInfo::SharingTargetInfo vapid_target_info =
{ … }
class SharingDeviceSourceSyncTest : public testing::Test { … };
}
TEST_F(SharingDeviceSourceSyncTest, RunsReadyCallback) { … }
TEST_F(SharingDeviceSourceSyncTest, GetDeviceByGuid_Ready) { … }
TEST_F(SharingDeviceSourceSyncTest, GetDeviceByGuid_NotReady) { … }
TEST_F(SharingDeviceSourceSyncTest, GetDeviceByGuid_UnknownGuid) { … }
TEST_F(SharingDeviceSourceSyncTest, GetDeviceByGuid_SyncDisabled) { … }
TEST_F(SharingDeviceSourceSyncTest, GetDeviceCandidates_Ready) { … }
TEST_F(SharingDeviceSourceSyncTest, GetDeviceCandidates_NotReady) { … }
TEST_F(SharingDeviceSourceSyncTest, GetDeviceCandidates_Deduplicated) { … }
TEST_F(SharingDeviceSourceSyncTest, GetDeviceCandidates_DeviceNaming) { … }
TEST_F(SharingDeviceSourceSyncTest, GetDeviceCandidates_Expired) { … }
TEST_F(SharingDeviceSourceSyncTest, GetDeviceCandidates_MissingRequirements) { … }
TEST_F(SharingDeviceSourceSyncTest,
GetDeviceCandidates_AlternativeRequirement) { … }
TEST_F(SharingDeviceSourceSyncTest, GetDeviceCandidates_RenameAfterFiltering) { … }
TEST_F(SharingDeviceSourceSyncTest, GetDeviceCandidates_NoChannel) { … }
TEST_F(SharingDeviceSourceSyncTest, GetDeviceCandidates_FCMChannel) { … }
TEST_F(SharingDeviceSourceSyncTest, GetDeviceCandidates_SenderIDChannel) { … }