This source file includes following definitions.
- TEST
- TEST
#include "components/autofill/core/browser/autofill_type.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace autofill {
namespace {
TEST(AutofillTypeTest, ServerFieldTypes) {
AutofillType none(NO_SERVER_DATA);
EXPECT_EQ(NO_SERVER_DATA, none.GetStorableType());
EXPECT_EQ(NO_GROUP, none.group());
AutofillType unknown(UNKNOWN_TYPE);
EXPECT_EQ(UNKNOWN_TYPE, unknown.GetStorableType());
EXPECT_EQ(NO_GROUP, unknown.group());
AutofillType first(NAME_FIRST);
EXPECT_EQ(NAME_FIRST, first.GetStorableType());
EXPECT_EQ(NAME, first.group());
AutofillType phone(PHONE_HOME_NUMBER);
EXPECT_EQ(PHONE_HOME_NUMBER, phone.GetStorableType());
EXPECT_EQ(PHONE_HOME, phone.group());
AutofillType billing_address(ADDRESS_BILLING_LINE1);
EXPECT_EQ(ADDRESS_HOME_LINE1, billing_address.GetStorableType());
EXPECT_EQ(ADDRESS_BILLING, billing_address.group());
AutofillType last(NAME_BILLING_SUFFIX);
EXPECT_EQ(NAME_SUFFIX, last.GetStorableType());
EXPECT_EQ(NAME_BILLING, last.group());
AutofillType boundary(MAX_VALID_FIELD_TYPE);
EXPECT_EQ(UNKNOWN_TYPE, boundary.GetStorableType());
EXPECT_EQ(NO_GROUP, boundary.group());
AutofillType beyond(static_cast<ServerFieldType>(MAX_VALID_FIELD_TYPE + 10));
EXPECT_EQ(UNKNOWN_TYPE, beyond.GetStorableType());
EXPECT_EQ(NO_GROUP, beyond.group());
AutofillType between(static_cast<ServerFieldType>(16));
EXPECT_EQ(UNKNOWN_TYPE, between.GetStorableType());
EXPECT_EQ(NO_GROUP, between.group());
}
TEST(AutofillTypeTest, HtmlFieldTypes) {
AutofillType unknown(HTML_TYPE_UNKNOWN, HTML_MODE_NONE);
EXPECT_EQ(UNKNOWN_TYPE, unknown.GetStorableType());
EXPECT_EQ(NO_GROUP, unknown.group());
AutofillType first(HTML_TYPE_GIVEN_NAME, HTML_MODE_NONE);
EXPECT_EQ(NAME_FIRST, first.GetStorableType());
EXPECT_EQ(NAME, first.group());
AutofillType phone(HTML_TYPE_TEL, HTML_MODE_NONE);
EXPECT_EQ(PHONE_HOME_WHOLE_NUMBER, phone.GetStorableType());
EXPECT_EQ(PHONE_HOME, phone.group());
AutofillType last(HTML_TYPE_CREDIT_CARD_EXP_4_DIGIT_YEAR, HTML_MODE_NONE);
EXPECT_EQ(CREDIT_CARD_EXP_4_DIGIT_YEAR, last.GetStorableType());
EXPECT_EQ(CREDIT_CARD, last.group());
AutofillType shipping_first(HTML_TYPE_GIVEN_NAME, HTML_MODE_SHIPPING);
EXPECT_EQ(NAME_FIRST, shipping_first.GetStorableType());
EXPECT_EQ(NAME, shipping_first.group());
AutofillType billing_first(HTML_TYPE_GIVEN_NAME, HTML_MODE_BILLING);
EXPECT_EQ(NAME_FIRST, billing_first.GetStorableType());
EXPECT_EQ(NAME_BILLING, billing_first.group());
}
}
}