#include "components/sharing_message/sharing_service.h"
#include <memory>
#include <optional>
#include <vector>
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/cancelable_task_tracker.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/protobuf_matchers.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/favicon/core/test/mock_favicon_service.h"
#include "components/gcm_driver/crypto/gcm_encryption_provider.h"
#include "components/gcm_driver/instance_id/instance_id_driver.h"
#include "components/send_tab_to_self/features.h"
#include "components/send_tab_to_self/send_tab_to_self_entry.h"
#include "components/send_tab_to_self/test_send_tab_to_self_model.h"
#include "components/sharing_message/features.h"
#include "components/sharing_message/mock_sharing_device_source.h"
#include "components/sharing_message/mock_sharing_message_sender.h"
#include "components/sharing_message/proto/sharing_message.pb.h"
#include "components/sharing_message/sharing_constants.h"
#include "components/sharing_message/sharing_device_registration.h"
#include "components/sharing_message/sharing_device_registration_result.h"
#include "components/sharing_message/sharing_fcm_handler.h"
#include "components/sharing_message/sharing_fcm_sender.h"
#include "components/sharing_message/sharing_handler_registry.h"
#include "components/sharing_message/sharing_message_handler.h"
#include "components/sharing_message/sharing_sync_preference.h"
#include "components/sharing_message/vapid_key_manager.h"
#include "components/strings/grit/components_strings.h"
#include "components/sync/protocol/unencrypted_sharing_message.pb.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/local_device_info_provider.h"
#include "components/sync_device_info/local_device_info_util.h"
#include "components/sync_preferences/testing_pref_service_syncable.h"
#include "crypto/ec_private_key.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/l10n/l10n_util.h"
#include "url/gurl.h"
namespace {
const char kDeviceName[] = …;
const char kAuthorizedEntity[] = …;
constexpr base::TimeDelta kTimeout = …;
SharingTargetDeviceInfo CreateFakeSharingTargetDeviceInfo(
const std::string& guid,
const std::string& client_name) { … }
class MockInstanceIDDriver : public instance_id::InstanceIDDriver { … };
class MockSharingHandlerRegistry : public SharingHandlerRegistry { … };
class MockSharingFCMHandler : public SharingFCMHandler { … };
class FakeSharingDeviceRegistration : public SharingDeviceRegistration { … };
class SharingServiceTest : public testing::Test { … };
bool ProtoEquals(const google::protobuf::MessageLite& expected,
const google::protobuf::MessageLite& actual) { … }
}
TEST_F(SharingServiceTest, GetDeviceCandidates_Empty) { … }
TEST_F(SharingServiceTest, GetDeviceCandidates_Tracked) { … }
TEST_F(SharingServiceTest, SendMessageToDeviceSuccess) { … }
TEST_F(SharingServiceTest, SendTabEntryAddedLocally) { … }
TEST_F(SharingServiceTest, SendTabEntryAddedLocally_FeatureDisabled) { … }
TEST_F(SharingServiceTest, SendTabEntryAddedLocally_NonIOSDevice) { … }
TEST_F(SharingServiceTest, DeviceRegistration) { … }
TEST_F(SharingServiceTest, DeviceRegistrationPreferenceNotAvailable) { … }
TEST_F(SharingServiceTest, DeviceRegistrationTransportMode) { … }
TEST_F(SharingServiceTest, DeviceRegistrationTransientError) { … }
TEST_F(SharingServiceTest, DeviceUnregistrationSyncDisabled) { … }
TEST_F(SharingServiceTest, DeviceRegisterAndUnregister) { … }
TEST_F(SharingServiceTest, StartListeningToFCMAtConstructor) { … }
TEST_F(SharingServiceTest, GetDeviceByGuid) { … }
TEST_F(SharingServiceTest, AddSharingHandler) { … }
TEST_F(SharingServiceTest, RemoveSharingHandler) { … }