1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/autofill/contact_info.h"
6
7 #include "base/basictypes.h"
8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/autofill/autofill_type.h"
11 #include "chrome/browser/autofill/field_types.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13
TEST(NameInfoTest,TestSetFullName)14 TEST(NameInfoTest, TestSetFullName) {
15 NameInfo name;
16 name.SetFullName(ASCIIToUTF16("Virgil"));
17 EXPECT_EQ(name.first(), ASCIIToUTF16("Virgil"));
18 EXPECT_EQ(name.middle(), ASCIIToUTF16(""));
19 EXPECT_EQ(name.last(), ASCIIToUTF16(""));
20 EXPECT_EQ(name.FullName(), ASCIIToUTF16("Virgil"));
21
22 name.SetFullName(ASCIIToUTF16("Murray Gell-Mann"));
23 EXPECT_EQ(name.first(), ASCIIToUTF16("Murray"));
24 EXPECT_EQ(name.middle(), ASCIIToUTF16(""));
25 EXPECT_EQ(name.last(), ASCIIToUTF16("Gell-Mann"));
26 EXPECT_EQ(name.FullName(), ASCIIToUTF16("Murray Gell-Mann"));
27
28 name.SetFullName(ASCIIToUTF16("Mikhail Yevgrafovich Saltykov-Shchedrin"));
29 EXPECT_EQ(name.first(), ASCIIToUTF16("Mikhail"));
30 EXPECT_EQ(name.middle(), ASCIIToUTF16("Yevgrafovich"));
31 EXPECT_EQ(name.last(), ASCIIToUTF16("Saltykov-Shchedrin"));
32 EXPECT_EQ(name.FullName(),
33 ASCIIToUTF16("Mikhail Yevgrafovich Saltykov-Shchedrin"));
34
35 name.SetFullName(ASCIIToUTF16("Arthur Ignatius Conan Doyle"));
36 EXPECT_EQ(name.first(), ASCIIToUTF16("Arthur"));
37 EXPECT_EQ(name.middle(), ASCIIToUTF16("Ignatius Conan"));
38 EXPECT_EQ(name.last(), ASCIIToUTF16("Doyle"));
39 EXPECT_EQ(name.FullName(), ASCIIToUTF16("Arthur Ignatius Conan Doyle"));
40 }
41
42