mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 22:56:12 -04:00
Remove unused deviceInfo methods.
PiperOrigin-RevId: 688334273
This commit is contained in:
committed by
Copybara-Service
parent
b9bb7c9da9
commit
5840369ce6
@@ -34,10 +34,7 @@ class DeviceInfo {
|
||||
virtual std::string GetOsDeviceName() const = 0;
|
||||
virtual api::DeviceInfo::DeviceType GetDeviceType() const = 0;
|
||||
virtual api::DeviceInfo::OsType GetOsType() const = 0;
|
||||
virtual std::optional<std::string> GetFullName() const = 0;
|
||||
virtual std::optional<std::string> GetGivenName() const = 0;
|
||||
virtual std::optional<std::string> GetLastName() const = 0;
|
||||
virtual std::optional<std::string> GetProfileUserName() const = 0;
|
||||
|
||||
virtual std::filesystem::path GetDownloadPath() const = 0;
|
||||
virtual std::filesystem::path GetAppDataPath() const = 0;
|
||||
|
||||
@@ -43,22 +43,10 @@ api::DeviceInfo::OsType DeviceInfoImpl::GetOsType() const {
|
||||
return device_info_impl_->GetOsType();
|
||||
}
|
||||
|
||||
std::optional<std::string> DeviceInfoImpl::GetFullName() const {
|
||||
return device_info_impl_->GetFullName();
|
||||
}
|
||||
|
||||
std::optional<std::string> DeviceInfoImpl::GetGivenName() const {
|
||||
return device_info_impl_->GetGivenName();
|
||||
}
|
||||
|
||||
std::optional<std::string> DeviceInfoImpl::GetLastName() const {
|
||||
return device_info_impl_->GetLastName();
|
||||
}
|
||||
|
||||
std::optional<std::string> DeviceInfoImpl::GetProfileUserName() const {
|
||||
return device_info_impl_->GetProfileUserName();
|
||||
}
|
||||
|
||||
std::filesystem::path DeviceInfoImpl::GetDownloadPath() const {
|
||||
std::optional<std::filesystem::path> path =
|
||||
device_info_impl_->GetDownloadPath();
|
||||
|
||||
@@ -38,10 +38,7 @@ class DeviceInfoImpl : public DeviceInfo {
|
||||
api::DeviceInfo::DeviceType GetDeviceType() const override;
|
||||
api::DeviceInfo::OsType GetOsType() const override;
|
||||
|
||||
std::optional<std::string> GetFullName() const override;
|
||||
std::optional<std::string> GetGivenName() const override;
|
||||
std::optional<std::string> GetLastName() const override;
|
||||
std::optional<std::string> GetProfileUserName() const override;
|
||||
|
||||
std::filesystem::path GetDownloadPath() const override;
|
||||
std::filesystem::path GetAppDataPath() const override;
|
||||
|
||||
@@ -34,10 +34,7 @@ class DeviceInfo : public api::DeviceInfo {
|
||||
|
||||
api::DeviceInfo::OsType GetOsType() const override;
|
||||
|
||||
std::optional<std::string> GetFullName() const override;
|
||||
std::optional<std::string> GetGivenName() const override;
|
||||
std::optional<std::string> GetLastName() const override;
|
||||
std::optional<std::string> GetProfileUserName() const override;
|
||||
|
||||
std::optional<std::filesystem::path> GetDownloadPath() const override;
|
||||
|
||||
|
||||
@@ -78,10 +78,7 @@ api::DeviceInfo::OsType DeviceInfo::GetOsType() const {
|
||||
#endif
|
||||
}
|
||||
|
||||
std::optional<std::string> DeviceInfo::GetFullName() const { return std::nullopt; }
|
||||
std::optional<std::string> DeviceInfo::GetGivenName() const { return std::nullopt; }
|
||||
std::optional<std::string> DeviceInfo::GetLastName() const { return std::nullopt; }
|
||||
std::optional<std::string> DeviceInfo::GetProfileUserName() const { return std::nullopt; }
|
||||
|
||||
std::optional<std::filesystem::path> DeviceInfo::GetDownloadPath() const {
|
||||
NSFileManager *manager = [NSFileManager defaultManager];
|
||||
|
||||
@@ -46,10 +46,7 @@ class DeviceInfo {
|
||||
virtual OsType GetOsType() const = 0;
|
||||
|
||||
// Gets basic information of current user.
|
||||
virtual std::optional<std::string> GetFullName() const = 0;
|
||||
virtual std::optional<std::string> GetGivenName() const = 0;
|
||||
virtual std::optional<std::string> GetLastName() const = 0;
|
||||
virtual std::optional<std::string> GetProfileUserName() const = 0;
|
||||
|
||||
// Gets known paths of current user.
|
||||
virtual std::optional<std::filesystem::path> GetDownloadPath() const = 0;
|
||||
|
||||
@@ -42,18 +42,9 @@ class DeviceInfo : public api::DeviceInfo {
|
||||
return api::DeviceInfo::OsType::kChromeOs;
|
||||
}
|
||||
|
||||
std::optional<std::string> GetFullName() const override {
|
||||
return "nearby";
|
||||
}
|
||||
std::optional<std::string> GetGivenName() const override {
|
||||
return "nearby";
|
||||
}
|
||||
std::optional<std::string> GetLastName() const override {
|
||||
return "nearby";
|
||||
}
|
||||
std::optional<std::string> GetProfileUserName() const override {
|
||||
return "nearby";
|
||||
}
|
||||
|
||||
std::optional<std::filesystem::path> GetDownloadPath() const override {
|
||||
return std::filesystem::temp_directory_path();
|
||||
|
||||
@@ -84,48 +84,6 @@ api::DeviceInfo::OsType DeviceInfo::GetOsType() const {
|
||||
return api::DeviceInfo::OsType::kWindows;
|
||||
}
|
||||
|
||||
std::optional<std::string> DeviceInfo::GetFullName() const {
|
||||
// FindAllAsync finds all users that are using this app. When we "Switch User"
|
||||
// on Desktop,FindAllAsync() will still return the current user instead of all
|
||||
// of them because the users who are switched out are not using the apps of
|
||||
// the user who is switched in, so FindAllAsync() will not find them. (Under
|
||||
// the UWP application model, each process runs under its own user account.
|
||||
// That user account is different from the user account of the logged-in user.
|
||||
// Processes aren't owned by the logged-in user for purposes of isolation.)
|
||||
IVectorView<User> users =
|
||||
User::FindAllAsync(UserType::LocalUser,
|
||||
UserAuthenticationStatus::LocallyAuthenticated)
|
||||
.get();
|
||||
if (users == nullptr) {
|
||||
LOG(ERROR) << __func__ << ": Error retrieving locally authenticated user.";
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
// On Windows Desktop apps, the first Windows.System.User instance
|
||||
// returned in the IVectorView is always the current user.
|
||||
// https://github.com/microsoft/Windows-task-snippets/blob/master/tasks/User-info.md
|
||||
User current_user = users.GetAt(0);
|
||||
|
||||
// Retrieve the human-readable properties for the current user
|
||||
IAsyncOperation<IInspectable> full_name_obj_async =
|
||||
current_user.GetPropertyAsync(KnownUserProperties::DisplayName());
|
||||
IInspectable full_name_obj = full_name_obj_async.get();
|
||||
if (full_name_obj == nullptr) {
|
||||
LOG(ERROR) << __func__ << ": Error retrieving full name of user.";
|
||||
return std::nullopt;
|
||||
}
|
||||
winrt::hstring full_name = full_name_obj.as<winrt::hstring>();
|
||||
std::string full_name_str = winrt::to_string(full_name);
|
||||
|
||||
if (full_name_str.empty()) {
|
||||
LOG(ERROR) << __func__
|
||||
<< ": Error unboxing string value for full name of user.";
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
return full_name_str;
|
||||
}
|
||||
|
||||
std::optional<std::string> DeviceInfo::GetGivenName() const {
|
||||
// FindAllAsync finds all users that are using this app. When we "Switch User"
|
||||
// on Desktop,FindAllAsync() will still return the current user instead of all
|
||||
@@ -168,90 +126,6 @@ std::optional<std::string> DeviceInfo::GetGivenName() const {
|
||||
return given_name_str;
|
||||
}
|
||||
|
||||
std::optional<std::string> DeviceInfo::GetLastName() const {
|
||||
// FindAllAsync finds all users that are using this app. When we "Switch User"
|
||||
// on Desktop,FindAllAsync() will still return the current user instead of all
|
||||
// of them because the users who are switched out are not using the apps of
|
||||
// the user who is switched in, so FindAllAsync() will not find them. (Under
|
||||
// the UWP application model, each process runs under its own user account.
|
||||
// That user account is different from the user account of the logged-in user.
|
||||
// Processes aren't owned by the logged-in user for purposes of isolation.)
|
||||
IVectorView<User> users =
|
||||
User::FindAllAsync(UserType::LocalUser,
|
||||
UserAuthenticationStatus::LocallyAuthenticated)
|
||||
.get();
|
||||
if (users == nullptr) {
|
||||
LOG(ERROR) << __func__ << ": Error retrieving locally authenticated user.";
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
// On Windows Desktop apps, the first Windows.System.User instance
|
||||
// returned in the IVectorView is always the current user.
|
||||
// https://github.com/microsoft/Windows-task-snippets/blob/master/tasks/User-info.md
|
||||
User current_user = users.GetAt(0);
|
||||
|
||||
// Retrieve the human-readable properties for the current user
|
||||
IAsyncOperation<IInspectable> last_name_obj_async =
|
||||
current_user.GetPropertyAsync(KnownUserProperties::LastName());
|
||||
IInspectable last_name_obj = last_name_obj_async.get();
|
||||
if (last_name_obj == nullptr) {
|
||||
LOG(ERROR) << __func__ << ": Error retrieving last name of user.";
|
||||
return std::nullopt;
|
||||
}
|
||||
winrt::hstring last_name = last_name_obj.as<winrt::hstring>();
|
||||
std::string last_name_str = winrt::to_string(last_name);
|
||||
|
||||
if (last_name_str.empty()) {
|
||||
LOG(ERROR) << __func__
|
||||
<< ": Error unboxing string value for last name of user.";
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
return last_name_str;
|
||||
}
|
||||
|
||||
std::optional<std::string> DeviceInfo::GetProfileUserName() const {
|
||||
// FindAllAsync finds all users that are using this app. When we "Switch User"
|
||||
// on Desktop,FindAllAsync() will still return the current user instead of all
|
||||
// of them because the users who are switched out are not using the apps of
|
||||
// the user who is switched in, so FindAllAsync() will not find them. (Under
|
||||
// the UWP application model, each process runs under its own user account.
|
||||
// That user account is different from the user account of the logged-in user.
|
||||
// Processes aren't owned by the logged-in user for purposes of isolation.)
|
||||
IVectorView<User> users =
|
||||
User::FindAllAsync(UserType::LocalUser,
|
||||
UserAuthenticationStatus::LocallyAuthenticated)
|
||||
.get();
|
||||
if (users == nullptr) {
|
||||
LOG(ERROR) << __func__ << ": Error retrieving locally authenticated user.";
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
// On Windows Desktop apps, the first Windows.System.User instance
|
||||
// returned in the IVectorView is always the current user.
|
||||
// https://github.com/microsoft/Windows-task-snippets/blob/master/tasks/User-info.md
|
||||
User current_user = users.GetAt(0);
|
||||
|
||||
// Retrieve the human-readable properties for the current user
|
||||
IAsyncOperation<IInspectable> account_name_obj_async =
|
||||
current_user.GetPropertyAsync(KnownUserProperties::AccountName());
|
||||
IInspectable account_name_obj = account_name_obj_async.get();
|
||||
if (account_name_obj == nullptr) {
|
||||
LOG(ERROR) << __func__ << ": Error retrieving account name of user.";
|
||||
return std::nullopt;
|
||||
}
|
||||
winrt::hstring account_name = account_name_obj.as<winrt::hstring>();
|
||||
std::string account_name_string = winrt::to_string(account_name);
|
||||
|
||||
if (account_name_string.empty()) {
|
||||
LOG(ERROR) << __func__
|
||||
<< ": Error unboxing string value for profile username of user.";
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
return account_name_string;
|
||||
}
|
||||
|
||||
std::optional<std::filesystem::path> DeviceInfo::GetDownloadPath() const {
|
||||
PWSTR path;
|
||||
HRESULT result =
|
||||
|
||||
@@ -34,10 +34,7 @@ class DeviceInfo : public api::DeviceInfo {
|
||||
std::optional<std::string> GetOsDeviceName() const override;
|
||||
api::DeviceInfo::DeviceType GetDeviceType() const override;
|
||||
api::DeviceInfo::OsType GetOsType() const override;
|
||||
std::optional<std::string> GetFullName() const override;
|
||||
std::optional<std::string> GetGivenName() const override;
|
||||
std::optional<std::string> GetLastName() const override;
|
||||
std::optional<std::string> GetProfileUserName() const override;
|
||||
|
||||
std::optional<std::filesystem::path> GetDownloadPath() const override;
|
||||
std::optional<std::filesystem::path> GetLocalAppDataPath() const override;
|
||||
|
||||
@@ -14,11 +14,8 @@
|
||||
|
||||
#include "internal/platform/implementation/windows/device_info.h"
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "absl/synchronization/notification.h"
|
||||
#include "internal/platform/implementation/device_info.h"
|
||||
|
||||
namespace nearby {
|
||||
@@ -37,21 +34,10 @@ TEST(DeviceInfo, GetOsType) {
|
||||
EXPECT_EQ(DeviceInfo().GetOsType(), api::DeviceInfo::OsType::kWindows);
|
||||
}
|
||||
|
||||
TEST(DeviceInfo, DISABLED_GetFullName) {
|
||||
EXPECT_TRUE(DeviceInfo().GetFullName().has_value());
|
||||
}
|
||||
|
||||
TEST(DeviceInfo, DISABLED_GetGivenName) {
|
||||
EXPECT_TRUE(DeviceInfo().GetGivenName().has_value());
|
||||
}
|
||||
|
||||
TEST(DeviceInfo, DISABLED_GetLastName) {
|
||||
EXPECT_TRUE(DeviceInfo().GetLastName().has_value());
|
||||
}
|
||||
|
||||
TEST(DeviceInfo, DISABLED_GetProfileUserName) {
|
||||
EXPECT_TRUE(DeviceInfo().GetProfileUserName().has_value());
|
||||
}
|
||||
|
||||
TEST(DeviceInfo, DISABLED_GetLocalAppDataPath) {
|
||||
EXPECT_TRUE(DeviceInfo().GetLocalAppDataPath().has_value());
|
||||
|
||||
@@ -40,18 +40,9 @@ class FakeDeviceInfo : public DeviceInfo {
|
||||
|
||||
api::DeviceInfo::OsType GetOsType() const override { return os_type_; }
|
||||
|
||||
std::optional<std::string> GetFullName() const override {
|
||||
return full_name_;
|
||||
}
|
||||
std::optional<std::string> GetGivenName() const override {
|
||||
return given_name_;
|
||||
}
|
||||
std::optional<std::string> GetLastName() const override {
|
||||
return last_name_;
|
||||
}
|
||||
std::optional<std::string> GetProfileUserName() const override {
|
||||
return profile_user_name_;
|
||||
}
|
||||
|
||||
std::filesystem::path GetDownloadPath() const override {
|
||||
return download_path_;
|
||||
@@ -105,14 +96,6 @@ class FakeDeviceInfo : public DeviceInfo {
|
||||
|
||||
void SetOsType(api::DeviceInfo::OsType os_type) { os_type_ = os_type; }
|
||||
|
||||
void SetFullName(std::optional<std::string> full_name) {
|
||||
if (full_name.has_value() && !full_name->empty()) {
|
||||
full_name_ = full_name;
|
||||
} else {
|
||||
full_name_ = std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
void SetGivenName(std::optional<std::string> given_name) {
|
||||
if (given_name.has_value() && !given_name->empty()) {
|
||||
given_name_ = given_name;
|
||||
@@ -121,22 +104,6 @@ class FakeDeviceInfo : public DeviceInfo {
|
||||
}
|
||||
}
|
||||
|
||||
void SetLastName(std::optional<std::string> last_name) {
|
||||
if (last_name.has_value() && !last_name->empty()) {
|
||||
last_name_ = last_name;
|
||||
} else {
|
||||
last_name_ = std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
void SetProfileUserName(std::optional<std::string> profile_user_name) {
|
||||
if (profile_user_name.has_value() && !profile_user_name->empty()) {
|
||||
profile_user_name_ = profile_user_name;
|
||||
} else {
|
||||
profile_user_name_ = std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
void SetDownloadPath(std::filesystem::path path) { download_path_ = path; }
|
||||
|
||||
void SetAppDataPath(std::filesystem::path path) { app_data_path_ = path; }
|
||||
@@ -166,10 +133,7 @@ class FakeDeviceInfo : public DeviceInfo {
|
||||
api::DeviceInfo::DeviceType device_type_ =
|
||||
api::DeviceInfo::DeviceType::kLaptop;
|
||||
api::DeviceInfo::OsType os_type_ = api::DeviceInfo::OsType::kWindows;
|
||||
std::optional<std::string> full_name_ = "Nearby";
|
||||
std::optional<std::string> given_name_ = "Nearby";
|
||||
std::optional<std::string> last_name_ = "Nearby";
|
||||
std::optional<std::string> profile_user_name_ = "nearby";
|
||||
std::filesystem::path download_path_ = std::filesystem::temp_directory_path();
|
||||
std::filesystem::path app_data_path_ = std::filesystem::temp_directory_path();
|
||||
std::filesystem::path temp_path_ = std::filesystem::temp_directory_path();
|
||||
|
||||
@@ -43,14 +43,6 @@ TEST(FakeDeviceInfo, OsType) {
|
||||
EXPECT_EQ(device_info.GetOsType(), api::DeviceInfo::OsType::kWindows);
|
||||
}
|
||||
|
||||
TEST(FakeDeviceInfo, FullName) {
|
||||
FakeDeviceInfo device_info;
|
||||
device_info.SetFullName("windows");
|
||||
EXPECT_EQ(device_info.GetFullName(), "windows");
|
||||
device_info.SetFullName(std::nullopt);
|
||||
EXPECT_FALSE(device_info.GetFullName().has_value());
|
||||
}
|
||||
|
||||
TEST(FakeDeviceInfo, GivenName) {
|
||||
FakeDeviceInfo device_info;
|
||||
device_info.SetGivenName("windows");
|
||||
@@ -59,22 +51,6 @@ TEST(FakeDeviceInfo, GivenName) {
|
||||
EXPECT_FALSE(device_info.GetGivenName().has_value());
|
||||
}
|
||||
|
||||
TEST(FakeDeviceInfo, LastName) {
|
||||
FakeDeviceInfo device_info;
|
||||
device_info.SetLastName("windows");
|
||||
EXPECT_EQ(device_info.GetLastName(), "windows");
|
||||
device_info.SetLastName(std::nullopt);
|
||||
EXPECT_FALSE(device_info.GetLastName().has_value());
|
||||
}
|
||||
|
||||
TEST(FakeDeviceInfo, ProfileUserName) {
|
||||
FakeDeviceInfo device_info;
|
||||
device_info.SetProfileUserName("windows");
|
||||
EXPECT_EQ(device_info.GetProfileUserName(), "windows");
|
||||
device_info.SetProfileUserName(std::nullopt);
|
||||
EXPECT_FALSE(device_info.GetProfileUserName().has_value());
|
||||
}
|
||||
|
||||
TEST(FakeDeviceInfo, GetDownloadPath) {
|
||||
FakeDeviceInfo device_info;
|
||||
EXPECT_EQ(device_info.GetDownloadPath(),
|
||||
|
||||
@@ -31,10 +31,5 @@ std::optional<std::string> FakeNearbyShareProfileInfoProvider::GetGivenName()
|
||||
return given_name_;
|
||||
}
|
||||
|
||||
std::optional<std::string>
|
||||
FakeNearbyShareProfileInfoProvider::GetProfileUserName() const {
|
||||
return profile_user_name_;
|
||||
}
|
||||
|
||||
} // namespace sharing
|
||||
} // namespace nearby
|
||||
|
||||
@@ -31,7 +31,6 @@ class FakeNearbyShareProfileInfoProvider
|
||||
|
||||
// NearbyShareProfileInfoProvider:
|
||||
std::optional<std::string> GetGivenName() const override;
|
||||
std::optional<std::string> GetProfileUserName() const override;
|
||||
|
||||
void set_given_name(const std::optional<std::string>& given_name) {
|
||||
given_name_ = given_name;
|
||||
@@ -39,7 +38,6 @@ class FakeNearbyShareProfileInfoProvider
|
||||
|
||||
private:
|
||||
std::optional<std::string> given_name_;
|
||||
std::optional<std::string> profile_user_name_;
|
||||
};
|
||||
|
||||
} // namespace sharing
|
||||
|
||||
@@ -28,10 +28,6 @@ class NearbyShareProfileInfoProvider {
|
||||
// Returns UTF-8 encoded given name of current account.
|
||||
// Returns absl::nullopt if a valid given name cannot be returned.
|
||||
virtual std::optional<std::string> GetGivenName() const = 0;
|
||||
|
||||
// Proxy for Profile::GetProfileUserName(). Returns absl::nullopt if a valid
|
||||
// username cannot be returned.
|
||||
virtual std::optional<std::string> GetProfileUserName() const = 0;
|
||||
};
|
||||
} // namespace sharing
|
||||
} // namespace nearby
|
||||
|
||||
@@ -43,10 +43,5 @@ std::optional<std::string> NearbyShareProfileInfoProviderImpl::GetGivenName()
|
||||
return device_info_.GetGivenName();
|
||||
}
|
||||
|
||||
std::optional<std::string>
|
||||
NearbyShareProfileInfoProviderImpl::GetProfileUserName() const {
|
||||
return device_info_.GetProfileUserName();
|
||||
}
|
||||
|
||||
} // namespace sharing
|
||||
} // namespace nearby
|
||||
|
||||
@@ -40,7 +40,6 @@ class NearbyShareProfileInfoProviderImpl
|
||||
|
||||
// NearbyShareProfileInfoProvider:
|
||||
std::optional<std::string> GetGivenName() const override;
|
||||
std::optional<std::string> GetProfileUserName() const override;
|
||||
|
||||
private:
|
||||
nearby::DeviceInfo& device_info_;
|
||||
|
||||
@@ -30,7 +30,6 @@ constexpr char kTestAccountId[] = "test_account_id";
|
||||
constexpr char kTestAccountGivenName[] = "given_name";
|
||||
constexpr char kExpectedTestAccountGivenName[] = "given_name";
|
||||
constexpr char kProfileGivenName[] = "Barack";
|
||||
constexpr char kProfileProfileUserName[] = "test@gmail.com";
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -41,17 +40,12 @@ class NearbyShareProfileInfoProviderImplTest : public ::testing::Test {
|
||||
|
||||
void SetUp() override {
|
||||
fake_device_info_.SetGivenName(std::nullopt);
|
||||
fake_device_info_.SetProfileUserName(std::nullopt);
|
||||
}
|
||||
|
||||
void SetUserGivenName(const std::string& name) {
|
||||
fake_device_info_.SetGivenName(name);
|
||||
}
|
||||
|
||||
void SetProfileUserName(const std::string& profile_user_name) {
|
||||
fake_device_info_.SetProfileUserName(profile_user_name);
|
||||
}
|
||||
|
||||
FakeDeviceInfo& fake_device_info() {
|
||||
return fake_device_info_;
|
||||
}
|
||||
@@ -64,7 +58,6 @@ class NearbyShareProfileInfoProviderImplTest : public ::testing::Test {
|
||||
};
|
||||
|
||||
TEST_F(NearbyShareProfileInfoProviderImplTest, GivenName) {
|
||||
SetProfileUserName(kProfileProfileUserName);
|
||||
NearbyShareProfileInfoProviderImpl profile_info_provider(
|
||||
fake_device_info(), fake_account_manager());
|
||||
|
||||
@@ -79,23 +72,6 @@ TEST_F(NearbyShareProfileInfoProviderImplTest, GivenName) {
|
||||
EXPECT_EQ(profile_info_provider.GetGivenName(), kProfileGivenName);
|
||||
}
|
||||
|
||||
TEST_F(NearbyShareProfileInfoProviderImplTest, ProfileUserName) {
|
||||
{
|
||||
// If profile username is empty, return std::nullopt.
|
||||
SetProfileUserName(std::string());
|
||||
NearbyShareProfileInfoProviderImpl profile_info_provider(
|
||||
fake_device_info(), fake_account_manager());
|
||||
EXPECT_FALSE(profile_info_provider.GetProfileUserName());
|
||||
}
|
||||
{
|
||||
SetProfileUserName(kProfileProfileUserName);
|
||||
NearbyShareProfileInfoProviderImpl profile_info_provider(
|
||||
fake_device_info(), fake_account_manager());
|
||||
EXPECT_EQ(profile_info_provider.GetProfileUserName(),
|
||||
kProfileProfileUserName);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(NearbyShareProfileInfoProviderImplTest, GivenNameUseLoginAccount) {
|
||||
AccountManager::Account account;
|
||||
account.id = kTestAccountId;
|
||||
|
||||
Reference in New Issue
Block a user