Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: components/autofill/core/browser/autofill_profile_unittest.cc

Issue 399003002: Parse full name set in chrome://settings/autofill (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: stop breaking things Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/format_macros.h" 6 #include "base/format_macros.h"
7 #include "base/guid.h" 7 #include "base/guid.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 // Result of assignment should be logically equal to the original profile. 665 // Result of assignment should be logically equal to the original profile.
666 AutofillProfile b(base::GenerateGUID(), "http://www.example.com/"); 666 AutofillProfile b(base::GenerateGUID(), "http://www.example.com/");
667 b = a; 667 b = a;
668 EXPECT_TRUE(a == b); 668 EXPECT_TRUE(a == b);
669 669
670 // Assignment to self should not change the profile value. 670 // Assignment to self should not change the profile value.
671 a = a; 671 a = a;
672 EXPECT_TRUE(a == b); 672 EXPECT_TRUE(a == b);
673 } 673 }
674 674
675 TEST(AutofillProfileTest, SetMultiInfo) {
676 std::vector<base::string16> full_names;
677 full_names.push_back(ASCIIToUTF16("John Davis"));
678 full_names.push_back(ASCIIToUTF16("Elouise Davis"));
679 AutofillProfile p;
680 p.SetMultiInfo(AutofillType(NAME_FULL), full_names, "en-US");
681
682 std::vector<base::string16> first_names;
683 p.GetMultiInfo(AutofillType(NAME_FIRST), "en-US", &first_names);
684 ASSERT_EQ(2U, first_names.size());
685 EXPECT_EQ(ASCIIToUTF16("John"), first_names[0]);
686 EXPECT_EQ(ASCIIToUTF16("Elouise"), first_names[1]);
687
688 std::vector<base::string16> last_names;
689 p.GetMultiInfo(AutofillType(NAME_LAST), "en-US", &last_names);
690 ASSERT_EQ(2U, last_names.size());
691 EXPECT_EQ(ASCIIToUTF16("Davis"), last_names[0]);
692 EXPECT_EQ(ASCIIToUTF16("Davis"), last_names[1]);
693 }
694
675 TEST(AutofillProfileTest, Copy) { 695 TEST(AutofillProfileTest, Copy) {
676 AutofillProfile a(base::GenerateGUID(), "https://www.example.com/"); 696 AutofillProfile a(base::GenerateGUID(), "https://www.example.com/");
677 test::SetProfileInfo(&a, "Marion", "Mitchell", "Morrison", 697 test::SetProfileInfo(&a, "Marion", "Mitchell", "Morrison",
678 "marion@me.xyz", "Fox", "123 Zoo St.", "unit 5", 698 "marion@me.xyz", "Fox", "123 Zoo St.", "unit 5",
679 "Hollywood", "CA", "91601", "US", 699 "Hollywood", "CA", "91601", "US",
680 "12345678910"); 700 "12345678910");
681 701
682 // Clone should be logically equal to the original. 702 // Clone should be logically equal to the original.
683 AutofillProfile b(a); 703 AutofillProfile b(a);
684 EXPECT_TRUE(a == b); 704 EXPECT_TRUE(a == b);
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 1136
1117 for (size_t i = 0; i < current_case.expected_result.size(); ++i) { 1137 for (size_t i = 0; i < current_case.expected_result.size(); ++i) {
1118 EXPECT_EQ(first_names[i], merged_first_names[i]); 1138 EXPECT_EQ(first_names[i], merged_first_names[i]);
1119 EXPECT_EQ(middle_names[i], merged_middle_names[i]); 1139 EXPECT_EQ(middle_names[i], merged_middle_names[i]);
1120 EXPECT_EQ(last_names[i], merged_last_names[i]); 1140 EXPECT_EQ(last_names[i], merged_last_names[i]);
1121 } 1141 }
1122 } 1142 }
1123 } 1143 }
1124 1144
1125 } // namespace autofill 1145 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698