| Index: chrome/browser/ui/webui/options/autofill_options_handler_unittest.cc
|
| diff --git a/chrome/browser/ui/webui/options/autofill_options_handler_unittest.cc b/chrome/browser/ui/webui/options/autofill_options_handler_unittest.cc
|
| index a00cc4cb3d709efce5939148c610c1799f09e1c8..f9d91bb2d3f6cae978196f4c85fe6fb7a11409ff 100644
|
| --- a/chrome/browser/ui/webui/options/autofill_options_handler_unittest.cc
|
| +++ b/chrome/browser/ui/webui/options/autofill_options_handler_unittest.cc
|
| @@ -4,11 +4,15 @@
|
|
|
| #include "chrome/browser/ui/webui/options/autofill_options_handler.h"
|
|
|
| +#include "base/strings/utf_string_conversions.h"
|
| #include "base/values.h"
|
| #include "components/autofill/core/browser/autofill_profile.h"
|
| #include "components/autofill/core/browser/autofill_test_utils.h"
|
| +#include "components/autofill/core/common/autofill_constants.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| +using autofill::AutofillType;
|
| +
|
| namespace options {
|
|
|
| TEST(AutofillOptionsHandlerTest, AddressToDictionary) {
|
| @@ -59,4 +63,41 @@ TEST(AutofillOptionsHandlerTest, AddressToDictionary) {
|
| EXPECT_EQ("832-555-1000", value);
|
| }
|
|
|
| +TEST(AutofillOptionsHandlerTest, ShouldTransferNameComponents) {
|
| + autofill::AutofillProfile prior_profile;
|
| + autofill::test::SetProfileInfo(
|
| + &prior_profile, "First", "Middle", "Last", "fml@example.com", "Acme inc",
|
| + "123 Main", "Apt 2", "Laredo", "TX", "77300", "US", "832-555-1000");
|
| +
|
| + autofill::AutofillProfile new_profile;
|
| + autofill::test::SetProfileInfo(&new_profile, "", "", "", "fml@example.com",
|
| + "Acme inc", "123 Main", "Apt 2", "Laredo",
|
| + "TX", "77300", "US", "832-555-1000");
|
| +
|
| + new_profile.SetInfo(AutofillType(autofill::NAME_FULL),
|
| + base::UTF8ToUTF16("First Last"), "en-US");
|
| + EXPECT_TRUE(AutofillOptionsHandler::ShouldTransferNameComponents(
|
| + new_profile, prior_profile));
|
| +
|
| + new_profile.SetInfo(AutofillType(autofill::NAME_FULL),
|
| + base::UTF8ToUTF16("First Middle Last"), "en-US");
|
| + EXPECT_TRUE(AutofillOptionsHandler::ShouldTransferNameComponents(
|
| + new_profile, prior_profile));
|
| +
|
| + new_profile.SetInfo(AutofillType(autofill::NAME_FULL),
|
| + base::UTF8ToUTF16("First M Last"), "en-US");
|
| + EXPECT_TRUE(AutofillOptionsHandler::ShouldTransferNameComponents(
|
| + new_profile, prior_profile));
|
| +
|
| + new_profile.SetInfo(AutofillType(autofill::NAME_FULL),
|
| + base::UTF8ToUTF16("First M. Last"), "en-US");
|
| + EXPECT_TRUE(AutofillOptionsHandler::ShouldTransferNameComponents(
|
| + new_profile, prior_profile));
|
| +
|
| + new_profile.SetInfo(AutofillType(autofill::NAME_FULL),
|
| + base::UTF8ToUTF16("Kirby Puckett"), "en-US");
|
| + EXPECT_FALSE(AutofillOptionsHandler::ShouldTransferNameComponents(
|
| + new_profile, prior_profile));
|
| +}
|
| +
|
| } // namespace options
|
|
|