#include "components/autofill/core/browser/payments/credit_card_risk_based_authenticator.h"
#include <memory>
#include "base/strings/utf_string_conversions.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/task_environment.h"
#include "components/autofill/core/browser/autofill_test_utils.h"
#include "components/autofill/core/browser/data_model/credit_card.h"
#include "components/autofill/core/browser/metrics/payments/card_unmask_authentication_metrics.h"
#include "components/autofill/core/browser/payments/payments_autofill_client.h"
#include "components/autofill/core/browser/payments/test_authentication_requester.h"
#include "components/autofill/core/browser/payments/test_payments_network_interface.h"
#include "components/autofill/core/browser/test_autofill_client.h"
#include "components/autofill/core/browser/test_personal_data_manager.h"
#include "components/sync/test/test_sync_service.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace autofill {
namespace {
constexpr std::string_view kTestNumber = …;
constexpr std::string_view kTestChallenge = …;
constexpr std::string_view kCredentialId = …;
constexpr std::string_view kGooglePaymentsRpid = …;
}
class CreditCardRiskBasedAuthenticatorTest : public testing::Test { … };
TEST_F(CreditCardRiskBasedAuthenticatorTest, UnmaskRequestSetCorrectly) { … }
TEST_F(CreditCardRiskBasedAuthenticatorTest,
AuthServerCardAttemptLoggedCorrectly) { … }
TEST_F(CreditCardRiskBasedAuthenticatorTest,
AuthServerCardLatencyLoggedCorrectly) { … }
TEST_F(CreditCardRiskBasedAuthenticatorTest, AuthenticateServerCardSuccess) { … }
TEST_F(CreditCardRiskBasedAuthenticatorTest, AuthenticateServerCardFailure) { … }
TEST_F(CreditCardRiskBasedAuthenticatorTest, AuthenticateServerCardCancelled) { … }
TEST_F(CreditCardRiskBasedAuthenticatorTest,
AuthenticateServerCardSuccess_PanNotReturned) { … }
TEST_F(CreditCardRiskBasedAuthenticatorTest,
AuthenticateServerCardSuccess_FidoReturned) { … }
TEST_F(CreditCardRiskBasedAuthenticatorTest,
AuthVirtualCardAttemptLoggedCorrectly) { … }
TEST_F(CreditCardRiskBasedAuthenticatorTest, VirtualCardUnmaskSuccess) { … }
TEST_F(CreditCardRiskBasedAuthenticatorTest, VirtualCardUnmaskFailure) { … }
class CreditCardRiskBasedAuthenticatorCardMetadataTest
: public CreditCardRiskBasedAuthenticatorTest,
public testing::WithParamInterface<std::tuple<bool, bool, bool>> { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(CreditCardRiskBasedAuthenticatorCardMetadataTest, MetadataSignal) { … }
class CreditCardRiskBasedAuthenticatorCardBenefitsTest
: public CreditCardRiskBasedAuthenticatorTest,
public ::testing::WithParamInterface<
std::tuple<base::FunctionRef<CreditCardBenefit()>,
bool,
std::string>> { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(CreditCardRiskBasedAuthenticatorCardBenefitsTest,
Benefits_ClientBehaviorConstants) { … }
}