Support 3P oauth flow.

PiperOrigin-RevId: 663964316
This commit is contained in:
Suet-Fei Li
2024-08-16 19:39:13 -07:00
committed by Copybara-Service
parent f1a1c39177
commit a81ce57879
6 changed files with 51 additions and 7 deletions
@@ -117,8 +117,9 @@ class NearbyShareCertificateManagerImplTest
fake_account_manager_.SetAccount(account);
fake_account_manager_.Login([](AccountManager::Account account) {},
[](absl::Status status) {});
fake_account_manager_.Login(
"test_client_id", "test_client_secret",
[](AccountManager::Account account) {}, [](absl::Status status) {});
NearbyShareSchedulerFactory::SetFactoryForTesting(&scheduler_factory_);
NearbyShareCertificateStorageImpl::Factory::SetFactoryForTesting(
@@ -511,10 +512,10 @@ TEST_F(NearbyShareCertificateManagerImplTest,
FastForward(GetNearbyShareTestNotBefore() +
kNearbyShareCertificateValidityPeriod * 0.5 - Now());
std::optional<NearbyShareEncryptedMetadataKey> encrypted_metadata_key_everyone
=
cert_manager_->EncryptPrivateCertificateMetadataKey(
DeviceVisibility::DEVICE_VISIBILITY_EVERYONE);
std::optional<NearbyShareEncryptedMetadataKey>
encrypted_metadata_key_everyone =
cert_manager_->EncryptPrivateCertificateMetadataKey(
DeviceVisibility::DEVICE_VISIBILITY_EVERYONE);
EXPECT_EQ(GetNearbyShareTestEncryptedMetadataKey().encrypted_key(),
encrypted_metadata_key_everyone->encrypted_key());
EXPECT_EQ(GetNearbyShareTestEncryptedMetadataKey().salt(),
@@ -2174,6 +2174,7 @@ TEST_F(NearbySharingServiceImplTest, ValidateLoginStateWhenSettingVisibility) {
absl::Notification login_notification;
account_manager().SetAccount(account);
service_->GetAccountManager()->Login(
"test_client_id", "test_client_secret",
[&](AccountManager::Account account) {
EXPECT_EQ(account.id, kTestAccountId);
login_notification.Notify();
@@ -4467,6 +4468,7 @@ TEST_F(NearbySharingServiceImplTest, ObserveAccountLoginAndLogout) {
account.id = kTestAccountId;
account_manager().SetAccount(account);
service_->GetAccountManager()->Login(
"test_client_id", "test_client_secret",
[&](AccountManager::Account account) {
EXPECT_EQ(account.id, kTestAccountId);
notification.Notify();
@@ -4499,6 +4501,7 @@ TEST_F(NearbySharingServiceImplTest, LoginAndLogoutShouldResetSettings) {
absl::Notification login_notification;
account_manager().SetAccount(account);
service_->GetAccountManager()->Login(
"test_client_id", "test_client_secret",
[&](AccountManager::Account account) {
EXPECT_EQ(account.id, kTestAccountId);
login_notification.Notify();
@@ -4536,6 +4539,7 @@ TEST_F(NearbySharingServiceImplTest, LogoutShouldSetValidVisibility) {
absl::Notification login_notification;
account_manager().SetAccount(account);
service_->GetAccountManager()->Login(
"test_client_id", "test_client_secret",
[&](AccountManager::Account account) {
EXPECT_EQ(account.id, kTestAccountId);
login_notification.Notify();
@@ -4563,6 +4567,7 @@ TEST_F(NearbySharingServiceImplTest, LogoutShouldSetValidVisibility) {
absl::Notification login2_notification;
account_manager().SetAccount(account);
service_->GetAccountManager()->Login(
"test_client_id", "test_client_secret",
[&](AccountManager::Account account) {
EXPECT_EQ(account.id, kTestAccountId);
login2_notification.Notify();
@@ -4605,6 +4610,7 @@ TEST_F(NearbySharingServiceImplTest, LoginAndLogoutNoStopRunningSurfaces) {
account.id = kTestAccountId;
account_manager().SetAccount(account);
service_->GetAccountManager()->Login(
"test_client_id", "test_client_secret",
[&](AccountManager::Account account) {
EXPECT_EQ(account.id, kTestAccountId);
notification.Notify();