mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 14:46:12 -04:00
Use client_secret and client_id from prefs in grpc client.
PiperOrigin-RevId: 671450009
This commit is contained in:
committed by
Copybara-Service
parent
b531fd255a
commit
d89e1f6832
@@ -17,6 +17,7 @@
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "absl/functional/any_invocable.h"
|
||||
#include "absl/status/status.h"
|
||||
@@ -89,6 +90,11 @@ class AccountManager {
|
||||
absl::AnyInvocable<void(absl::string_view)> success_callback,
|
||||
absl::AnyInvocable<void(absl::Status)> failure_callback) = 0;
|
||||
|
||||
// Returns a pair containing the client id and client secret used in the most
|
||||
// recent Login request.
|
||||
// If no current user is logged in, returns empty string for both.
|
||||
virtual std::pair<std::string, std::string> GetOAuthClientCredential() = 0;
|
||||
|
||||
virtual void AddObserver(Observer* observer) = 0;
|
||||
virtual void RemoveObserver(Observer* observer) = 0;
|
||||
};
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "absl/functional/any_invocable.h"
|
||||
#include "absl/status/status.h"
|
||||
@@ -89,6 +90,11 @@ bool FakeAccountManager::GetAccessToken(
|
||||
return true;
|
||||
}
|
||||
|
||||
std::pair<std::string, std::string>
|
||||
FakeAccountManager::GetOAuthClientCredential() {
|
||||
return {"", ""};
|
||||
}
|
||||
|
||||
void FakeAccountManager::SetAccount(std::optional<Account> account) {
|
||||
account_ = account;
|
||||
if (account_.has_value()) {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "absl/functional/any_invocable.h"
|
||||
#include "absl/status/status.h"
|
||||
@@ -50,6 +51,7 @@ class FakeAccountManager : public AccountManager {
|
||||
absl::string_view account_id,
|
||||
absl::AnyInvocable<void(absl::string_view)> success_callback,
|
||||
absl::AnyInvocable<void(absl::Status)> failure_callback) override;
|
||||
std::pair<std::string, std::string> GetOAuthClientCredential() override;
|
||||
void AddObserver(Observer* observer) override;
|
||||
void RemoveObserver(Observer* observer) override;
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
#define THIRD_PARTY_NEARBY_INTERNAL_TEST_MOCK_ACCOUNT_MANAGER_H_
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
#include "absl/functional/any_invocable.h"
|
||||
@@ -45,6 +47,8 @@ class MockAccountManager : public AccountManager {
|
||||
absl::AnyInvocable<void(absl::string_view)> success_callback,
|
||||
absl::AnyInvocable<void(absl::Status)> failure_callback),
|
||||
(override));
|
||||
MOCK_METHOD((std::pair<std::string, std::string>), GetOAuthClientCredential,
|
||||
(), (override));
|
||||
MOCK_METHOD(void, AddObserver, (Observer * observer), (override));
|
||||
MOCK_METHOD(void, RemoveObserver, (Observer * observer), (override));
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user