chromium/components/autofill/core/browser/form_parsing/address_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/address_field_parser.h"

#include <memory>
#include <vector>

#include "base/memory/ptr_util.h"
#include "base/test/scoped_feature_list.h"
#include "components/autofill/core/browser/field_types.h"
#include "components/autofill/core/browser/form_parsing/parsing_test_utils.h"
#include "components/autofill/core/common/autofill_features.h"
#include "components/autofill/core/common/form_field_data.h"

namespace autofill {

class AddressFieldParserTest
    : public FormFieldParserTestBase,
      public ::testing::TestWithParam<PatternProviderFeatureState> {};

INSTANTIATE_TEST_SUITE_P();

TEST_P(AddressFieldParserTest, Empty) {}

TEST_P(AddressFieldParserTest, NonParse) {}

TEST_P(AddressFieldParserTest, ParseOneLineAddress) {}

TEST_P(AddressFieldParserTest, ParseTwoLineAddress) {}

TEST_P(AddressFieldParserTest, ParseThreeLineAddress) {}

TEST_P(AddressFieldParserTest, ParseStreetAddressFromTextArea) {}

// Tests that fields are classified as |ADDRESS_HOME_LINE1|
TEST_P(AddressFieldParserTest, ParseOneLineAddressPL) {}

// Tests that fields are classified as |ADDRESS_HOME_STREET_NAME| and
// |ADDRESS_HOME_HOUSE_NUMBER_AND_APT| when they are labeled accordingly and
// both are present.
TEST_P(AddressFieldParserTest, ParseStreetNameAndHouseNumberAptPL) {}

// Tests that fields are classified as |ADDRESS_HOME_STREET_NAME| and
// |ADDRESS_HOME_HOUSE_NUMBER| when they are labeled accordingly and
// both are present.
TEST_P(AddressFieldParserTest, ParseStreetNameAndHouseNumbertPL) {}

// Tests that fields are classified as |ADDRESS_HOME_STREET_NAME|,
// |ADDRESS_HOME_HOUSE_NUMBER| and |ADDRESS_HOME_APT_NUM|  when they are labeled
// accordingly and both are present.
TEST_P(AddressFieldParserTest, ParseStreetNameHouseNumbertAndAptNumPL) {}

// Tests that fields are classified as |ADDRESS_HOME_STREET_NAME| and
// |ADDRESS_HOME_HOUSE_NUMBER| when they are labeled accordingly and
// both are present.
TEST_P(AddressFieldParserTest, ParseStreetNameAndHouseNumber) {}

// Tests that fields are classified as |ADDRESS_HOME_STREET_NAME|, and
// |ADDRESS_HOME_HOUSE_NUMBER| |ADDRESS_HOME_APT_NUM| when they are labeled
// accordingly and all are present.
TEST_P(AddressFieldParserTest,
       ParseStreetNameAndHouseNumberAndApartmentNumber) {}

// Tests that an address field after a |ADDRESS_HOME_STREET_NAME|,
// |ADDRESS_HOME_HOUSE_NUMBER| combination is classified as
// |ADDRESS_HOME_LINE2| instead of |ADDRESS_HOME_LINE1|.
TEST_P(AddressFieldParserTest, ParseAsAddressLine2AfterStreetNameNotEnabled) {}

TEST_P(AddressFieldParserTest, ParseAsAddressLine2AfterStreetNameEnabled) {}

// Tests that the field is not classified as |ADDRESS_HOME_STREET_NAME| when
// it is labeled accordingly but an adjacent field classified as
// |ADDRESS_HOME_HOUSE_NUMBER| is absent.
TEST_P(AddressFieldParserTest, NotParseStreetNameWithoutHouseNumber) {}

// Tests that the field is not classified as |ADDRESS_HOME_HOUSE_NUMBER| when
// it is labeled accordingly but adjacent field classified as
// |ADDRESS_HOME_STREET_NAME| is absent.
TEST_P(AddressFieldParserTest, NotParseHouseNumberWithoutStreetName) {}

// Tests that the dependent locality is correctly classified with
// an unambiguous field name and label.
TEST_P(AddressFieldParserTest, ParseDependentLocality) {}

// Tests that the landmark is correctly classified.
TEST_P(AddressFieldParserTest, ParseLandmark) {}

// Tests that between streets field is correctly classified.
TEST_P(AddressFieldParserTest, ParseBetweenStreets) {}

// Tests that multiple between streets field are correctly classified.
TEST_P(AddressFieldParserTest, ParseBetweenStreetsLines) {}

// Tests that address level 2 field is correctly classified.
TEST_P(AddressFieldParserTest, ParseAdminLevel2) {}

// Tests that overflow field is correctly classified.
TEST_P(AddressFieldParserTest, ParseOverflow) {}

// Tests that overflow field is correctly classified.
TEST_P(AddressFieldParserTest, ParseOverflowAndLandmark) {}

TEST_P(AddressFieldParserTest, ParseCity) {}

TEST_P(AddressFieldParserTest, ParseState) {}

TEST_P(AddressFieldParserTest, ParseZip) {}

TEST_P(AddressFieldParserTest, ParseZipFileExtension) {}

TEST_P(AddressFieldParserTest, ParseStateAndZipOneLabel) {}

TEST_P(AddressFieldParserTest, ParseCountry) {}

TEST_P(AddressFieldParserTest, ParseCompany) {}

// Tests that the dependent locality, city, state, country and zip-code
// fields are correctly classfied with unambiguous field names and labels.
TEST_P(AddressFieldParserTest,
       ParseDependentLocalityCityStateCountryZipcodeTogether) {}

// Tests that the field is classified as |ADDRESS_HOME_COUNTRY| when the field
// contains 'region'.
TEST_P(AddressFieldParserTest, ParseAmbiguousCountryState) {}
TEST_P(AddressFieldParserTest, ParseAmbiguousCountryState2) {}

// Tests that city and state fields are classified correctly when their names
// contain keywords for different types. This is achieved by giving the priority
// to the label over the name for pages in Turkish.
TEST_P(AddressFieldParserTest, ParseTurkishCityStateWithLabelPrecedence) {}

// Tests that address name is not misclassified as address.
TEST_P(AddressFieldParserTest, NotParseAddressName_TR) {}

// Tests that an address name does not lead to a classification even if the
// field mentions the word city.
TEST_P(AddressFieldParserTest, NotParseAddressName_BR) {}

// Tests that the address components sequence in a label is classified
// as |ADDRESS_HOME_LINE1|.
TEST_P(AddressFieldParserTest, ParseAddressComponentsSequenceAsAddressLine1) {}

// Tests that the address components sequence in a label is classified
// as |ADDRESS_HOME_STREET_ADDRESS|.
TEST_P(AddressFieldParserTest, ParseAddressComponentsSequenceAsStreetAddress) {}

}  // namespace autofill