chromium/components/autofill/core/browser/payments/payments_requests/unmask_card_request_unittest.cc

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/autofill/core/browser/payments/payments_requests/unmask_card_request.h"

#include <memory>

#include "base/functional/callback_helpers.h"
#include "base/json/json_reader.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "components/autofill/core/browser/autofill_test_utils.h"
#include "components/autofill/core/browser/payments/autofill_payments_feature_availability.h"
#include "components/autofill/core/browser/payments/card_unmask_challenge_option.h"
#include "components/autofill/core/common/autofill_payments_features.h"
#include "components/strings/grit/components_strings.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/l10n/l10n_util.h"
#include "url/origin.h"

namespace autofill::payments {

// TODO(crbug.com/40241790): Extend tests in this file to all of the possible
// card unmasking test cases. The cases that are not in this file are currently
// tested in PaymentsNetworkInterface tests, but they should be tested here as
// well.
class UnmaskCardRequestTest : public testing::Test {};

// Test to ensure that the request content is correctly populated for a regular
// unmask request.
TEST_F(UnmaskCardRequestTest, GetRequestContent) {}

TEST_F(UnmaskCardRequestTest, DoesNotIncludeMerchantDomainWhenFlagDisabled) {}

TEST_F(UnmaskCardRequestTest, DoesNotIncludeMerchantDomainWhenMissingField) {}

// Test to ensure response is correctly parsed when the FIDO challenge is
// returned with context token.
TEST_F(UnmaskCardRequestTest, FidoChallengeReturned_ParseResponse) {}

// Test to ensure the response is complete when context token is returned but
// PAN is not.
TEST_F(UnmaskCardRequestTest, ContextTokenReturned) {}

// Test that the response is not complete when both context token and real PAN
// are not returned.
TEST_F(UnmaskCardRequestTest, ContextTokenAndPanNotReturned) {}

TEST_F(UnmaskCardRequestTest, DoesNotHaveTimeoutWithoutFlag) {}

TEST_F(UnmaskCardRequestTest, HasTimeoutWhenFlagSet) {}

// Params of the VirtualCardUnmaskCardRequestTest:
// -- autofill::CardUnmaskChallengeOptionType challenge_option_type
// -- bool autofill_enable_3ds_for_vcn_yellow_path
// TODO(crbug.com/40901660): Extend this texting fixture to test the OTP cases
// as well.
class VirtualCardUnmaskCardRequestTest
    : public UnmaskCardRequestTest,
      public testing::WithParamInterface<
          std::tuple<autofill::CardUnmaskChallengeOptionType, bool>> {};

TEST_P(VirtualCardUnmaskCardRequestTest, GetRequestContent) {}

TEST_P(VirtualCardUnmaskCardRequestTest,
       IncludesOneMerchantDomainWhenFlagDisabled) {}

TEST_P(VirtualCardUnmaskCardRequestTest,
       ChallengeOptionsReturned_ParseResponse) {}

TEST_P(VirtualCardUnmaskCardRequestTest, IsRetryableFailure) {}

INSTANTIATE_TEST_SUITE_P();

}  // namespace autofill::payments