chromium/components/autofill/core/browser/form_parsing/credit_card_field_parser_unittest.cc

// Copyright 2013 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/form_parsing/credit_card_field_parser.h"

#include <algorithm>
#include <memory>
#include <vector>

#include "base/memory/ptr_util.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "base/time/time.h"
#include "components/autofill/core/browser/autofill_field.h"
#include "components/autofill/core/browser/field_types.h"
#include "components/autofill/core/browser/form_parsing/autofill_scanner.h"
#include "components/autofill/core/browser/form_parsing/parsing_test_utils.h"
#include "components/autofill/core/common/autofill_clock.h"
#include "components/autofill/core/common/autofill_features.h"
#include "components/autofill/core/common/form_field_data.h"
#include "testing/gtest/include/gtest/gtest.h"

ASCIIToUTF16;

namespace autofill {
namespace {
// Returns a vector of numeric months with a leading 0 and an additional "MM"
// entry.
std::vector<SelectOption> GetMonths() {}

// Returns a vector of 10 consecutive years starting today in $ digit format
// and an additional "YYYY" entry.
std::vector<SelectOption> Get4DigitYears() {}

// Returns a vector of 10 consecutive years starting today in 2 digit format
// and an additional "YY" entry.
std::vector<SelectOption> Get2DigitYears() {}

// Adds prefixes and postfixes to options and labels.
std::vector<SelectOption> WithNoise(std::vector<SelectOption> options) {}

class CreditCardFieldParserTestBase : public FormFieldParserTestBase {};

class CreditCardFieldParserTest
    : public CreditCardFieldParserTestBase,
      public ::testing::TestWithParam<PatternProviderFeatureState> {};

INSTANTIATE_TEST_SUITE_P();

TEST_P(CreditCardFieldParserTest, Empty) {}

TEST_P(CreditCardFieldParserTest, NonParse) {}

TEST_P(CreditCardFieldParserTest, ParseCreditCardNoNumber) {}

TEST_P(CreditCardFieldParserTest, ParseCreditCardNoDate) {}

TEST_P(CreditCardFieldParserTest, ParseMiniumCreditCard) {}

// Ensure that a placeholder hint for a 2-digit year is respected
TEST_P(CreditCardFieldParserTest, ParseMiniumCreditCardWith2DigitYearHint) {}

// Ensure that a max-length can trump an incorrect 4-digit placeholder hint.
TEST_P(CreditCardFieldParserTest, ParseMiniumCreditCardWithMaxLength) {}

struct CreditCardFieldYearTestCase {};

class CreditCardFieldYearTest
    : public CreditCardFieldParserTestBase,
      public testing::TestWithParam<std::tuple<PatternProviderFeatureState,
                                               CreditCardFieldYearTestCase,
                                               bool>> {};

TEST_P(CreditCardFieldYearTest, ParseMinimumCreditCardWithExpiryDateOptions) {}

INSTANTIATE_TEST_SUITE_P();

TEST_P(CreditCardFieldParserTest, ParseFullCreditCard) {}

TEST_P(CreditCardFieldParserTest, ParseExpMonthYear) {}

TEST_P(CreditCardFieldParserTest, ParseExpMonthYear2) {}

TEST_P(CreditCardFieldParserTest, ParseGiftCard) {}

struct ParseExpFieldTestCase {};

class ParseExpFieldTest
    : public CreditCardFieldParserTestBase,
      public testing::TestWithParam<
          std::tuple<PatternProviderFeatureState, ParseExpFieldTestCase>> {};

TEST_P(ParseExpFieldTest, ParseExpField) {}

INSTANTIATE_TEST_SUITE_P();

TEST_P(CreditCardFieldParserTest, ParseCreditCardHolderNameWithCCFullName) {}

// Verifies that <input type="month"> controls are able to be parsed correctly.
TEST_P(CreditCardFieldParserTest, ParseMonthControl) {}

// Verify that heuristics <input name="ccyear" maxlength="2"/> considers
// *maxlength* attribute while parsing 2 Digit expiration year.
TEST_P(CreditCardFieldParserTest, ParseCreditCardExpYear_2DigitMaxLength) {}

TEST_P(CreditCardFieldParserTest, ParseMultipleCreditCardNumbers) {}

TEST_P(CreditCardFieldParserTest, ParseFirstAndLastNames) {}

TEST_P(CreditCardFieldParserTest, ParseConsecutiveCvc) {}

TEST_P(CreditCardFieldParserTest, ParseNonConsecutiveCvc) {}

TEST_P(CreditCardFieldParserTest, ParseCreditCardContextualNameNotCard) {}

TEST_P(CreditCardFieldParserTest,
       ParseCreditCardContextualNameNotCardAcctMatch) {}

TEST_P(CreditCardFieldParserTest, ParseCreditCardContextualNameWithExpiration) {}

TEST_P(CreditCardFieldParserTest,
       ParseCreditCardContextualNameWithVerification) {}

struct DetermineExpirationDateFormatTestCase {};

class DetermineExpirationDateFormat
    : public testing::TestWithParam<DetermineExpirationDateFormatTestCase> {};

INSTANTIATE_TEST_SUITE_P();

TEST_P(DetermineExpirationDateFormat, TestDetermineFormat) {}

}  // namespace
}  // namespace autofill