Remove NearbyShareLocalDeviceDataManagerImpl::DownloadDeviceData.

PiperOrigin-RevId: 692265844
This commit is contained in:
Suet-Fei Li
2024-11-01 12:57:21 -07:00
committed by Copybara-Service
parent f391af8e47
commit cf8d435f81
12 changed files with 30 additions and 334 deletions
@@ -634,10 +634,24 @@ void NearbyShareCertificateManagerImpl::FinishPrivateCertificateRefresh() {
? account->email
: static_cast<std::optional<std::string>>(std::nullopt);
std::optional<EncryptedMetadata> metadata = BuildMetadata(
local_device_data_manager_->GetDeviceName(),
local_device_data_manager_->GetFullName(),
local_device_data_manager_->GetIconUrl(), email, context_);
std::optional<std::string> icon_url =
account.has_value()
? (account->picture_url.empty()
? static_cast<std::optional<std::string>>(std::nullopt)
: account->picture_url)
: static_cast<std::optional<std::string>>(std::nullopt);
std::optional<std::string> full_name =
account.has_value()
? (account->display_name.empty()
? static_cast<std::optional<std::string>>(std::nullopt)
: account->display_name)
: static_cast<std::optional<std::string>>(std::nullopt);
std::optional<EncryptedMetadata> metadata =
BuildMetadata(local_device_data_manager_->GetDeviceName(), full_name,
icon_url, email, context_);
if (!metadata.has_value()) {
NL_LOG(WARNING)
<< __func__
@@ -112,6 +112,8 @@ class NearbyShareCertificateManagerImplTest
contact_manager_ = std::make_unique<FakeNearbyShareContactManager>();
AccountManager::Account account{
.display_name = GetNearbyShareTestMetadata().full_name(),
.picture_url = GetNearbyShareTestMetadata().icon_url(),
.email = kTestMetadataAccountName,
};
@@ -815,9 +817,12 @@ TEST_F(NearbyShareCertificateManagerImplTest,
RefreshPrivateCertificates_MissingFullNameAndIconUrl) {
cert_store_->ReplacePrivateCertificates({});
// Full name and icon URL are missing in the local device data manager.
local_device_data_manager_->SetFullName(std::nullopt);
local_device_data_manager_->SetIconUrl(std::nullopt);
// Full name and icon URL are missing in the account.
AccountManager::Account account{
.email = kTestMetadataAccountName,
};
fake_account_manager_.SetAccount(account);
cert_manager_->Start();
HandlePrivateCertificateRefresh(/*expect_private_cert_refresh=*/true,
-8
View File
@@ -60,8 +60,6 @@ ABSL_CONST_INIT const char kNearbySharingFullNameName[] =
"nearby_sharing.full_name";
ABSL_CONST_INIT const char kNearbySharingIconUrlName[] =
"nearby_sharing.icon_url";
ABSL_CONST_INIT const char kNearbySharingIconTokenName[] =
"nearby_sharing.icon_token";
ABSL_CONST_INIT const char kNearbySharingPublicCertificateExpirationDictName[] =
"nearbyshare.public_certificate_expiration_dict";
ABSL_CONST_INIT const char kNearbySharingPrivateCertificateListName[] =
@@ -69,8 +67,6 @@ ABSL_CONST_INIT const char kNearbySharingPrivateCertificateListName[] =
ABSL_CONST_INIT const char
kNearbySharingSchedulerContactDownloadAndUploadName[] =
"nearby_sharing.scheduler.contact_download_and_upload";
ABSL_CONST_INIT const char kNearbySharingSchedulerDownloadDeviceDataName[] =
"nearby_sharing.scheduler.download_device_data";
ABSL_CONST_INIT const char
kNearbySharingSchedulerDownloadPublicCertificatesName[] =
"nearby_sharing.scheduler.download_public_certificates";
@@ -131,13 +127,10 @@ void RegisterNearbySharingPrefs(PreferenceManager& preference_manager,
preference_manager.SetString(kNearbySharingIconUrlName, std::string());
preference_manager.SetString(kNearbySharingIconTokenName, std::string());
preference_manager.Remove(kNearbySharingPublicCertificateExpirationDictName);
preference_manager.Remove(kNearbySharingPrivateCertificateListName);
preference_manager.Remove(
kNearbySharingSchedulerContactDownloadAndUploadName);
preference_manager.Remove(kNearbySharingSchedulerDownloadDeviceDataName);
preference_manager.Remove(
kNearbySharingSchedulerDownloadPublicCertificatesName);
preference_manager.Remove(
@@ -155,7 +148,6 @@ void RegisterNearbySharingPrefs(PreferenceManager& preference_manager,
void ResetSchedulers(PreferenceManager& preference_manager) {
preference_manager.Remove(
kNearbySharingSchedulerContactDownloadAndUploadName);
preference_manager.Remove(kNearbySharingSchedulerDownloadDeviceDataName);
preference_manager.Remove(
kNearbySharingSchedulerDownloadPublicCertificatesName);
preference_manager.Remove(
-3
View File
@@ -38,14 +38,11 @@ ABSL_CONST_INIT extern const char
kNearbySharingFastInitiationNotificationStateName[];
ABSL_CONST_INIT extern const char kNearbySharingFullNameName[];
ABSL_CONST_INIT extern const char kNearbySharingIconUrlName[];
ABSL_CONST_INIT extern const char kNearbySharingIconTokenName[];
ABSL_CONST_INIT extern const char kNearbySharingPrivateCertificateListName[];
ABSL_CONST_INIT extern const char
kNearbySharingPublicCertificateExpirationDictName[];
ABSL_CONST_INIT extern const char
kNearbySharingSchedulerContactDownloadAndUploadName[];
ABSL_CONST_INIT extern const char
kNearbySharingSchedulerDownloadDeviceDataName[];
ABSL_CONST_INIT extern const char
kNearbySharingSchedulerDownloadPublicCertificatesName[];
ABSL_CONST_INIT extern const char
@@ -125,10 +125,6 @@ DeviceNameValidationResult FakeNearbyShareLocalDeviceDataManager::SetDeviceName(
return DeviceNameValidationResult::kValid;
}
void FakeNearbyShareLocalDeviceDataManager::DownloadDeviceData() {
++num_download_device_data_calls_;
}
void FakeNearbyShareLocalDeviceDataManager::UploadContacts(
std::vector<nearby::sharing::proto::Contact> contacts,
UploadCompleteCallback callback) {
@@ -168,9 +164,5 @@ void FakeNearbyShareLocalDeviceDataManager::SetIconUrl(
/*did_icon_change=*/true);
}
void FakeNearbyShareLocalDeviceDataManager::OnStart() {}
void FakeNearbyShareLocalDeviceDataManager::OnStop() {}
} // namespace sharing
} // namespace nearby
@@ -102,7 +102,6 @@ class FakeNearbyShareLocalDeviceDataManager
DeviceNameValidationResult ValidateDeviceName(
absl::string_view name) override;
DeviceNameValidationResult SetDeviceName(absl::string_view name) override;
void DownloadDeviceData() override;
void UploadContacts(std::vector<nearby::sharing::proto::Contact> contacts,
UploadCompleteCallback callback) override;
void UploadCertificates(
@@ -117,10 +116,6 @@ class FakeNearbyShareLocalDeviceDataManager
void SetFullName(const std::optional<std::string>& full_name);
void SetIconUrl(const std::optional<std::string>& icon_url);
size_t num_download_device_data_calls() const {
return num_download_device_data_calls_;
}
std::vector<UploadContactsCall>& upload_contacts_calls() {
return upload_contacts_calls_;
}
@@ -146,14 +141,11 @@ class FakeNearbyShareLocalDeviceDataManager
private:
// NearbyShareLocalDeviceDataManager:
void OnStart() override;
void OnStop() override;
std::string id_;
std::string device_name_;
std::optional<std::string> full_name_;
std::optional<std::string> icon_url_;
size_t num_download_device_data_calls_ = 0;
std::vector<UploadContactsCall> upload_contacts_calls_;
std::vector<UploadCertificatesCall> upload_certificates_calls_;
DeviceNameValidationResult next_validation_result_ =
@@ -47,14 +47,12 @@ void NearbyShareLocalDeviceDataManager::Start() {
if (is_running_) return;
is_running_ = true;
OnStart();
}
void NearbyShareLocalDeviceDataManager::Stop() {
if (!is_running_) return;
is_running_ = false;
OnStop();
}
void NearbyShareLocalDeviceDataManager::NotifyLocalDeviceDataChanged(
@@ -71,6 +71,8 @@ class NearbyShareLocalDeviceDataManager {
// This can be modified by SetDeviceName().
virtual std::string GetDeviceName() const = 0;
// TODO(b/690916264): NearbyShareLocalDeviceDataManager FullName & IconUrl
// are no longer used, delete them.
// Returns the user's full name, for example, "Barack Obama". Returns
// absl::nullopt if the name has not yet been set from an UpdateDevice RPC
// response.
@@ -92,12 +94,6 @@ class NearbyShareLocalDeviceDataManager {
// are notified via OnLocalDeviceDataChanged() if the device name changes.
virtual DeviceNameValidationResult SetDeviceName(absl::string_view name) = 0;
// Makes an UpdateDevice RPC call to the Nearby Share server to retrieve all
// available device data, which includes the full name and icon URL for now.
// This action is also scheduled periodically. Observers are notified via
// OnLocalDeviceDataChanged() if any device data changes.
virtual void DownloadDeviceData() = 0;
// Uses the UpdateDevice RPC to send the local device's contact list to the
// Nearby Share server, including which contacts are allowed for
// selected-contacts visibility mode. This should only be invoked by the
@@ -116,9 +112,6 @@ class NearbyShareLocalDeviceDataManager {
UploadCompleteCallback callback) = 0;
protected:
virtual void OnStart() = 0;
virtual void OnStop() = 0;
void NotifyLocalDeviceDataChanged(bool did_device_name_change,
bool did_full_name_change,
bool did_icon_change);
@@ -75,8 +75,6 @@ constexpr absl::string_view kDeviceIdPrefix = "users/me/devices/";
constexpr absl::string_view kContactsFieldMaskPath = "contacts";
constexpr absl::string_view kCertificatesFieldMaskPath = "public_certificates";
constexpr absl::Duration kDeviceDataDownloadPeriod = absl::Hours(12);
constexpr absl::string_view kDefaultDeviceName = "$0\'s $1";
// Returns a truncated version of |name| that is |max_length| characters long.
@@ -134,13 +132,6 @@ NearbyShareLocalDeviceDataManagerImpl::NearbyShareLocalDeviceDataManagerImpl(
device_info_(device_info),
nearby_share_client_(rpc_client_factory->CreateInstance()),
device_id_(GetId()),
download_device_data_scheduler_(
NearbyShareSchedulerFactory::CreatePeriodicScheduler(
context, preference_manager_, kDeviceDataDownloadPeriod,
/*retry_failures=*/true,
/*require_connectivity=*/true,
prefs::kNearbySharingSchedulerDownloadDeviceDataName,
[&]() { DownloadDeviceData(); })),
executor_(context->CreateSequencedTaskRunner()) {}
NearbyShareLocalDeviceDataManagerImpl::
@@ -179,11 +170,6 @@ std::optional<std::string> NearbyShareLocalDeviceDataManagerImpl::GetIconUrl()
std::string());
}
std::optional<std::string> NearbyShareLocalDeviceDataManagerImpl::GetIconToken()
const {
return preference_manager_.GetString(prefs::kNearbySharingIconTokenName,
std::string());
}
DeviceNameValidationResult
NearbyShareLocalDeviceDataManagerImpl::ValidateDeviceName(
@@ -215,51 +201,6 @@ DeviceNameValidationResult NearbyShareLocalDeviceDataManagerImpl::SetDeviceName(
return DeviceNameValidationResult::kValid;
}
void NearbyShareLocalDeviceDataManagerImpl::DownloadDeviceData() {
executor_->PostTask([&]() {
LOG(INFO) << __func__ << ": started";
if (!is_running()) {
LOG(WARNING) << "DownloadDeviceData: skip to download device data due "
"to manager is stopped.";
return;
}
if (!account_manager_.GetCurrentAccount().has_value()) {
LOG(WARNING) << __func__
<< ": skip to download device data due "
"to no login account.";
download_device_data_scheduler_->HandleResult(/*success=*/true);
return;
}
UpdateDeviceRequest request;
request.mutable_device()->set_name(
absl::StrCat(kDeviceIdPrefix, device_id_));
nearby_share_client_->UpdateDevice(
request, [this](const absl::StatusOr<UpdateDeviceResponse>& response) {
// check whether the manager is running again
if (!is_running()) {
LOG(WARNING)
<< "DownloadDeviceData: skip to download device data due "
"to manager is stopped.";
return;
}
if (response.ok()) {
LOG(WARNING) << "DownloadDeviceData: Got response from backend.";
HandleUpdateDeviceResponse(*response);
} else {
LOG(WARNING)
<< "DownloadDeviceData: Failed to get response from backend: "
<< response.status();
}
download_device_data_scheduler_->HandleResult(
/*success=*/response.ok());
});
});
}
void NearbyShareLocalDeviceDataManagerImpl::UploadContacts(
std::vector<nearby::sharing::proto::Contact> contacts,
UploadCompleteCallback callback) {
@@ -351,16 +292,6 @@ void NearbyShareLocalDeviceDataManagerImpl::UploadCertificates(
});
}
void NearbyShareLocalDeviceDataManagerImpl::OnStart() {
// This schedules an immediate download of the full name and icon URL from the
// server if that has never happened before.
download_device_data_scheduler_->Start();
}
void NearbyShareLocalDeviceDataManagerImpl::OnStop() {
download_device_data_scheduler_->Stop();
}
std::string NearbyShareLocalDeviceDataManagerImpl::GetDefaultDeviceName()
const {
std::optional<AccountManager::Account> account =
@@ -390,44 +321,5 @@ std::string NearbyShareLocalDeviceDataManagerImpl::GetDefaultDeviceName()
return absl::Substitute(kDefaultDeviceName, truncated_name, device_type);
}
void NearbyShareLocalDeviceDataManagerImpl::HandleUpdateDeviceResponse(
const std::optional<nearby::sharing::proto::UpdateDeviceResponse>&
response) {
if (!response) return;
bool did_full_name_change = response->person_name() != GetFullName();
if (did_full_name_change) {
preference_manager_.SetString(prefs::kNearbySharingFullNameName,
response->person_name());
}
// NOTE(http://crbug.com/1211189): An icon URL can change without the
// underlying image changing. For example, icon URLs for some child accounts
// can rotate on every UpdateDevice RPC call; a timestamp is included in the
// URL. The icon token is used to detect changes in the underlying image. If a
// new URL is sent and the token doesn't change, the old URL may still be
// valid for a couple of weeks, for example. So, private certificates do not
// necessarily need to update the icon URL whenever it changes. Also, we don't
// expect the token to change without the URL changing; regardless, we don't
// consider the icon changed unless the URL changes. That way, private
// certificates will not be unnecessarily regenerated.
bool did_icon_url_change = response->image_url() != GetIconUrl();
bool did_icon_token_change = response->image_token() != GetIconToken();
bool did_icon_change = did_icon_url_change && did_icon_token_change;
if (did_icon_url_change) {
preference_manager_.SetString(prefs::kNearbySharingIconUrlName,
response->image_url());
}
if (did_icon_token_change) {
preference_manager_.SetString(prefs::kNearbySharingIconTokenName,
response->image_token());
}
if (!did_full_name_change && !did_icon_change) return;
NotifyLocalDeviceDataChanged(/*did_device_name_change=*/false,
did_full_name_change, did_icon_change);
}
} // namespace sharing
} // namespace nearby
@@ -81,16 +81,11 @@ class NearbyShareLocalDeviceDataManagerImpl
DeviceNameValidationResult ValidateDeviceName(
absl::string_view name) override;
DeviceNameValidationResult SetDeviceName(absl::string_view name) override;
void DownloadDeviceData() override;
void UploadContacts(std::vector<nearby::sharing::proto::Contact> contacts,
UploadCompleteCallback callback) override;
void UploadCertificates(
std::vector<nearby::sharing::proto::PublicCertificate> certificates,
UploadCompleteCallback callback) override;
void OnStart() override;
void OnStop() override;
std::optional<std::string> GetIconToken() const;
// Creates a default device name of the form "<given name>'s <device type>."
// For example, "Josh's Chromebook." If a given name cannot be found, returns
@@ -98,16 +93,11 @@ class NearbyShareLocalDeviceDataManagerImpl
// will be truncated, for example "Mi...'s Chromebook."
std::string GetDefaultDeviceName() const;
void HandleUpdateDeviceResponse(
const std::optional<nearby::sharing::proto::UpdateDeviceResponse>&
response);
nearby::sharing::api::PreferenceManager& preference_manager_;
AccountManager& account_manager_;
nearby::DeviceInfo& device_info_;
std::unique_ptr<nearby::sharing::api::SharingRpcClient> nearby_share_client_;
const std::string device_id_;
std::unique_ptr<NearbyShareScheduler> download_device_data_scheduler_;
std::unique_ptr<TaskRunner> executor_;
};
@@ -156,7 +156,6 @@ class NearbyShareLocalDeviceDataManagerImplTest
manager_->AddObserver(this);
++num_manager_creations_;
num_download_device_data_ = 0;
VerifyInitialization();
manager_->Start();
}
@@ -165,33 +164,6 @@ class NearbyShareLocalDeviceDataManagerImplTest
manager_.reset();
}
void DownloadDeviceData(
const absl::StatusOr<UpdateDeviceResponse>& response) {
// The scheduler requests a download of device data from the server.
EXPECT_EQ(client()->update_device_requests().size(),
num_download_device_data_);
device_data_scheduler()->InvokeRequestCallback();
Sync();
EXPECT_EQ(client()->update_device_requests().size(),
num_download_device_data_ + 1);
num_download_device_data_++;
EXPECT_TRUE(client()->list_contact_people_requests().empty());
EXPECT_TRUE(client()->list_public_certificates_requests().empty());
size_t num_handled_results =
device_data_scheduler()->handled_results().size();
client()->SetUpdateDeviceResponse(response);
manager_->DownloadDeviceData();
Sync();
EXPECT_EQ(client()->update_device_requests().size(),
num_download_device_data_ + 1);
num_download_device_data_++;
EXPECT_EQ(num_handled_results + 1,
device_data_scheduler()->handled_results().size());
EXPECT_EQ(response.ok(), device_data_scheduler()->handled_results().back());
}
void UploadContacts(const absl::StatusOr<UpdateDeviceResponse>& response) {
std::optional<bool> returned_success;
@@ -252,12 +224,6 @@ class NearbyShareLocalDeviceDataManagerImplTest
return notifications_;
}
FakeNearbyShareScheduler* device_data_scheduler() {
return scheduler_factory_.pref_name_to_periodic_instance()
.at(prefs::kNearbySharingSchedulerDownloadDeviceDataName)
.fake_scheduler;
}
std::string GetDeviceName() const {
return fake_device_info_.GetOsDeviceName();
}
@@ -276,18 +242,6 @@ class NearbyShareLocalDeviceDataManagerImplTest
}
private:
void VerifyInitialization() {
// Verify device data scheduler input parameters.
const FakeNearbyShareSchedulerFactory::PeriodicInstance&
device_data_scheduler_instance =
scheduler_factory_.pref_name_to_periodic_instance().at(
prefs::kNearbySharingSchedulerDownloadDeviceDataName);
EXPECT_TRUE(device_data_scheduler_instance.fake_scheduler);
EXPECT_EQ(absl::Hours(12), device_data_scheduler_instance.request_period);
EXPECT_TRUE(device_data_scheduler_instance.retry_failures);
EXPECT_TRUE(device_data_scheduler_instance.require_connectivity);
}
nearby::FakePreferenceManager preference_manager_;
nearby::FakeAccountManager fake_account_manager_;
nearby::FakeDeviceInfo fake_device_info_;
@@ -389,119 +343,6 @@ TEST_F(NearbyShareLocalDeviceDataManagerImplTest, SetDeviceName) {
EXPECT_EQ(manager()->GetDeviceName(), kFakeDeviceName);
}
TEST_F(NearbyShareLocalDeviceDataManagerImplTest, DownloadDeviceData_Success) {
CreateManager();
EXPECT_TRUE(notifications().empty());
DownloadDeviceData(
CreateResponse(kFakeFullName, kFakeIconUrl, kFakeIconToken));
EXPECT_EQ(manager()->GetFullName(), kFakeFullName);
EXPECT_EQ(manager()->GetIconUrl(), kFakeIconUrl);
EXPECT_EQ(notifications().size(), 1u);
EXPECT_EQ(ObserverNotification(/*did_device_name_change=*/false,
/*did_full_name_change=*/true,
/*did_icon_change=*/true),
notifications()[0]);
// Verify that the data is persisted.
DestroyManager();
CreateManager();
EXPECT_EQ(manager()->GetFullName(), kFakeFullName);
EXPECT_EQ(manager()->GetIconUrl(), kFakeIconUrl);
}
TEST_F(NearbyShareLocalDeviceDataManagerImplTest,
DownloadDeviceData_EmptyData) {
CreateManager();
EXPECT_TRUE(notifications().empty());
// The server returns empty strings for the full name and icon URL/token.
// GetFullName() and GetIconUrl() should return non-nullopt values even though
// they are trivial values.
DownloadDeviceData(CreateResponse("", "", ""));
EXPECT_EQ(manager()->GetFullName(), "");
EXPECT_EQ(manager()->GetIconUrl(), "");
EXPECT_EQ(notifications().size(), 0u);
// Return empty strings again. Ensure that the trivial full name and icon
// URL/token values are not considered changed and no notification is sent.
DownloadDeviceData(CreateResponse("", "", ""));
EXPECT_EQ(manager()->GetFullName(), "");
EXPECT_EQ(manager()->GetIconUrl(), "");
EXPECT_EQ(notifications().size(), 0u);
// Verify that the data is persisted.
DestroyManager();
CreateManager();
EXPECT_EQ(manager()->GetFullName(), "");
EXPECT_EQ(manager()->GetIconUrl(), "");
}
TEST_F(NearbyShareLocalDeviceDataManagerImplTest,
DownloadDeviceData_IconToken) {
CreateManager();
EXPECT_TRUE(notifications().empty());
DownloadDeviceData(
CreateResponse(kFakeFullName, kFakeIconUrl, kFakeIconToken));
EXPECT_EQ(manager()->GetFullName(), kFakeFullName);
EXPECT_EQ(manager()->GetIconUrl(), kFakeIconUrl);
EXPECT_EQ(notifications().size(), 1u);
EXPECT_EQ(ObserverNotification(/*did_device_name_change=*/false,
/*did_full_name_change=*/true,
/*did_icon_change=*/true),
notifications()[0]);
// Destroy and recreate to ensure name, URL, and token are all persisted.
DestroyManager();
CreateManager();
// The icon URL changes but the token does not; no notification sent.
DownloadDeviceData(
CreateResponse(kFakeFullName, kFakeIconUrl2, kFakeIconToken));
EXPECT_EQ(manager()->GetFullName(), kFakeFullName);
EXPECT_EQ(manager()->GetIconUrl(), kFakeIconUrl2);
EXPECT_EQ(notifications().size(), 1u);
// The icon token changes but the URL does not; no notification sent.
DestroyManager();
CreateManager();
DownloadDeviceData(
CreateResponse(kFakeFullName, kFakeIconUrl2, kFakeIconToken2));
EXPECT_EQ(manager()->GetFullName(), kFakeFullName);
EXPECT_EQ(manager()->GetIconUrl(), kFakeIconUrl2);
EXPECT_EQ(notifications().size(), 1u);
// The icon URL and token change; notification sent.
DestroyManager();
CreateManager();
DownloadDeviceData(
CreateResponse(kFakeFullName, kFakeIconUrl, kFakeIconToken));
EXPECT_EQ(manager()->GetFullName(), kFakeFullName);
EXPECT_EQ(manager()->GetIconUrl(), kFakeIconUrl);
EXPECT_EQ(notifications().size(), 2u);
EXPECT_EQ(ObserverNotification(/*did_device_name_change=*/false,
/*did_full_name_change=*/false,
/*did_icon_change=*/true),
notifications()[1]);
// Verify that the data is persisted.
DestroyManager();
CreateManager();
EXPECT_EQ(manager()->GetFullName(), kFakeFullName);
EXPECT_EQ(manager()->GetIconUrl(), kFakeIconUrl);
}
TEST_F(NearbyShareLocalDeviceDataManagerImplTest, DownloadDeviceData_Failure) {
CreateManager();
DownloadDeviceData(/*response=*/absl::InternalError(""));
// No full name or icon URL set because the response was null.
EXPECT_EQ(manager()->GetFullName(), std::string());
EXPECT_EQ(manager()->GetIconUrl(), std::string());
EXPECT_TRUE(notifications().empty());
}
TEST_F(NearbyShareLocalDeviceDataManagerImplTest, UploadContacts_Success) {
CreateManager();
UploadContacts(CreateResponse(kFakeFullName, kFakeIconUrl, kFakeIconToken));
+2 -12
View File
@@ -496,11 +496,8 @@ void NearbySharingServiceImpl::RegisterSendSurface(
// user to be blocked for hours waiting for a periodic sync.
if (state == SendSurfaceState::kForeground &&
!last_outgoing_metadata_) {
VLOG(1) << __func__
<< ": Downloading local device data, contacts, and "
"certificates from "
VLOG(1) << __func__ << ": Downloading contacts & certificates from "
<< "Nearby server at start of sending flow.";
local_device_data_manager_->DownloadDeviceData();
contact_manager_->DownloadContacts();
certificate_manager_->DownloadPublicCertificates();
}
@@ -1028,10 +1025,8 @@ void NearbySharingServiceImpl::OnIncomingConnection(
// need to wait for these calls to finish. The periodic server requests will
// typically be sufficient, but we don't want the user to be blocked for
// hours waiting for a periodic sync.
VLOG(1) << __func__
<< ": Downloading local device data, contacts, and certificates from "
VLOG(1) << __func__ << ": Downloading contacts, and certificates from "
<< "Nearby server at start of receiving flow.";
local_device_data_manager_->DownloadDeviceData();
contact_manager_->DownloadContacts();
certificate_manager_->DownloadPublicCertificates();
@@ -1205,11 +1200,6 @@ std::string NearbySharingServiceImpl::Dump() const {
preference_manager_,
prefs::kNearbySharingSchedulerContactDownloadAndUploadName)
<< std::endl;
sstream << " Download device data: "
<< ConvertToReadableSchedule(
preference_manager_,
prefs::kNearbySharingSchedulerDownloadDeviceDataName)
<< std::endl;
sstream << " Download public certificates: "
<< ConvertToReadableSchedule(
preference_manager_,