From 0d0e2e461a061c1dd4e10a623bde9bceac9187f0 Mon Sep 17 00:00:00 2001 From: Peter Kotwicz Date: Tue, 24 Jan 2023 22:54:09 +0000 Subject: [PATCH] Rename CreditCardFIDOAuthenticator -> CreditCardFidoAuthenticator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This brings the class name of CreditCardFidoAuthenticator in line with the Google C++ naming rules for acronyms. BUG=1404395 Change-Id: I5d5c609a12a5d159787e4e5d8f0f4decab396f5b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4185301 Reviewed-by: Dominic Battré Commit-Queue: Peter Kotwicz Cr-Commit-Position: refs/heads/main@{#1096459} --- .../metrics/autofill_metrics_test_base.cc | 6 +- .../payments/credit_card_access_manager.cc | 44 ++++---- .../payments/credit_card_access_manager.h | 14 +-- .../credit_card_access_manager_unittest.cc | 74 ++++++------- .../credit_card_fido_authenticator.cc | 74 ++++++------- .../payments/credit_card_fido_authenticator.h | 24 ++--- ...credit_card_fido_authenticator_unittest.cc | 102 +++++++++--------- .../core/browser/payments/full_card_request.h | 2 +- .../payments/test_authentication_requester.cc | 2 +- .../payments/test_authentication_requester.h | 10 +- .../test_credit_card_fido_authenticator.cc | 44 ++++---- .../test_credit_card_fido_authenticator.h | 20 ++-- 12 files changed, 208 insertions(+), 208 deletions(-) diff --git a/components/autofill/core/browser/metrics/autofill_metrics_test_base.cc b/components/autofill/core/browser/metrics/autofill_metrics_test_base.cc index 4824c8a9c7f54..1fb5af52955bc 100644 --- a/components/autofill/core/browser/metrics/autofill_metrics_test_base.cc +++ b/components/autofill/core/browser/metrics/autofill_metrics_test_base.cc @@ -81,7 +81,7 @@ void AutofillMetricsBaseTest::SetUp() { autofill_manager() .GetCreditCardAccessManager() ->set_fido_authenticator_for_testing( - std::make_unique( + std::make_unique( autofill_driver_.get(), autofill_client_.get())); #endif @@ -134,8 +134,8 @@ void AutofillMetricsBaseTest::SetFidoEligibility(bool is_verifiable) { CreditCardAccessManager* access_manager = autofill_manager().GetCreditCardAccessManager(); #if !BUILDFLAG(IS_IOS) - static_cast( - access_manager->GetOrCreateFIDOAuthenticator()) + static_cast( + access_manager->GetOrCreateFidoAuthenticator()) ->SetUserVerifiable(is_verifiable); #endif static_cast( diff --git a/components/autofill/core/browser/payments/credit_card_access_manager.cc b/components/autofill/core/browser/payments/credit_card_access_manager.cc index 24d71c456cbdf..f7ebdd86fc6e3 100644 --- a/components/autofill/core/browser/payments/credit_card_access_manager.cc +++ b/components/autofill/core/browser/payments/credit_card_access_manager.cc @@ -161,7 +161,7 @@ void CreditCardAccessManager::PrepareToFetchCreditCard() { } else { is_user_verifiable_called_timestamp_ = AutofillTickClock::NowTicks(); - GetOrCreateFIDOAuthenticator()->IsUserVerifiable(base::BindOnce( + GetOrCreateFidoAuthenticator()->IsUserVerifiable(base::BindOnce( &CreditCardAccessManager::GetUnmaskDetailsIfUserIsVerifiable, weak_ptr_factory_.GetWeakPtr())); } @@ -222,7 +222,7 @@ void CreditCardAccessManager::OnDidGetUnmaskDetails( #if !BUILDFLAG(IS_IOS) opt_in_intention_ = - GetOrCreateFIDOAuthenticator()->GetUserOptInIntention(unmask_details); + GetOrCreateFidoAuthenticator()->GetUserOptInIntention(unmask_details); #endif ready_to_start_authentication_.Signal(); @@ -295,7 +295,7 @@ void CreditCardAccessManager::FetchCreditCard( if (is_user_verifiable_.value_or(false)) { autofill_metrics::LogUserPerceivedLatencyOnCardSelection( autofill_metrics::PreflightCallEvent::kDidNotChooseMaskedCard, - GetOrCreateFIDOAuthenticator()->IsUserOptedIn()); + GetOrCreateFidoAuthenticator()->IsUserOptedIn()); } #endif Reset(); @@ -328,8 +328,8 @@ void CreditCardAccessManager::FIDOAuthOptChange(bool opt_in) { return; } - GetOrCreateFIDOAuthenticator()->OptOut(); - GetOrCreateFIDOAuthenticator() + GetOrCreateFidoAuthenticator()->OptOut(); + GetOrCreateFidoAuthenticator() ->GetOrCreateFidoAuthenticationStrikeDatabase() ->AddStrikes( FidoAuthenticationStrikeDatabase::kStrikesToAddWhenUserOptsOut); @@ -471,7 +471,7 @@ void CreditCardAccessManager::Authenticate( #else // If |is_authentication_in_progress_| is false, it means the process has // been cancelled via the verification pending dialog. Do not run - // CreditCardFIDOAuthenticator::Authenticate() in this case (should not + // CreditCardFidoAuthenticator::Authenticate() in this case (should not // fall back to CVC auth either). if (!is_authentication_in_progress_) { Reset(); @@ -491,7 +491,7 @@ void CreditCardAccessManager::Authenticate( fido_request_options = std::move(unmask_details_.fido_request_options.value()); } - GetOrCreateFIDOAuthenticator()->Authenticate( + GetOrCreateFidoAuthenticator()->Authenticate( card_.get(), weak_ptr_factory_.GetWeakPtr(), std::move(fido_request_options), context_token); #endif @@ -545,11 +545,11 @@ void CreditCardAccessManager::Authenticate( } #if !BUILDFLAG(IS_IOS) -CreditCardFIDOAuthenticator* -CreditCardAccessManager::GetOrCreateFIDOAuthenticator() { +CreditCardFidoAuthenticator* +CreditCardAccessManager::GetOrCreateFidoAuthenticator() { if (!fido_authenticator_) fido_authenticator_ = - std::make_unique(driver_, client_); + std::make_unique(driver_, client_); return fido_authenticator_.get(); } #endif @@ -596,13 +596,13 @@ void CreditCardAccessManager::OnCVCAuthenticationComplete( // Additionally authorizes the card with FIDO. It also delays the form // filling. - GetOrCreateFIDOAuthenticator()->Authorize(weak_ptr_factory_.GetWeakPtr(), + GetOrCreateFidoAuthenticator()->Authorize(weak_ptr_factory_.GetWeakPtr(), response.card_authorization_token, request_options->Clone()); #endif } if (ShouldOfferFidoOptInDialog(response)) { - // CreditCardFIDOAuthenticator will handle enrollment completely. + // CreditCardFidoAuthenticator will handle enrollment completely. ShowWebauthnOfferDialog(response.card_authorization_token); } @@ -633,7 +633,7 @@ bool CreditCardAccessManager::UserOptedInToFidoFromSettingsPageOnMobile() #if !BUILDFLAG(IS_IOS) void CreditCardAccessManager::OnFIDOAuthenticationComplete( - const CreditCardFIDOAuthenticator::FidoAuthenticationResponse& response) { + const CreditCardFidoAuthenticator::FidoAuthenticationResponse& response) { #if BUILDFLAG(IS_ANDROID) if (base::FeatureList::IsEnabled( features::kAutofillEnableFIDOProgressDialog)) { @@ -772,7 +772,7 @@ bool CreditCardAccessManager::IsUserOptedInToFidoAuth() { return false; #else return is_user_verifiable_.value_or(false) && - GetOrCreateFIDOAuthenticator()->IsUserOptedIn(); + GetOrCreateFidoAuthenticator()->IsUserOptedIn(); #endif } @@ -814,7 +814,7 @@ bool CreditCardAccessManager::ShouldRespondImmediately( bool CreditCardAccessManager::ShouldRegisterCardWithFido( const CreditCardCVCAuthenticator::CVCAuthenticationResponse& response) { // Card authorization token is required in order to call - // CreditCardFIDOAuthenticator::Authorize(), so if we do not have a card + // CreditCardFidoAuthenticator::Authorize(), so if we do not have a card // authorization token populated we immediately return false. if (response.card_authorization_token.empty()) return false; @@ -861,7 +861,7 @@ bool CreditCardAccessManager::ShouldOfferFidoOptInDialog( // If the strike limit was reached for the FIDO opt-in dialog, we should not // offer it. - if (GetOrCreateFIDOAuthenticator() + if (GetOrCreateFidoAuthenticator() ->GetOrCreateFidoAuthenticationStrikeDatabase() ->ShouldBlockFeature()) { return false; @@ -876,7 +876,7 @@ bool CreditCardAccessManager::ShouldOfferFidoOptInDialog( void CreditCardAccessManager::ShowWebauthnOfferDialog( std::string card_authorization_token) { #if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS) - GetOrCreateFIDOAuthenticator()->OnWebauthnOfferDialogRequested( + GetOrCreateFidoAuthenticator()->OnWebauthnOfferDialogRequested( card_authorization_token); client_->ShowWebauthnOfferDialog( base::BindRepeating(&CreditCardAccessManager::HandleDialogUserResponse, @@ -895,11 +895,11 @@ void CreditCardAccessManager::HandleDialogUserResponse( WebauthnDialogCallbackType type) { switch (type) { case WebauthnDialogCallbackType::kOfferAccepted: - GetOrCreateFIDOAuthenticator()->OnWebauthnOfferDialogUserResponse( + GetOrCreateFidoAuthenticator()->OnWebauthnOfferDialogUserResponse( /*did_accept=*/true); break; case WebauthnDialogCallbackType::kOfferCancelled: - GetOrCreateFIDOAuthenticator()->OnWebauthnOfferDialogUserResponse( + GetOrCreateFidoAuthenticator()->OnWebauthnOfferDialogUserResponse( /*did_accept=*/false); break; case WebauthnDialogCallbackType::kVerificationCancelled: @@ -909,11 +909,11 @@ void CreditCardAccessManager::HandleDialogUserResponse( SignalCanFetchUnmaskDetails(); ready_to_start_authentication_.Reset(); unmask_details_request_in_progress_ = false; - GetOrCreateFIDOAuthenticator()->CancelVerification(); + GetOrCreateFidoAuthenticator()->CancelVerification(); // Indicate that FIDO authentication was canceled, resulting in falling // back to CVC auth. - CreditCardFIDOAuthenticator::FidoAuthenticationResponse response{ + CreditCardFidoAuthenticator::FidoAuthenticationResponse response{ .did_succeed = false}; OnFIDOAuthenticationComplete(response); break; @@ -946,7 +946,7 @@ void CreditCardAccessManager::FetchMaskedServerCard() { kPreflightCallReturnedBeforeCardChosen : autofill_metrics::PreflightCallEvent:: kCardChosenBeforePreflightCallReturned, - GetOrCreateFIDOAuthenticator()->IsUserOptedIn()); + GetOrCreateFidoAuthenticator()->IsUserOptedIn()); } #endif diff --git a/components/autofill/core/browser/payments/credit_card_access_manager.h b/components/autofill/core/browser/payments/credit_card_access_manager.h index 2eda65683140a..1d5bfae1dba08 100644 --- a/components/autofill/core/browser/payments/credit_card_access_manager.h +++ b/components/autofill/core/browser/payments/credit_card_access_manager.h @@ -88,7 +88,7 @@ struct CachedServerCardInfo { // with Google Payments. Owned by BrowserAutofillManager. class CreditCardAccessManager : public CreditCardCVCAuthenticator::Requester, #if !BUILDFLAG(IS_IOS) - public CreditCardFIDOAuthenticator::Requester, + public CreditCardFidoAuthenticator::Requester, #endif public CreditCardOtpAuthenticator::Requester { public: @@ -158,7 +158,7 @@ class CreditCardAccessManager : public CreditCardCVCAuthenticator::Requester, bool IsCardPresentInUnmaskedCache(const CreditCard& card) const; #if !BUILDFLAG(IS_IOS) - CreditCardFIDOAuthenticator* GetOrCreateFIDOAuthenticator(); + CreditCardFidoAuthenticator* GetOrCreateFidoAuthenticator(); #endif // CreditCardCVCAuthenticator::Requester: @@ -219,7 +219,7 @@ class CreditCardAccessManager : public CreditCardCVCAuthenticator::Requester, #if !BUILDFLAG(IS_IOS) void set_fido_authenticator_for_testing( - std::unique_ptr fido_authenticator) { + std::unique_ptr fido_authenticator) { fido_authenticator_ = std::move(fido_authenticator); } #endif @@ -237,7 +237,7 @@ class CreditCardAccessManager : public CreditCardCVCAuthenticator::Requester, // Returns whether or not unmasked card cache is empty. Exposed for testing. bool UnmaskedCardCacheIsEmpty(); - // Invoked from CreditCardFIDOAuthenticator::IsUserVerifiable(). + // Invoked from CreditCardFidoAuthenticator::IsUserVerifiable(). // |is_user_verifiable| is set to true only if user has a verifying platform // authenticator. e.g. Touch/Face ID, Windows Hello, Android fingerprint, // etc., is available and enabled. If set to true, then an Unmask Details @@ -267,9 +267,9 @@ class CreditCardAccessManager : public CreditCardCVCAuthenticator::Requester, #endif #if !BUILDFLAG(IS_IOS) - // CreditCardFIDOAuthenticator::Requester: + // CreditCardFidoAuthenticator::Requester: void OnFIDOAuthenticationComplete( - const CreditCardFIDOAuthenticator::FidoAuthenticationResponse& response) + const CreditCardFidoAuthenticator::FidoAuthenticationResponse& response) override; void OnFidoAuthorizationComplete(bool did_succeed) override; #endif @@ -419,7 +419,7 @@ class CreditCardAccessManager : public CreditCardCVCAuthenticator::Requester, absl::optional is_user_verifiable_called_timestamp_; #if !BUILDFLAG(IS_IOS) - std::unique_ptr fido_authenticator_; + std::unique_ptr fido_authenticator_; // User opt in/out intention when local pref and payments mismatch. UserOptInIntention opt_in_intention_ = UserOptInIntention::kUnspecified; diff --git a/components/autofill/core/browser/payments/credit_card_access_manager_unittest.cc b/components/autofill/core/browser/payments/credit_card_access_manager_unittest.cc index d497ec66719c0..4f5d6228d098c 100644 --- a/components/autofill/core/browser/payments/credit_card_access_manager_unittest.cc +++ b/components/autofill/core/browser/payments/credit_card_access_manager_unittest.cc @@ -207,7 +207,7 @@ class CreditCardAccessManagerTest : public testing::Test { autofill_driver_->set_autofill_manager( std::move(browser_autofill_manager_)); autofill_driver_->SetAuthenticator(new TestInternalAuthenticator()); - auto fido_authenticator = std::make_unique( + auto fido_authenticator = std::make_unique( autofill_driver_.get(), &autofill_client_); fido_authenticator_ = fido_authenticator.get(); credit_card_access_manager_->set_fido_authenticator_for_testing( @@ -391,9 +391,9 @@ class CreditCardAccessManagerTest : public testing::Test { GetFIDOAuthenticator()->OnDidGetOptChangeResult(result, response); } - TestCreditCardFIDOAuthenticator* GetFIDOAuthenticator() { - return static_cast( - credit_card_access_manager_->GetOrCreateFIDOAuthenticator()); + TestCreditCardFidoAuthenticator* GetFIDOAuthenticator() { + return static_cast( + credit_card_access_manager_->GetOrCreateFidoAuthenticator()); } #endif @@ -485,7 +485,7 @@ class CreditCardAccessManagerTest : public testing::Test { EXPECT_EQ(fido_authenticator_->context_token().value(), "fake_context_token"); - CreditCardFIDOAuthenticator::FidoAuthenticationResponse fido_response{ + CreditCardFidoAuthenticator::FidoAuthenticationResponse fido_response{ .did_succeed = false}; credit_card_access_manager_->OnFIDOAuthenticationComplete(fido_response); } @@ -556,7 +556,7 @@ class CreditCardAccessManagerTest : public testing::Test { raw_ptr credit_card_access_manager_; raw_ptr otp_authenticator_; #if !BUILDFLAG(IS_IOS) - raw_ptr fido_authenticator_; + raw_ptr fido_authenticator_; #endif }; @@ -848,9 +848,9 @@ TEST_F(CreditCardAccessManagerTest, FetchServerCardFIDOSuccess) { CreditCardFormEventLogger::UnmaskAuthFlowEvent::kPromptShown, 1); // FIDO Success. - EXPECT_EQ(CreditCardFIDOAuthenticator::Flow::AUTHENTICATION_FLOW, + EXPECT_EQ(CreditCardFidoAuthenticator::Flow::AUTHENTICATION_FLOW, GetFIDOAuthenticator()->current_flow()); - TestCreditCardFIDOAuthenticator::GetAssertion(GetFIDOAuthenticator(), + TestCreditCardFidoAuthenticator::GetAssertion(GetFIDOAuthenticator(), /*did_succeed=*/true); EXPECT_TRUE(GetRealPanForFIDOAuth(AutofillClient::PaymentsRpcResult::kSuccess, kTestNumber)); @@ -900,7 +900,7 @@ TEST_F(CreditCardAccessManagerTest, FetchServerCardFIDOSuccessWithDcvv) { WaitForCallbacks(); // FIDO Success. - TestCreditCardFIDOAuthenticator::GetAssertion(GetFIDOAuthenticator(), + TestCreditCardFidoAuthenticator::GetAssertion(GetFIDOAuthenticator(), /*did_succeed=*/true); // Mock Payments response that includes DCVV along with Full PAN. @@ -941,9 +941,9 @@ TEST_F(CreditCardAccessManagerTest, CreditCardFormEventLogger::UnmaskAuthFlowEvent::kPromptShown, 1); // FIDO Failure. - EXPECT_EQ(CreditCardFIDOAuthenticator::Flow::AUTHENTICATION_FLOW, + EXPECT_EQ(CreditCardFidoAuthenticator::Flow::AUTHENTICATION_FLOW, GetFIDOAuthenticator()->current_flow()); - TestCreditCardFIDOAuthenticator::GetAssertion(GetFIDOAuthenticator(), + TestCreditCardFidoAuthenticator::GetAssertion(GetFIDOAuthenticator(), /*did_succeed=*/false); histogram_tester.ExpectBucketCount( @@ -955,7 +955,7 @@ TEST_F(CreditCardAccessManagerTest, EXPECT_NE(accessor_->result(), CreditCardFetchResult::kSuccess); // Followed by a fallback to CVC. - EXPECT_EQ(CreditCardFIDOAuthenticator::Flow::NONE_FLOW, + EXPECT_EQ(CreditCardFidoAuthenticator::Flow::NONE_FLOW, GetFIDOAuthenticator()->current_flow()); EXPECT_TRUE(GetRealPanForCVCAuth(AutofillClient::PaymentsRpcResult::kSuccess, kTestNumber)); @@ -996,16 +996,16 @@ TEST_F(CreditCardAccessManagerTest, WaitForCallbacks(); // FIDO Failure. - EXPECT_EQ(CreditCardFIDOAuthenticator::Flow::AUTHENTICATION_FLOW, + EXPECT_EQ(CreditCardFidoAuthenticator::Flow::AUTHENTICATION_FLOW, GetFIDOAuthenticator()->current_flow()); - TestCreditCardFIDOAuthenticator::GetAssertion(GetFIDOAuthenticator(), + TestCreditCardFidoAuthenticator::GetAssertion(GetFIDOAuthenticator(), /*did_succeed=*/true); EXPECT_TRUE(GetRealPanForFIDOAuth( AutofillClient::PaymentsRpcResult::kPermanentFailure, kTestNumber)); EXPECT_NE(accessor_->result(), CreditCardFetchResult::kSuccess); // Followed by a fallback to CVC. - EXPECT_EQ(CreditCardFIDOAuthenticator::Flow::NONE_FLOW, + EXPECT_EQ(CreditCardFidoAuthenticator::Flow::NONE_FLOW, GetFIDOAuthenticator()->current_flow()); EXPECT_TRUE(GetRealPanForCVCAuth(AutofillClient::PaymentsRpcResult::kSuccess, kTestNumber)); @@ -1138,7 +1138,7 @@ TEST_F(CreditCardAccessManagerTest, { // Preflight call returned before card was chosen. base::HistogramTester histogram_tester; - // This is important because CreditCardFIDOAuthenticator will update the + // This is important because CreditCardFidoAuthenticator will update the // opted-in pref according to GetDetailsForGetRealPan response. payments_client_->AllowFidoRegistration(!user_is_opted_in); @@ -1271,9 +1271,9 @@ TEST_F(CreditCardAccessManagerTest, FIDONewCardAuthorization) { EXPECT_EQ(accessor_->cvc(), std::u16string()); // Mock user response. - EXPECT_EQ(CreditCardFIDOAuthenticator::Flow::FOLLOWUP_AFTER_CVC_AUTH_FLOW, + EXPECT_EQ(CreditCardFidoAuthenticator::Flow::FOLLOWUP_AFTER_CVC_AUTH_FLOW, GetFIDOAuthenticator()->current_flow()); - TestCreditCardFIDOAuthenticator::GetAssertion(GetFIDOAuthenticator(), + TestCreditCardFidoAuthenticator::GetAssertion(GetFIDOAuthenticator(), /*did_succeed=*/true); // Ensure that form is filled after user verification (OnCreditCardFetched is // called). @@ -1371,16 +1371,16 @@ TEST_F(CreditCardAccessManagerTest, FIDOOptInSuccess_Android) { /*follow_with_fido_auth=*/true)); WaitForCallbacks(); - // Check current flow to ensure CreditCardFIDOAuthenticator::Authorize is + // Check current flow to ensure CreditCardFidoAuthenticator::Authorize is // called and correct flow is set. - EXPECT_EQ(CreditCardFIDOAuthenticator::Flow::OPT_IN_WITH_CHALLENGE_FLOW, + EXPECT_EQ(CreditCardFidoAuthenticator::Flow::OPT_IN_WITH_CHALLENGE_FLOW, GetFIDOAuthenticator()->current_flow()); // Ensure that form is not filled yet (OnCreditCardFetched is not called). EXPECT_EQ(accessor_->number(), std::u16string()); EXPECT_EQ(accessor_->cvc(), std::u16string()); // Mock user response. - TestCreditCardFIDOAuthenticator::GetAssertion(GetFIDOAuthenticator(), + TestCreditCardFidoAuthenticator::GetAssertion(GetFIDOAuthenticator(), /*did_succeed=*/true); // Ensure that form is filled after user verification (OnCreditCardFetched is // called). @@ -1421,16 +1421,16 @@ TEST_F(CreditCardAccessManagerTest, FIDOOptInUserVerificationFailure) { kTestNumber, /*fido_opt_in=*/false, /*follow_with_fido_auth=*/true)); - // Check current flow to ensure CreditCardFIDOAuthenticator::Authorize is + // Check current flow to ensure CreditCardFidoAuthenticator::Authorize is // called and correct flow is set. - EXPECT_EQ(CreditCardFIDOAuthenticator::Flow::OPT_IN_WITH_CHALLENGE_FLOW, + EXPECT_EQ(CreditCardFidoAuthenticator::Flow::OPT_IN_WITH_CHALLENGE_FLOW, GetFIDOAuthenticator()->current_flow()); // Ensure that form is not filled yet (OnCreditCardFetched is not called). EXPECT_EQ(accessor_->number(), std::u16string()); EXPECT_EQ(accessor_->cvc(), std::u16string()); // Mock GetAssertion failure. - TestCreditCardFIDOAuthenticator::GetAssertion(GetFIDOAuthenticator(), + TestCreditCardFidoAuthenticator::GetAssertion(GetFIDOAuthenticator(), /*did_succeed=*/false); // Ensure that form is still filled even if user verification fails // (OnCreditCardFetched is called). Note that this is different behavior than @@ -1462,16 +1462,16 @@ TEST_F(CreditCardAccessManagerTest, FIDOOptInServerFailure) { kTestNumber, /*fido_opt_in=*/false, /*follow_with_fido_auth=*/true)); - // Check current flow to ensure CreditCardFIDOAuthenticator::Authorize is + // Check current flow to ensure CreditCardFidoAuthenticator::Authorize is // called and correct flow is set. - EXPECT_EQ(CreditCardFIDOAuthenticator::Flow::OPT_IN_WITH_CHALLENGE_FLOW, + EXPECT_EQ(CreditCardFidoAuthenticator::Flow::OPT_IN_WITH_CHALLENGE_FLOW, GetFIDOAuthenticator()->current_flow()); // Ensure that form is not filled yet (OnCreditCardFetched is not called). EXPECT_EQ(accessor_->number(), std::u16string()); EXPECT_EQ(accessor_->cvc(), std::u16string()); // Mock user response and OptChange payments call. - TestCreditCardFIDOAuthenticator::GetAssertion(GetFIDOAuthenticator(), + TestCreditCardFidoAuthenticator::GetAssertion(GetFIDOAuthenticator(), /*did_succeed=*/true); // Ensure that form is filled after user verification (OnCreditCardFetched is // called). @@ -1503,9 +1503,9 @@ TEST_F(CreditCardAccessManagerTest, FIDOOptIn_CheckboxDeclined) { // Ensure that form is filled (OnCreditCardFetched is called). EXPECT_EQ(kTestNumber16, accessor_->number()); EXPECT_EQ(kTestCvc16, accessor_->cvc()); - // Check current flow to ensure CreditCardFIDOAuthenticator::Authorize is + // Check current flow to ensure CreditCardFidoAuthenticator::Authorize is // never called. - EXPECT_EQ(CreditCardFIDOAuthenticator::Flow::NONE_FLOW, + EXPECT_EQ(CreditCardFidoAuthenticator::Flow::NONE_FLOW, GetFIDOAuthenticator()->current_flow()); EXPECT_FALSE(GetFIDOAuthenticator()->IsUserOptedIn()); } @@ -1576,9 +1576,9 @@ TEST_F(CreditCardAccessManagerTest, /*include_creation_options=*/true); // Mock user response and OptChange payments call. - EXPECT_EQ(CreditCardFIDOAuthenticator::Flow::OPT_IN_WITH_CHALLENGE_FLOW, + EXPECT_EQ(CreditCardFidoAuthenticator::Flow::OPT_IN_WITH_CHALLENGE_FLOW, GetFIDOAuthenticator()->current_flow()); - TestCreditCardFIDOAuthenticator::MakeCredential(GetFIDOAuthenticator(), + TestCreditCardFidoAuthenticator::MakeCredential(GetFIDOAuthenticator(), /*did_succeed=*/true); OptChange(AutofillClient::PaymentsRpcResult::kSuccess, /*user_is_opted_in=*/true); @@ -1712,7 +1712,7 @@ TEST_F(CreditCardAccessManagerTest, /*include_creation_options=*/true); // Mock user response. - TestCreditCardFIDOAuthenticator::MakeCredential(GetFIDOAuthenticator(), + TestCreditCardFidoAuthenticator::MakeCredential(GetFIDOAuthenticator(), /*did_succeed=*/false); EXPECT_EQ(FidoAuthenticationStrikeDatabase:: kStrikesToAddWhenUserVerificationFailsOnOptInAttempt, @@ -1759,9 +1759,9 @@ TEST_F(CreditCardAccessManagerTest, /*include_request_options=*/true); // Mock user response and OptChange payments call. - EXPECT_EQ(CreditCardFIDOAuthenticator::Flow::OPT_IN_WITH_CHALLENGE_FLOW, + EXPECT_EQ(CreditCardFidoAuthenticator::Flow::OPT_IN_WITH_CHALLENGE_FLOW, GetFIDOAuthenticator()->current_flow()); - TestCreditCardFIDOAuthenticator::GetAssertion(GetFIDOAuthenticator(), + TestCreditCardFidoAuthenticator::GetAssertion(GetFIDOAuthenticator(), /*did_succeed=*/true); OptChange(AutofillClient::PaymentsRpcResult::kSuccess, /*user_is_opted_in=*/true); @@ -1807,7 +1807,7 @@ TEST_F(CreditCardAccessManagerTest, SettingsPage_FIDOEnrollment) { /*user_is_opted_in=*/false, /*include_creation_options=*/true); // Mock user response and payments response. - TestCreditCardFIDOAuthenticator::MakeCredential(GetFIDOAuthenticator(), + TestCreditCardFidoAuthenticator::MakeCredential(GetFIDOAuthenticator(), did_succeed); histogram_tester.ExpectBucketCount( @@ -2363,7 +2363,7 @@ TEST_F(CreditCardAccessManagerTest, EXPECT_EQ(fido_authenticator_->context_token().value(), "fake_context_token"); // Mock FIDO authentication completed. - CreditCardFIDOAuthenticator::FidoAuthenticationResponse fido_response; + CreditCardFidoAuthenticator::FidoAuthenticationResponse fido_response; fido_response.did_succeed = true; CreditCard card = test::GetCreditCard(); fido_response.card = &card; @@ -2428,7 +2428,7 @@ TEST_F( EXPECT_EQ(fido_authenticator_->context_token().value(), "fake_context_token"); // Mock FIDO authentication completed. - CreditCardFIDOAuthenticator::FidoAuthenticationResponse fido_response; + CreditCardFidoAuthenticator::FidoAuthenticationResponse fido_response; fido_response.did_succeed = true; CreditCard card = test::GetCreditCard(); fido_response.card = &card; diff --git a/components/autofill/core/browser/payments/credit_card_fido_authenticator.cc b/components/autofill/core/browser/payments/credit_card_fido_authenticator.cc index cd1a2d55d0bd0..c452803886c6f 100644 --- a/components/autofill/core/browser/payments/credit_card_fido_authenticator.cc +++ b/components/autofill/core/browser/payments/credit_card_fido_authenticator.cc @@ -61,7 +61,7 @@ base::Value BytesToBase64(const std::vector bytes) { } } // namespace -CreditCardFIDOAuthenticator::CreditCardFIDOAuthenticator(AutofillDriver* driver, +CreditCardFidoAuthenticator::CreditCardFidoAuthenticator(AutofillDriver* driver, AutofillClient* client) : autofill_driver_(driver), autofill_client_(client), @@ -72,11 +72,11 @@ CreditCardFIDOAuthenticator::CreditCardFIDOAuthenticator(AutofillDriver* driver, user_is_opted_in_ = IsUserOptedIn(); } -CreditCardFIDOAuthenticator::~CreditCardFIDOAuthenticator() { +CreditCardFidoAuthenticator::~CreditCardFidoAuthenticator() { UpdateUserPref(); } -void CreditCardFIDOAuthenticator::Authenticate( +void CreditCardFidoAuthenticator::Authenticate( const CreditCard* card, base::WeakPtr requester, base::Value::Dict request_options, @@ -97,7 +97,7 @@ void CreditCardFIDOAuthenticator::Authenticate( } } -void CreditCardFIDOAuthenticator::Register(std::string card_authorization_token, +void CreditCardFidoAuthenticator::Register(std::string card_authorization_token, base::Value::Dict creation_options) { // Cancel any previous pending WebAuthn requests. authenticator()->Cancel(); @@ -116,7 +116,7 @@ void CreditCardFIDOAuthenticator::Register(std::string card_authorization_token, } } -void CreditCardFIDOAuthenticator::Authorize( +void CreditCardFidoAuthenticator::Authorize( base::WeakPtr requester, std::string card_authorization_token, base::Value::Dict request_options) { @@ -136,7 +136,7 @@ void CreditCardFIDOAuthenticator::Authorize( } } -void CreditCardFIDOAuthenticator::OptOut() { +void CreditCardFidoAuthenticator::OptOut() { // Cancel any previous pending WebAuthn requests. authenticator()->Cancel(); @@ -145,7 +145,7 @@ void CreditCardFIDOAuthenticator::OptOut() { OptChange(); } -void CreditCardFIDOAuthenticator::IsUserVerifiable( +void CreditCardFidoAuthenticator::IsUserVerifiable( base::OnceCallback callback) { if (!IsCreditCardFidoAuthenticationEnabled() || !authenticator()) { std::move(callback).Run(false); @@ -164,12 +164,12 @@ void CreditCardFIDOAuthenticator::IsUserVerifiable( std::move(callback)); } -bool CreditCardFIDOAuthenticator::IsUserOptedIn() { +bool CreditCardFidoAuthenticator::IsUserOptedIn() { return IsCreditCardFidoAuthenticationEnabled() && prefs::IsCreditCardFIDOAuthEnabled(autofill_client_->GetPrefs()); } -UserOptInIntention CreditCardFIDOAuthenticator::GetUserOptInIntention( +UserOptInIntention CreditCardFidoAuthenticator::GetUserOptInIntention( payments::PaymentsClient::UnmaskDetails& unmask_details) { // This local pref can be affected by the user toggling on the settings page. // And payments might not update in time. We derive user opt in/out intention @@ -208,7 +208,7 @@ UserOptInIntention CreditCardFIDOAuthenticator::GetUserOptInIntention( return UserOptInIntention::kUnspecified; } -void CreditCardFIDOAuthenticator::CancelVerification() { +void CreditCardFidoAuthenticator::CancelVerification() { authenticator()->Cancel(); current_flow_ = NONE_FLOW; @@ -220,7 +220,7 @@ void CreditCardFIDOAuthenticator::CancelVerification() { } #if !BUILDFLAG(IS_ANDROID) -void CreditCardFIDOAuthenticator::OnWebauthnOfferDialogRequested( +void CreditCardFidoAuthenticator::OnWebauthnOfferDialogRequested( std::string card_authorization_token) { card_authorization_token_ = card_authorization_token; @@ -239,7 +239,7 @@ void CreditCardFIDOAuthenticator::OnWebauthnOfferDialogRequested( user_is_opted_in_ = false; } -void CreditCardFIDOAuthenticator::OnWebauthnOfferDialogUserResponse( +void CreditCardFidoAuthenticator::OnWebauthnOfferDialogUserResponse( bool did_accept) { if (did_accept) { // Wait until GetAssertion()/MakeCredential() to log user acceptance, since @@ -268,7 +268,7 @@ void CreditCardFIDOAuthenticator::OnWebauthnOfferDialogUserResponse( #endif FidoAuthenticationStrikeDatabase* -CreditCardFIDOAuthenticator::GetOrCreateFidoAuthenticationStrikeDatabase() { +CreditCardFidoAuthenticator::GetOrCreateFidoAuthenticationStrikeDatabase() { if (!fido_authentication_strike_database_) { fido_authentication_strike_database_ = std::make_unique( @@ -278,7 +278,7 @@ CreditCardFIDOAuthenticator::GetOrCreateFidoAuthenticationStrikeDatabase() { return fido_authentication_strike_database_.get(); } -void CreditCardFIDOAuthenticator::GetAssertion( +void CreditCardFidoAuthenticator::GetAssertion( blink::mojom::PublicKeyCredentialRequestOptionsPtr request_options) { #if !BUILDFLAG(IS_ANDROID) // On desktop, during an opt-in flow, close the WebAuthn offer dialog and get @@ -300,11 +300,11 @@ void CreditCardFIDOAuthenticator::GetAssertion( #endif authenticator()->GetAssertion( std::move(request_options), - base::BindOnce(&CreditCardFIDOAuthenticator::OnDidGetAssertion, + base::BindOnce(&CreditCardFidoAuthenticator::OnDidGetAssertion, weak_ptr_factory_.GetWeakPtr())); } -void CreditCardFIDOAuthenticator::MakeCredential( +void CreditCardFidoAuthenticator::MakeCredential( blink::mojom::PublicKeyCredentialCreationOptionsPtr creation_options) { #if !BUILDFLAG(IS_ANDROID) // On desktop, close the WebAuthn offer dialog and get ready to show the OS @@ -324,11 +324,11 @@ void CreditCardFIDOAuthenticator::MakeCredential( #endif authenticator()->MakeCredential( std::move(creation_options), - base::BindOnce(&CreditCardFIDOAuthenticator::OnDidMakeCredential, + base::BindOnce(&CreditCardFidoAuthenticator::OnDidMakeCredential, weak_ptr_factory_.GetWeakPtr())); } -void CreditCardFIDOAuthenticator::OptChange( +void CreditCardFidoAuthenticator::OptChange( base::Value::Dict authenticator_response) { payments::PaymentsClient::OptChangeRequestDetails request_details; request_details.app_locale = @@ -381,7 +381,7 @@ void CreditCardFIDOAuthenticator::OptChange( } payments_client_->OptChange( request_details, - base::BindOnce(&CreditCardFIDOAuthenticator::OnDidGetOptChangeResult, + base::BindOnce(&CreditCardFidoAuthenticator::OnDidGetOptChangeResult, weak_ptr_factory_.GetWeakPtr())); // Logging call if user was attempting to change their opt-in state. @@ -392,7 +392,7 @@ void CreditCardFIDOAuthenticator::OptChange( } } -void CreditCardFIDOAuthenticator::OnDidGetAssertion( +void CreditCardFidoAuthenticator::OnDidGetAssertion( blink::mojom::AuthenticatorStatus status, blink::mojom::GetAssertionAuthenticatorResponsePtr assertion_response, blink::mojom::WebAuthnDOMExceptionDetailsPtr dom_exception_details) { @@ -405,7 +405,7 @@ void CreditCardFIDOAuthenticator::OnDidGetAssertion( } } -void CreditCardFIDOAuthenticator::OnDidMakeCredential( +void CreditCardFidoAuthenticator::OnDidMakeCredential( blink::mojom::AuthenticatorStatus status, blink::mojom::MakeCredentialAuthenticatorResponsePtr attestation_response, blink::mojom::WebAuthnDOMExceptionDetailsPtr dom_exception_details) { @@ -430,7 +430,7 @@ void CreditCardFIDOAuthenticator::OnDidMakeCredential( OptChange(ParseAttestationResponse(std::move(attestation_response))); } -void CreditCardFIDOAuthenticator::OnDidGetOptChangeResult( +void CreditCardFidoAuthenticator::OnDidGetOptChangeResult( AutofillClient::PaymentsRpcResult result, payments::PaymentsClient::OptChangeResponseDetails& response) { DCHECK(current_flow_ == OPT_IN_FETCH_CHALLENGE_FLOW || @@ -474,7 +474,7 @@ void CreditCardFIDOAuthenticator::OnDidGetOptChangeResult( } } -void CreditCardFIDOAuthenticator::OnFullCardRequestSucceeded( +void CreditCardFidoAuthenticator::OnFullCardRequestSucceeded( const payments::FullCardRequest& full_card_request, const CreditCard& card, const std::u16string& cvc) { @@ -489,7 +489,7 @@ void CreditCardFIDOAuthenticator::OnFullCardRequestSucceeded( requester_->OnFIDOAuthenticationComplete(response); } -void CreditCardFIDOAuthenticator::OnFullCardRequestFailed( +void CreditCardFidoAuthenticator::OnFullCardRequestFailed( CreditCard::RecordType card_type, payments::FullCardRequest::FailureType failure_type) { DCHECK_EQ(AUTHENTICATION_FLOW, current_flow_); @@ -504,7 +504,7 @@ void CreditCardFIDOAuthenticator::OnFullCardRequestFailed( } blink::mojom::PublicKeyCredentialRequestOptionsPtr -CreditCardFIDOAuthenticator::ParseRequestOptions( +CreditCardFidoAuthenticator::ParseRequestOptions( const base::Value::Dict& request_options) { auto options = blink::mojom::PublicKeyCredentialRequestOptions::New(); @@ -530,7 +530,7 @@ CreditCardFIDOAuthenticator::ParseRequestOptions( } blink::mojom::PublicKeyCredentialCreationOptionsPtr -CreditCardFIDOAuthenticator::ParseCreationOptions( +CreditCardFidoAuthenticator::ParseCreationOptions( const base::Value::Dict& creation_options) { auto options = blink::mojom::PublicKeyCredentialCreationOptions::New(); @@ -608,7 +608,7 @@ CreditCardFIDOAuthenticator::ParseCreationOptions( } device::PublicKeyCredentialDescriptor -CreditCardFIDOAuthenticator::ParseCredentialDescriptor( +CreditCardFidoAuthenticator::ParseCredentialDescriptor( const base::Value& key_info) { std::vector credential_id; const auto* id = key_info.FindStringKey("credential_id"); @@ -633,7 +633,7 @@ CreditCardFIDOAuthenticator::ParseCredentialDescriptor( authenticator_transports); } -base::Value::Dict CreditCardFIDOAuthenticator::ParseAssertionResponse( +base::Value::Dict CreditCardFidoAuthenticator::ParseAssertionResponse( blink::mojom::GetAssertionAuthenticatorResponsePtr assertion_response) { base::Value::Dict response; response.Set("credential_id", @@ -646,7 +646,7 @@ base::Value::Dict CreditCardFIDOAuthenticator::ParseAssertionResponse( return response; } -base::Value::Dict CreditCardFIDOAuthenticator::ParseAttestationResponse( +base::Value::Dict CreditCardFidoAuthenticator::ParseAttestationResponse( blink::mojom::MakeCredentialAuthenticatorResponsePtr attestation_response) { base::Value::Dict response; @@ -673,7 +673,7 @@ base::Value::Dict CreditCardFIDOAuthenticator::ParseAttestationResponse( return response; } -bool CreditCardFIDOAuthenticator::IsValidRequestOptions( +bool CreditCardFidoAuthenticator::IsValidRequestOptions( const base::Value::Dict& request_options) { if (request_options.empty() || !request_options.contains("challenge") || !request_options.contains("key_info")) { @@ -694,12 +694,12 @@ bool CreditCardFIDOAuthenticator::IsValidRequestOptions( return true; } -bool CreditCardFIDOAuthenticator::IsValidCreationOptions( +bool CreditCardFidoAuthenticator::IsValidCreationOptions( const base::Value::Dict& creation_options) { return creation_options.contains("challenge"); } -void CreditCardFIDOAuthenticator::LogWebauthnResult( +void CreditCardFidoAuthenticator::LogWebauthnResult( blink::mojom::AuthenticatorStatus status) { autofill_metrics::WebauthnFlowEvent event; switch (current_flow_) { @@ -735,12 +735,12 @@ void CreditCardFIDOAuthenticator::LogWebauthnResult( autofill_metrics::LogWebauthnResult(event, metric); } -void CreditCardFIDOAuthenticator::UpdateUserPref() { +void CreditCardFidoAuthenticator::UpdateUserPref() { prefs::SetCreditCardFIDOAuthEnabled(autofill_client_->GetPrefs(), user_is_opted_in_); } -void CreditCardFIDOAuthenticator::HandleGetAssertionSuccess( +void CreditCardFidoAuthenticator::HandleGetAssertionSuccess( blink::mojom::GetAssertionAuthenticatorResponsePtr assertion_response) { switch (current_flow_) { case AUTHENTICATION_FLOW: { @@ -764,7 +764,7 @@ void CreditCardFIDOAuthenticator::HandleGetAssertionSuccess( // card from FIDO. autofill_client_->ShowAutofillProgressDialog( AutofillProgressDialogType::kAndroidFIDOProgressDialog, - base::BindOnce(&CreditCardFIDOAuthenticator::CancelVerification, + base::BindOnce(&CreditCardFidoAuthenticator::CancelVerification, weak_ptr_factory_.GetWeakPtr())); } #endif @@ -808,7 +808,7 @@ void CreditCardFIDOAuthenticator::HandleGetAssertionSuccess( OptChange(std::move(response)); } -void CreditCardFIDOAuthenticator::HandleGetAssertionFailure() { +void CreditCardFidoAuthenticator::HandleGetAssertionFailure() { switch (current_flow_) { case AUTHENTICATION_FLOW: { // End the flow if there was an authentication error. @@ -852,7 +852,7 @@ void CreditCardFIDOAuthenticator::HandleGetAssertionFailure() { current_flow_ = NONE_FLOW; } -webauthn::InternalAuthenticator* CreditCardFIDOAuthenticator::authenticator() { +webauthn::InternalAuthenticator* CreditCardFidoAuthenticator::authenticator() { if (!authenticator_) { authenticator_ = autofill_client_->CreateCreditCardInternalAuthenticator( autofill_driver_.get()); diff --git a/components/autofill/core/browser/payments/credit_card_fido_authenticator.h b/components/autofill/core/browser/payments/credit_card_fido_authenticator.h index 1a852f4df8d44..161509dc261c9 100644 --- a/components/autofill/core/browser/payments/credit_card_fido_authenticator.h +++ b/components/autofill/core/browser/payments/credit_card_fido_authenticator.h @@ -42,7 +42,7 @@ enum class UserOptInIntention { // and verify that binding. More information can be found here: // - https://www.w3.org/TR/webauthn-1/ // - https://fidoalliance.org/fido2/ -class CreditCardFIDOAuthenticator +class CreditCardFidoAuthenticator : public payments::FullCardRequest::ResultDelegate { public: // Useful for splitting metrics to correct sub-histograms and knowing which @@ -82,13 +82,13 @@ class CreditCardFIDOAuthenticator const FidoAuthenticationResponse& response) = 0; virtual void OnFidoAuthorizationComplete(bool did_succeed) = 0; }; - CreditCardFIDOAuthenticator(AutofillDriver* driver, AutofillClient* client); + CreditCardFidoAuthenticator(AutofillDriver* driver, AutofillClient* client); - CreditCardFIDOAuthenticator(const CreditCardFIDOAuthenticator&) = delete; - CreditCardFIDOAuthenticator& operator=(const CreditCardFIDOAuthenticator&) = + CreditCardFidoAuthenticator(const CreditCardFidoAuthenticator&) = delete; + CreditCardFidoAuthenticator& operator=(const CreditCardFidoAuthenticator&) = delete; - ~CreditCardFIDOAuthenticator() override; + ~CreditCardFidoAuthenticator() override; // Invokes Authentication flow. Responds to |accessor_| with full pan. // |context_token| is used to share context between different requests. It @@ -151,15 +151,15 @@ class CreditCardFIDOAuthenticator private: friend class BrowserAutofillManagerTest; friend class CreditCardAccessManagerTest; - friend class CreditCardFIDOAuthenticatorTest; - friend class TestCreditCardFIDOAuthenticator; - FRIEND_TEST_ALL_PREFIXES(CreditCardFIDOAuthenticatorTest, + friend class CreditCardFidoAuthenticatorTest; + friend class TestCreditCardFidoAuthenticator; + FRIEND_TEST_ALL_PREFIXES(CreditCardFidoAuthenticatorTest, ParseRequestOptions); - FRIEND_TEST_ALL_PREFIXES(CreditCardFIDOAuthenticatorTest, + FRIEND_TEST_ALL_PREFIXES(CreditCardFidoAuthenticatorTest, ParseAssertionResponse); - FRIEND_TEST_ALL_PREFIXES(CreditCardFIDOAuthenticatorTest, + FRIEND_TEST_ALL_PREFIXES(CreditCardFidoAuthenticatorTest, ParseCreationOptions); - FRIEND_TEST_ALL_PREFIXES(CreditCardFIDOAuthenticatorTest, + FRIEND_TEST_ALL_PREFIXES(CreditCardFidoAuthenticatorTest, ParseAttestationResponse); // Invokes the WebAuthn prompt to request user verification to sign the @@ -294,7 +294,7 @@ class CreditCardFIDOAuthenticator // requests. Will be populated only for virtual card unmasking. absl::optional context_token_; - base::WeakPtrFactory weak_ptr_factory_{this}; + base::WeakPtrFactory weak_ptr_factory_{this}; }; } // namespace autofill diff --git a/components/autofill/core/browser/payments/credit_card_fido_authenticator_unittest.cc b/components/autofill/core/browser/payments/credit_card_fido_authenticator_unittest.cc index ed4bd9f287bca..0f3d1f581d3b8 100644 --- a/components/autofill/core/browser/payments/credit_card_fido_authenticator_unittest.cc +++ b/components/autofill/core/browser/payments/credit_card_fido_authenticator_unittest.cc @@ -101,9 +101,9 @@ std::string BytesToBase64(const std::vector bytes) { } } // namespace -class CreditCardFIDOAuthenticatorTest : public testing::Test { +class CreditCardFidoAuthenticatorTest : public testing::Test { public: - CreditCardFIDOAuthenticatorTest() {} + CreditCardFidoAuthenticatorTest() {} void SetUp() override { autofill_client_.SetPrefs(test::PrefServiceForTesting()); @@ -131,7 +131,7 @@ class CreditCardFIDOAuthenticatorTest : public testing::Test { std::unique_ptr(payments_client)); autofill_client_.set_test_strike_database( std::make_unique()); - fido_authenticator_ = std::make_unique( + fido_authenticator_ = std::make_unique( autofill_driver_.get(), &autofill_client_); } @@ -246,23 +246,23 @@ class CreditCardFIDOAuthenticatorTest : public testing::Test { scoped_refptr database_; TestPersonalDataManager personal_data_manager_; base::test::ScopedFeatureList scoped_feature_list_; - std::unique_ptr fido_authenticator_; + std::unique_ptr fido_authenticator_; }; -TEST_F(CreditCardFIDOAuthenticatorTest, IsUserOptedIn_FlagDisabled) { +TEST_F(CreditCardFidoAuthenticatorTest, IsUserOptedIn_FlagDisabled) { scoped_feature_list_.InitAndDisableFeature( features::kAutofillCreditCardAuthentication); EXPECT_FALSE(fido_authenticator_->IsUserOptedIn()); } -TEST_F(CreditCardFIDOAuthenticatorTest, IsUserOptedIn_False) { +TEST_F(CreditCardFidoAuthenticatorTest, IsUserOptedIn_False) { scoped_feature_list_.InitAndEnableFeature( features::kAutofillCreditCardAuthentication); SetUserOptInPreference(false); EXPECT_FALSE(fido_authenticator_->IsUserOptedIn()); } -TEST_F(CreditCardFIDOAuthenticatorTest, IsUserOptedIn_True) { +TEST_F(CreditCardFidoAuthenticatorTest, IsUserOptedIn_True) { scoped_feature_list_.InitAndEnableFeature( features::kAutofillCreditCardAuthentication); SetUserOptInPreference(true); @@ -270,7 +270,7 @@ TEST_F(CreditCardFIDOAuthenticatorTest, IsUserOptedIn_True) { } #if BUILDFLAG(IS_ANDROID) -TEST_F(CreditCardFIDOAuthenticatorTest, +TEST_F(CreditCardFidoAuthenticatorTest, GetUserOptInIntention_IntentToOptIn_Android) { scoped_feature_list_.InitAndEnableFeature( features::kAutofillCreditCardAuthentication); @@ -290,7 +290,7 @@ TEST_F(CreditCardFIDOAuthenticatorTest, // since it will not have updated yet. } #else -TEST_F(CreditCardFIDOAuthenticatorTest, +TEST_F(CreditCardFidoAuthenticatorTest, GetUserOptInIntention_IntentToOptIn_Desktop) { scoped_feature_list_.InitAndEnableFeature( features::kAutofillCreditCardAuthentication); @@ -313,7 +313,7 @@ TEST_F(CreditCardFIDOAuthenticatorTest, } #endif -TEST_F(CreditCardFIDOAuthenticatorTest, GetUserOptInIntention_IntentToOptOut) { +TEST_F(CreditCardFidoAuthenticatorTest, GetUserOptInIntention_IntentToOptOut) { scoped_feature_list_.InitAndEnableFeature( features::kAutofillCreditCardAuthentication); // If payments is requesting a FIDO auth, then that means user is opted in @@ -332,14 +332,14 @@ TEST_F(CreditCardFIDOAuthenticatorTest, GetUserOptInIntention_IntentToOptOut) { // will not have updated yet. } -TEST_F(CreditCardFIDOAuthenticatorTest, IsUserVerifiable_False) { +TEST_F(CreditCardFidoAuthenticatorTest, IsUserVerifiable_False) { fido_authenticator_->IsUserVerifiable( base::BindOnce(&TestAuthenticationRequester::IsUserVerifiableCallback, requester_->GetWeakPtr())); EXPECT_FALSE(requester_->is_user_verifiable().value()); } -TEST_F(CreditCardFIDOAuthenticatorTest, ParseRequestOptions) { +TEST_F(CreditCardFidoAuthenticatorTest, ParseRequestOptions) { base::Value::Dict request_options_json = GetTestRequestOptions( kTestChallenge, kTestRelyingPartyId, kTestCredentialId); @@ -351,7 +351,7 @@ TEST_F(CreditCardFIDOAuthenticatorTest, ParseRequestOptions) { BytesToBase64(request_options_ptr->allow_credentials.front().id)); } -TEST_F(CreditCardFIDOAuthenticatorTest, ParseAssertionResponse) { +TEST_F(CreditCardFidoAuthenticatorTest, ParseAssertionResponse) { blink::mojom::GetAssertionAuthenticatorResponsePtr assertion_response_ptr = blink::mojom::GetAssertionAuthenticatorResponse::New(); assertion_response_ptr->info = blink::mojom::CommonCredentialInfo::New(); @@ -366,7 +366,7 @@ TEST_F(CreditCardFIDOAuthenticatorTest, ParseAssertionResponse) { EXPECT_EQ(kTestSignature, *assertion_response_json.FindString("signature")); } -TEST_F(CreditCardFIDOAuthenticatorTest, ParseCreationOptions) { +TEST_F(CreditCardFidoAuthenticatorTest, ParseCreationOptions) { base::Value::Dict creation_options_json = GetTestCreationOptions(kTestChallenge, kTestRelyingPartyId); @@ -385,7 +385,7 @@ TEST_F(CreditCardFIDOAuthenticatorTest, ParseCreationOptions) { ->user_verification_requirement); } -TEST_F(CreditCardFIDOAuthenticatorTest, ParseAttestationResponse) { +TEST_F(CreditCardFidoAuthenticatorTest, ParseAttestationResponse) { blink::mojom::MakeCredentialAuthenticatorResponsePtr attestation_response_ptr = blink::mojom::MakeCredentialAuthenticatorResponse::New(); @@ -399,7 +399,7 @@ TEST_F(CreditCardFIDOAuthenticatorTest, ParseAttestationResponse) { "fido_attestation_info.attestation_object")); } -TEST_F(CreditCardFIDOAuthenticatorTest, AuthenticateCard_BadRequestOptions) { +TEST_F(CreditCardFidoAuthenticatorTest, AuthenticateCard_BadRequestOptions) { CreditCard card = CreateServerCard(kTestGUID, kTestNumber); fido_authenticator_->Authenticate(&card, requester_->GetWeakPtr(), @@ -407,7 +407,7 @@ TEST_F(CreditCardFIDOAuthenticatorTest, AuthenticateCard_BadRequestOptions) { EXPECT_FALSE((*requester_->did_succeed())); } -TEST_F(CreditCardFIDOAuthenticatorTest, +TEST_F(CreditCardFidoAuthenticatorTest, AuthenticateCard_UserVerificationFailed) { CreditCard card = CreateServerCard(kTestGUID, kTestNumber); @@ -416,12 +416,12 @@ TEST_F(CreditCardFIDOAuthenticatorTest, GetTestRequestOptions(kTestChallenge, kTestRelyingPartyId, kTestCredentialId)); - TestCreditCardFIDOAuthenticator::GetAssertion(fido_authenticator_.get(), + TestCreditCardFidoAuthenticator::GetAssertion(fido_authenticator_.get(), /*did_succeed=*/false); EXPECT_FALSE((*requester_->did_succeed())); } -TEST_F(CreditCardFIDOAuthenticatorTest, +TEST_F(CreditCardFidoAuthenticatorTest, AuthenticateCard_PaymentsResponseError) { CreditCard card = CreateServerCard(kTestGUID, kTestNumber); @@ -429,18 +429,18 @@ TEST_F(CreditCardFIDOAuthenticatorTest, &card, requester_->GetWeakPtr(), GetTestRequestOptions(kTestChallenge, kTestRelyingPartyId, kTestCredentialId)); - EXPECT_EQ(CreditCardFIDOAuthenticator::Flow::AUTHENTICATION_FLOW, + EXPECT_EQ(CreditCardFidoAuthenticator::Flow::AUTHENTICATION_FLOW, fido_authenticator_->current_flow()); // Mock user verification. - TestCreditCardFIDOAuthenticator::GetAssertion(fido_authenticator_.get(), + TestCreditCardFidoAuthenticator::GetAssertion(fido_authenticator_.get(), /*did_succeed=*/true); GetRealPan(AutofillClient::PaymentsRpcResult::kNetworkError, ""); EXPECT_FALSE((*requester_->did_succeed())); } -TEST_F(CreditCardFIDOAuthenticatorTest, +TEST_F(CreditCardFidoAuthenticatorTest, AuthenticateCard_PaymentsResponseVcnRetrievalError) { CreditCard card = CreateServerCard(kTestGUID, kTestNumber); @@ -448,11 +448,11 @@ TEST_F(CreditCardFIDOAuthenticatorTest, &card, requester_->GetWeakPtr(), GetTestRequestOptions(kTestChallenge, kTestRelyingPartyId, kTestCredentialId)); - EXPECT_EQ(CreditCardFIDOAuthenticator::Flow::AUTHENTICATION_FLOW, + EXPECT_EQ(CreditCardFidoAuthenticator::Flow::AUTHENTICATION_FLOW, fido_authenticator_->current_flow()); // Mock user verification. - TestCreditCardFIDOAuthenticator::GetAssertion(fido_authenticator_.get(), + TestCreditCardFidoAuthenticator::GetAssertion(fido_authenticator_.get(), /*did_succeed=*/true); GetRealPan(AutofillClient::PaymentsRpcResult::kVcnRetrievalPermanentFailure, "", /*is_virtual_card=*/true); @@ -463,18 +463,18 @@ TEST_F(CreditCardFIDOAuthenticatorTest, payments::FullCardRequest::VIRTUAL_CARD_RETRIEVAL_PERMANENT_FAILURE); } -TEST_F(CreditCardFIDOAuthenticatorTest, AuthenticateCard_Success) { +TEST_F(CreditCardFidoAuthenticatorTest, AuthenticateCard_Success) { CreditCard card = CreateServerCard(kTestGUID, kTestNumber); fido_authenticator_->Authenticate( &card, requester_->GetWeakPtr(), GetTestRequestOptions(kTestChallenge, kTestRelyingPartyId, kTestCredentialId)); - EXPECT_EQ(CreditCardFIDOAuthenticator::Flow::AUTHENTICATION_FLOW, + EXPECT_EQ(CreditCardFidoAuthenticator::Flow::AUTHENTICATION_FLOW, fido_authenticator_->current_flow()); // Mock user verification and payments response. - TestCreditCardFIDOAuthenticator::GetAssertion(fido_authenticator_.get(), + TestCreditCardFidoAuthenticator::GetAssertion(fido_authenticator_.get(), /*did_succeed=*/true); GetRealPan(AutofillClient::PaymentsRpcResult::kSuccess, kTestNumber); @@ -482,7 +482,7 @@ TEST_F(CreditCardFIDOAuthenticatorTest, AuthenticateCard_Success) { EXPECT_EQ(kTestNumber16, requester_->number()); } -TEST_F(CreditCardFIDOAuthenticatorTest, OptIn_PaymentsResponseError) { +TEST_F(CreditCardFidoAuthenticatorTest, OptIn_PaymentsResponseError) { scoped_feature_list_.InitAndEnableFeature( features::kAutofillCreditCardAuthentication); base::HistogramTester histogram_tester; @@ -492,7 +492,7 @@ TEST_F(CreditCardFIDOAuthenticatorTest, OptIn_PaymentsResponseError) { EXPECT_FALSE(fido_authenticator_->IsUserOptedIn()); fido_authenticator_->Register(kTestAuthToken); - EXPECT_EQ(CreditCardFIDOAuthenticator::Flow::OPT_IN_FETCH_CHALLENGE_FLOW, + EXPECT_EQ(CreditCardFidoAuthenticator::Flow::OPT_IN_FETCH_CHALLENGE_FLOW, fido_authenticator_->current_flow()); // Mock payments response. @@ -504,7 +504,7 @@ TEST_F(CreditCardFIDOAuthenticatorTest, OptIn_PaymentsResponseError) { autofill_metrics::WebauthnOptInParameters::kFetchingChallenge, 1); } -TEST_F(CreditCardFIDOAuthenticatorTest, OptIn_Success) { +TEST_F(CreditCardFidoAuthenticatorTest, OptIn_Success) { scoped_feature_list_.InitAndEnableFeature( features::kAutofillCreditCardAuthentication); base::HistogramTester histogram_tester; @@ -514,7 +514,7 @@ TEST_F(CreditCardFIDOAuthenticatorTest, OptIn_Success) { EXPECT_FALSE(fido_authenticator_->IsUserOptedIn()); fido_authenticator_->Register(kTestAuthToken); - EXPECT_EQ(CreditCardFIDOAuthenticator::Flow::OPT_IN_FETCH_CHALLENGE_FLOW, + EXPECT_EQ(CreditCardFidoAuthenticator::Flow::OPT_IN_FETCH_CHALLENGE_FLOW, fido_authenticator_->current_flow()); // Mock payments response. @@ -526,7 +526,7 @@ TEST_F(CreditCardFIDOAuthenticatorTest, OptIn_Success) { autofill_metrics::WebauthnOptInParameters::kFetchingChallenge, 1); } -TEST_F(CreditCardFIDOAuthenticatorTest, Register_BadCreationOptions) { +TEST_F(CreditCardFidoAuthenticatorTest, Register_BadCreationOptions) { scoped_feature_list_.InitAndEnableFeature( features::kAutofillCreditCardAuthentication); EXPECT_FALSE(fido_authenticator_->IsUserOptedIn()); @@ -538,7 +538,7 @@ TEST_F(CreditCardFIDOAuthenticatorTest, Register_BadCreationOptions) { EXPECT_FALSE(fido_authenticator_->IsUserOptedIn()); } -TEST_F(CreditCardFIDOAuthenticatorTest, Register_UserResponseFailure) { +TEST_F(CreditCardFidoAuthenticatorTest, Register_UserResponseFailure) { scoped_feature_list_.InitAndEnableFeature( features::kAutofillCreditCardAuthentication); EXPECT_FALSE(fido_authenticator_->IsUserOptedIn()); @@ -546,16 +546,16 @@ TEST_F(CreditCardFIDOAuthenticatorTest, Register_UserResponseFailure) { fido_authenticator_->Register( kTestAuthToken, GetTestCreationOptions(kTestChallenge, kTestRelyingPartyId)); - EXPECT_EQ(CreditCardFIDOAuthenticator::Flow::OPT_IN_WITH_CHALLENGE_FLOW, + EXPECT_EQ(CreditCardFidoAuthenticator::Flow::OPT_IN_WITH_CHALLENGE_FLOW, fido_authenticator_->current_flow()); // Mock user response and payments response. - TestCreditCardFIDOAuthenticator::MakeCredential(fido_authenticator_.get(), + TestCreditCardFidoAuthenticator::MakeCredential(fido_authenticator_.get(), /*did_succeed=*/false); EXPECT_FALSE(fido_authenticator_->IsUserOptedIn()); } -TEST_F(CreditCardFIDOAuthenticatorTest, Register_Success) { +TEST_F(CreditCardFidoAuthenticatorTest, Register_Success) { scoped_feature_list_.InitAndEnableFeature( features::kAutofillCreditCardAuthentication); base::HistogramTester histogram_tester; @@ -567,11 +567,11 @@ TEST_F(CreditCardFIDOAuthenticatorTest, Register_Success) { fido_authenticator_->Register( kTestAuthToken, GetTestCreationOptions(kTestChallenge, kTestRelyingPartyId)); - EXPECT_EQ(CreditCardFIDOAuthenticator::Flow::OPT_IN_WITH_CHALLENGE_FLOW, + EXPECT_EQ(CreditCardFidoAuthenticator::Flow::OPT_IN_WITH_CHALLENGE_FLOW, fido_authenticator_->current_flow()); // Mock user response and payments response. - TestCreditCardFIDOAuthenticator::MakeCredential(fido_authenticator_.get(), + TestCreditCardFidoAuthenticator::MakeCredential(fido_authenticator_.get(), /*did_succeed=*/true); OptChange(AutofillClient::PaymentsRpcResult::kSuccess, /*user_is_opted_in=*/true); @@ -582,7 +582,7 @@ TEST_F(CreditCardFIDOAuthenticatorTest, Register_Success) { autofill_metrics::WebauthnOptInParameters::kWithCreationChallenge, 1); } -TEST_F(CreditCardFIDOAuthenticatorTest, +TEST_F(CreditCardFidoAuthenticatorTest, Register_EnrollAttemptReturnsCreationOptions) { scoped_feature_list_.InitAndEnableFeature( features::kAutofillCreditCardAuthentication); @@ -593,18 +593,18 @@ TEST_F(CreditCardFIDOAuthenticatorTest, EXPECT_FALSE(fido_authenticator_->IsUserOptedIn()); fido_authenticator_->Register(kTestAuthToken); - EXPECT_EQ(CreditCardFIDOAuthenticator::Flow::OPT_IN_FETCH_CHALLENGE_FLOW, + EXPECT_EQ(CreditCardFidoAuthenticator::Flow::OPT_IN_FETCH_CHALLENGE_FLOW, fido_authenticator_->current_flow()); // Mock payments response with challenge to invoke enrollment flow. OptChange(AutofillClient::PaymentsRpcResult::kSuccess, /*user_is_opted_in=*/false, /*include_creation_options=*/true); - EXPECT_EQ(CreditCardFIDOAuthenticator::Flow::OPT_IN_WITH_CHALLENGE_FLOW, + EXPECT_EQ(CreditCardFidoAuthenticator::Flow::OPT_IN_WITH_CHALLENGE_FLOW, fido_authenticator_->current_flow()); EXPECT_FALSE(fido_authenticator_->IsUserOptedIn()); // Mock user response and second payments response. - TestCreditCardFIDOAuthenticator::MakeCredential(fido_authenticator_.get(), + TestCreditCardFidoAuthenticator::MakeCredential(fido_authenticator_.get(), /*did_succeed=*/true); OptChange(AutofillClient::PaymentsRpcResult::kSuccess, /*user_is_opted_in=*/true); @@ -621,26 +621,26 @@ TEST_F(CreditCardFIDOAuthenticatorTest, #if !BUILDFLAG(IS_ANDROID) // This test is not applicable for Android (we won't opt-in with Register). -TEST_F(CreditCardFIDOAuthenticatorTest, +TEST_F(CreditCardFidoAuthenticatorTest, Register_OptInAttemptReturnsRequestOptions) { scoped_feature_list_.InitAndEnableFeature( features::kAutofillCreditCardAuthentication); EXPECT_FALSE(fido_authenticator_->IsUserOptedIn()); fido_authenticator_->Register(kTestAuthToken); - EXPECT_EQ(CreditCardFIDOAuthenticator::Flow::OPT_IN_FETCH_CHALLENGE_FLOW, + EXPECT_EQ(CreditCardFidoAuthenticator::Flow::OPT_IN_FETCH_CHALLENGE_FLOW, fido_authenticator_->current_flow()); // Mock payments response with challenge to invoke opt-in flow. OptChange(AutofillClient::PaymentsRpcResult::kSuccess, /*user_is_opted_in=*/false, /*include_creation_options=*/false, /*include_request_options=*/true); - EXPECT_EQ(CreditCardFIDOAuthenticator::Flow::OPT_IN_WITH_CHALLENGE_FLOW, + EXPECT_EQ(CreditCardFidoAuthenticator::Flow::OPT_IN_WITH_CHALLENGE_FLOW, fido_authenticator_->current_flow()); EXPECT_FALSE(fido_authenticator_->IsUserOptedIn()); // Mock user response and second payments response. - TestCreditCardFIDOAuthenticator::GetAssertion(fido_authenticator_.get(), + TestCreditCardFidoAuthenticator::GetAssertion(fido_authenticator_.get(), /*did_succeed=*/true); OptChange(AutofillClient::PaymentsRpcResult::kSuccess, /*user_is_opted_in=*/true); @@ -648,7 +648,7 @@ TEST_F(CreditCardFIDOAuthenticatorTest, } #endif -TEST_F(CreditCardFIDOAuthenticatorTest, Register_NewCardAuthorization) { +TEST_F(CreditCardFidoAuthenticatorTest, Register_NewCardAuthorization) { scoped_feature_list_.InitAndEnableFeature( features::kAutofillCreditCardAuthentication); SetUserOptInPreference(true); @@ -658,18 +658,18 @@ TEST_F(CreditCardFIDOAuthenticatorTest, Register_NewCardAuthorization) { requester_->GetWeakPtr(), kTestAuthToken, GetTestRequestOptions(kTestChallenge, kTestRelyingPartyId, kTestCredentialId)); - EXPECT_EQ(CreditCardFIDOAuthenticator::Flow::FOLLOWUP_AFTER_CVC_AUTH_FLOW, + EXPECT_EQ(CreditCardFidoAuthenticator::Flow::FOLLOWUP_AFTER_CVC_AUTH_FLOW, fido_authenticator_->current_flow()); // Mock user response and second payments response. - TestCreditCardFIDOAuthenticator::GetAssertion(fido_authenticator_.get(), + TestCreditCardFidoAuthenticator::GetAssertion(fido_authenticator_.get(), /*did_succeed=*/true); OptChange(AutofillClient::PaymentsRpcResult::kSuccess, /*user_is_opted_in=*/true); EXPECT_TRUE(fido_authenticator_->IsUserOptedIn()); } -TEST_F(CreditCardFIDOAuthenticatorTest, OptOut_Success) { +TEST_F(CreditCardFidoAuthenticatorTest, OptOut_Success) { scoped_feature_list_.InitAndEnableFeature( features::kAutofillCreditCardAuthentication); base::HistogramTester histogram_tester; @@ -678,7 +678,7 @@ TEST_F(CreditCardFIDOAuthenticatorTest, OptOut_Success) { EXPECT_TRUE(fido_authenticator_->IsUserOptedIn()); fido_authenticator_->OptOut(); - EXPECT_EQ(CreditCardFIDOAuthenticator::Flow::OPT_OUT_FLOW, + EXPECT_EQ(CreditCardFidoAuthenticator::Flow::OPT_OUT_FLOW, fido_authenticator_->current_flow()); // Mock payments response. diff --git a/components/autofill/core/browser/payments/full_card_request.h b/components/autofill/core/browser/payments/full_card_request.h index 8e3e6a046849f..1dcc3524ea10b 100644 --- a/components/autofill/core/browser/payments/full_card_request.h +++ b/components/autofill/core/browser/payments/full_card_request.h @@ -167,7 +167,7 @@ class FullCardRequest final : public CardUnmaskDelegate { payments::PaymentsClient::UnmaskResponseDetails& response_details); // Called when verification is cancelled. This is used only by - // CreditCardFIDOAuthenticator to cancel the flow for opted-in users. + // CreditCardFidoAuthenticator to cancel the flow for opted-in users. void OnFIDOVerificationCancelled(); payments::PaymentsClient::UnmaskResponseDetails unmask_response_details() diff --git a/components/autofill/core/browser/payments/test_authentication_requester.cc b/components/autofill/core/browser/payments/test_authentication_requester.cc index 9677193f78266..ad072227bba54 100644 --- a/components/autofill/core/browser/payments/test_authentication_requester.cc +++ b/components/autofill/core/browser/payments/test_authentication_requester.cc @@ -42,7 +42,7 @@ bool TestAuthenticationRequester::UserOptedInToFidoFromSettingsPageOnMobile() #if !BUILDFLAG(IS_IOS) void TestAuthenticationRequester::OnFIDOAuthenticationComplete( - const CreditCardFIDOAuthenticator::FidoAuthenticationResponse& response) { + const CreditCardFidoAuthenticator::FidoAuthenticationResponse& response) { did_succeed_ = response.did_succeed; if (*did_succeed_) { DCHECK(response.card); diff --git a/components/autofill/core/browser/payments/test_authentication_requester.h b/components/autofill/core/browser/payments/test_authentication_requester.h index 30521f1eb4072..308c2e069198f 100644 --- a/components/autofill/core/browser/payments/test_authentication_requester.h +++ b/components/autofill/core/browser/payments/test_authentication_requester.h @@ -21,7 +21,7 @@ namespace autofill { // Test class for requesting authentication from CreditCardCVCAuthenticator or -// CreditCardFIDOAuthenticator. +// CreditCardFidoAuthenticator. #if BUILDFLAG(IS_IOS) class TestAuthenticationRequester : public CreditCardCVCAuthenticator::Requester, @@ -29,7 +29,7 @@ class TestAuthenticationRequester #else class TestAuthenticationRequester : public CreditCardCVCAuthenticator::Requester, - public CreditCardFIDOAuthenticator::Requester, + public CreditCardFidoAuthenticator::Requester, public CreditCardOtpAuthenticator::Requester { #endif public: @@ -46,9 +46,9 @@ class TestAuthenticationRequester #endif #if !BUILDFLAG(IS_IOS) - // CreditCardFIDOAuthenticator::Requester: + // CreditCardFidoAuthenticator::Requester: void OnFIDOAuthenticationComplete( - const CreditCardFIDOAuthenticator::FidoAuthenticationResponse& response) + const CreditCardFidoAuthenticator::FidoAuthenticationResponse& response) override; void OnFidoAuthorizationComplete(bool did_succeed) override; @@ -73,7 +73,7 @@ class TestAuthenticationRequester } private: - // Set when CreditCardFIDOAuthenticator invokes IsUserVerifiableCallback(). + // Set when CreditCardFidoAuthenticator invokes IsUserVerifiableCallback(). absl::optional is_user_verifiable_; // Is set to true if authentication was successful. diff --git a/components/autofill/core/browser/payments/test_credit_card_fido_authenticator.cc b/components/autofill/core/browser/payments/test_credit_card_fido_authenticator.cc index 664f742b7cc15..e4804e305e264 100644 --- a/components/autofill/core/browser/payments/test_credit_card_fido_authenticator.cc +++ b/components/autofill/core/browser/payments/test_credit_card_fido_authenticator.cc @@ -13,14 +13,14 @@ namespace autofill { -TestCreditCardFIDOAuthenticator::TestCreditCardFIDOAuthenticator( +TestCreditCardFidoAuthenticator::TestCreditCardFidoAuthenticator( AutofillDriver* driver, AutofillClient* client) - : CreditCardFIDOAuthenticator(driver, client) {} + : CreditCardFidoAuthenticator(driver, client) {} -TestCreditCardFIDOAuthenticator::~TestCreditCardFIDOAuthenticator() = default; +TestCreditCardFidoAuthenticator::~TestCreditCardFidoAuthenticator() = default; -void TestCreditCardFIDOAuthenticator::Authenticate( +void TestCreditCardFidoAuthenticator::Authenticate( const CreditCard* card, base::WeakPtr requester, base::Value::Dict request_options, @@ -28,30 +28,30 @@ void TestCreditCardFIDOAuthenticator::Authenticate( authenticate_invoked_ = true; card_ = *card; context_token_ = context_token; - CreditCardFIDOAuthenticator::Authenticate( + CreditCardFidoAuthenticator::Authenticate( card, requester, std::move(request_options), context_token); } -void TestCreditCardFIDOAuthenticator::GetAssertion( +void TestCreditCardFidoAuthenticator::GetAssertion( blink::mojom::PublicKeyCredentialRequestOptionsPtr request_options) { request_options_ = request_options->Clone(); - CreditCardFIDOAuthenticator::GetAssertion(std::move(request_options)); + CreditCardFidoAuthenticator::GetAssertion(std::move(request_options)); } -void TestCreditCardFIDOAuthenticator::MakeCredential( +void TestCreditCardFidoAuthenticator::MakeCredential( blink::mojom::PublicKeyCredentialCreationOptionsPtr creation_options) { creation_options_ = creation_options->Clone(); - CreditCardFIDOAuthenticator::MakeCredential(std::move(creation_options)); + CreditCardFidoAuthenticator::MakeCredential(std::move(creation_options)); } -void TestCreditCardFIDOAuthenticator::OptOut() { +void TestCreditCardFidoAuthenticator::OptOut() { opt_out_called_ = true; - CreditCardFIDOAuthenticator::OptOut(); + CreditCardFidoAuthenticator::OptOut(); } // static -void TestCreditCardFIDOAuthenticator::GetAssertion( - CreditCardFIDOAuthenticator* fido_authenticator, +void TestCreditCardFidoAuthenticator::GetAssertion( + CreditCardFidoAuthenticator* fido_authenticator, bool did_succeed) { if (did_succeed) { blink::mojom::GetAssertionAuthenticatorResponsePtr response = @@ -68,8 +68,8 @@ void TestCreditCardFIDOAuthenticator::GetAssertion( } // static -void TestCreditCardFIDOAuthenticator::MakeCredential( - CreditCardFIDOAuthenticator* fido_authenticator, +void TestCreditCardFidoAuthenticator::MakeCredential( + CreditCardFidoAuthenticator* fido_authenticator, bool did_succeed) { if (did_succeed) { blink::mojom::MakeCredentialAuthenticatorResponsePtr response = @@ -85,12 +85,12 @@ void TestCreditCardFIDOAuthenticator::MakeCredential( } } -std::vector TestCreditCardFIDOAuthenticator::GetCredentialId() { +std::vector TestCreditCardFidoAuthenticator::GetCredentialId() { DCHECK(!request_options_->allow_credentials.empty()); return request_options_->allow_credentials.front().id; } -std::vector TestCreditCardFIDOAuthenticator::GetChallenge() { +std::vector TestCreditCardFidoAuthenticator::GetChallenge() { if (request_options_) { return request_options_->challenge; } else { @@ -99,7 +99,7 @@ std::vector TestCreditCardFIDOAuthenticator::GetChallenge() { } } -std::string TestCreditCardFIDOAuthenticator::GetRelyingPartyId() { +std::string TestCreditCardFidoAuthenticator::GetRelyingPartyId() { if (request_options_) { return request_options_->relying_party_id; } else { @@ -108,19 +108,19 @@ std::string TestCreditCardFIDOAuthenticator::GetRelyingPartyId() { } } -void TestCreditCardFIDOAuthenticator::IsUserVerifiable( +void TestCreditCardFidoAuthenticator::IsUserVerifiable( base::OnceCallback callback) { return std::move(callback).Run(is_user_verifiable_); } -bool TestCreditCardFIDOAuthenticator::IsUserOptedIn() { +bool TestCreditCardFidoAuthenticator::IsUserOptedIn() { if (is_user_opted_in_.has_value()) return is_user_opted_in_.value(); - return CreditCardFIDOAuthenticator::IsUserOptedIn(); + return CreditCardFidoAuthenticator::IsUserOptedIn(); } -void TestCreditCardFIDOAuthenticator::Reset() { +void TestCreditCardFidoAuthenticator::Reset() { is_user_verifiable_ = false; is_user_opted_in_ = absl::nullopt; opt_out_called_ = false; diff --git a/components/autofill/core/browser/payments/test_credit_card_fido_authenticator.h b/components/autofill/core/browser/payments/test_credit_card_fido_authenticator.h index 97a75ed8dbaaa..46a45e0997762 100644 --- a/components/autofill/core/browser/payments/test_credit_card_fido_authenticator.h +++ b/components/autofill/core/browser/payments/test_credit_card_fido_authenticator.h @@ -17,20 +17,20 @@ namespace autofill { -// Test class for CreditCardFIDOAuthenticator. -class TestCreditCardFIDOAuthenticator : public CreditCardFIDOAuthenticator { +// Test class for CreditCardFidoAuthenticator. +class TestCreditCardFidoAuthenticator : public CreditCardFidoAuthenticator { public: - explicit TestCreditCardFIDOAuthenticator(AutofillDriver* driver, + explicit TestCreditCardFidoAuthenticator(AutofillDriver* driver, AutofillClient* client); - TestCreditCardFIDOAuthenticator(const TestCreditCardFIDOAuthenticator&) = + TestCreditCardFidoAuthenticator(const TestCreditCardFidoAuthenticator&) = delete; - TestCreditCardFIDOAuthenticator& operator=( - const TestCreditCardFIDOAuthenticator&) = delete; + TestCreditCardFidoAuthenticator& operator=( + const TestCreditCardFidoAuthenticator&) = delete; - ~TestCreditCardFIDOAuthenticator() override; + ~TestCreditCardFidoAuthenticator() override; - // CreditCardFIDOAuthenticator: + // CreditCardFidoAuthenticator: void Authenticate(const CreditCard* card, base::WeakPtr requester, base::Value::Dict request_options, @@ -44,11 +44,11 @@ class TestCreditCardFIDOAuthenticator : public CreditCardFIDOAuthenticator { void OptOut() override; // Invokes fido_authenticator->OnDidGetAssertion(). - static void GetAssertion(CreditCardFIDOAuthenticator* fido_authenticator, + static void GetAssertion(CreditCardFidoAuthenticator* fido_authenticator, bool did_succeed); // Invokes fido_authenticator->OnDidMakeCredential(). - static void MakeCredential(CreditCardFIDOAuthenticator* fido_authenticator, + static void MakeCredential(CreditCardFidoAuthenticator* fido_authenticator, bool did_succeed); // Getter methods to query Request Options.