mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 22:56:12 -04:00
[Nearby Presence] Implement FakePresenceService::GetLocalPublicCredentials
Implements FakePresenceService::GetLocalPublicCredentials and exposes FakePresenceService::SetLocalPublicCredentialsResult to configure results for testing. PiperOrigin-RevId: 542383663
This commit is contained in:
committed by
Copybara-Service
parent
5da4b33824
commit
4d85bde8ce
@@ -79,10 +79,16 @@ PresenceDeviceProvider* FakePresenceService::GetLocalDeviceProvider() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Not implemented.
|
||||
void FakePresenceService::GetLocalPublicCredentials(
|
||||
const CredentialSelector& credential_selector,
|
||||
GetPublicCredentialsResultCallback callback) {}
|
||||
GetPublicCredentialsResultCallback callback) {
|
||||
if (get_public_credentials_status_.ok()) {
|
||||
std::move(callback.credentials_fetched_cb)(shared_credentials_);
|
||||
return;
|
||||
}
|
||||
|
||||
std::move(callback.credentials_fetched_cb)(get_public_credentials_status_);
|
||||
}
|
||||
|
||||
void FakePresenceService::UpdateRemotePublicCredentials(
|
||||
absl::string_view manager_app_id, absl::string_view account_name,
|
||||
|
||||
@@ -89,12 +89,20 @@ class FakePresenceService : public PresenceService {
|
||||
update_remote_public_credentials_status_ = status;
|
||||
}
|
||||
|
||||
void SetLocalPublicCredentialsResult(
|
||||
absl::Status status,
|
||||
std::vector<nearby::internal::SharedCredential> shared_credentials) {
|
||||
get_public_credentials_status_ = status;
|
||||
shared_credentials_ = shared_credentials;
|
||||
}
|
||||
|
||||
private:
|
||||
FakePresenceClient* most_recent_fake_presence_client_ = nullptr;
|
||||
std::vector<nearby::internal::SharedCredential> shared_credentials_;
|
||||
std::vector<nearby::internal::SharedCredential> remote_shared_credentials_;
|
||||
absl::Status gen_credentials_status_;
|
||||
absl::Status update_remote_public_credentials_status_;
|
||||
absl::Status get_public_credentials_status_;
|
||||
::nearby::internal::Metadata metadata_;
|
||||
::nearby::Lender<PresenceService*> lender_{this};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user