#include "components/sync_device_info/local_device_info_provider_impl.h"
#include <optional>
#include "base/memory/ptr_util.h"
#include "build/chromeos_buildflags.h"
#include "components/sync/base/data_type.h"
#include "components/sync/base/sync_util.h"
#include "components/sync/protocol/device_info_specifics.pb.h"
#include "components/sync/protocol/sync_enums.pb.h"
#include "components/sync_device_info/device_info.h"
#include "components/sync_device_info/device_info_sync_client.h"
#include "components/version_info/version_string.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace syncer {
namespace {
const char kLocalDeviceGuid[] = …;
const char kLocalDeviceClientName[] = …;
const char kLocalDeviceManufacturerName[] = …;
const char kLocalDeviceModelName[] = …;
const char kLocalFullHardwareClass[] = …;
const char kSharingVapidFCMRegistrationToken[] = …;
const char kSharingVapidP256dh[] = …;
const char kSharingVapidAuthSecret[] = …;
const char kSharingSenderIdFCMRegistrationToken[] = …;
const char kSharingSenderIdP256dh[] = …;
const char kSharingSenderIdAuthSecret[] = …;
const char kSharingChimeRepresentativeTargetId[] = …;
const sync_pb::SharingSpecificFields::EnabledFeatures
kSharingEnabledFeatures[] = …;
NiceMock;
NotNull;
Return;
class MockDeviceInfoSyncClient : public DeviceInfoSyncClient { … };
class LocalDeviceInfoProviderImplTest : public testing::Test { … };
#if BUILDFLAG(IS_CHROMEOS_ASH)
TEST_F(LocalDeviceInfoProviderImplTest, UmaToggleFullHardwareClass) {
InitializeProvider(kLocalDeviceGuid);
ON_CALL(device_info_sync_client_, IsUmaEnabledOnCrOSDevice)
.WillByDefault(Return(true));
EXPECT_EQ(provider_->GetLocalDeviceInfo()->full_hardware_class(),
kLocalFullHardwareClass);
ON_CALL(device_info_sync_client_, IsUmaEnabledOnCrOSDevice)
.WillByDefault(Return(false));
EXPECT_EQ(provider_->GetLocalDeviceInfo()->full_hardware_class(), "");
ON_CALL(device_info_sync_client_, IsUmaEnabledOnCrOSDevice)
.WillByDefault(Return(true));
EXPECT_EQ(provider_->GetLocalDeviceInfo()->full_hardware_class(),
kLocalFullHardwareClass);
}
#else
TEST_F(LocalDeviceInfoProviderImplTest,
UmaEnabledNonChromeOSHardwareClassEmpty) { … }
#endif
TEST_F(LocalDeviceInfoProviderImplTest, GetLocalDeviceInfo) { … }
TEST_F(LocalDeviceInfoProviderImplTest, GetSigninScopedDeviceId) { … }
TEST_F(LocalDeviceInfoProviderImplTest, SendTabToSelfReceivingEnabled) { … }
TEST_F(LocalDeviceInfoProviderImplTest, SendTabToSelfReceivingType) { … }
TEST_F(LocalDeviceInfoProviderImplTest, SharingInfo) { … }
TEST_F(LocalDeviceInfoProviderImplTest, ShouldPopulateFCMRegistrationToken) { … }
TEST_F(LocalDeviceInfoProviderImplTest, ShouldPopulateInterestedDataTypes) { … }
TEST_F(LocalDeviceInfoProviderImplTest, ShouldKeepStoredInvalidationFields) { … }
TEST_F(LocalDeviceInfoProviderImplTest, PhoneAsASecurityKeyInfo) { … }
}
}