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

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

Issue 332213004: Fix profile comparison re: address lines. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: change test Created 6 years, 6 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
« no previous file with comments | « components/autofill/core/browser/autofill_profile.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/guid.h" 6 #include "base/guid.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/memory/scoped_vector.h" 8 #include "base/memory/scoped_vector.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 EXPECT_LT(0, b.Compare(a)); 647 EXPECT_LT(0, b.Compare(a));
648 648
649 // Phone numbers are compared by the full number, including the area code. 649 // Phone numbers are compared by the full number, including the area code.
650 // This is a regression test for http://crbug.com/163024 650 // This is a regression test for http://crbug.com/163024
651 test::SetProfileInfo(&a, NULL, NULL, NULL, NULL, 651 test::SetProfileInfo(&a, NULL, NULL, NULL, NULL,
652 NULL, NULL, NULL, NULL, NULL, NULL, NULL, "650.555.4321"); 652 NULL, NULL, NULL, NULL, NULL, NULL, NULL, "650.555.4321");
653 test::SetProfileInfo(&b, NULL, NULL, NULL, NULL, 653 test::SetProfileInfo(&b, NULL, NULL, NULL, NULL,
654 NULL, NULL, NULL, NULL, NULL, NULL, NULL, "408.555.4321"); 654 NULL, NULL, NULL, NULL, NULL, NULL, NULL, "408.555.4321");
655 EXPECT_GT(0, a.Compare(b)); 655 EXPECT_GT(0, a.Compare(b));
656 EXPECT_LT(0, b.Compare(a)); 656 EXPECT_LT(0, b.Compare(a));
657
658 // Addresses are compared in full. Regression test for http://crbug.com/375545
659 test::SetProfileInfo(&a, "John", NULL, NULL, NULL,
660 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
661 a.SetRawInfo(ADDRESS_HOME_STREET_ADDRESS,
662 ASCIIToUTF16("line one\nline two"));
663 test::SetProfileInfo(&b, "John", NULL, NULL, NULL,
664 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
665 b.SetRawInfo(ADDRESS_HOME_STREET_ADDRESS,
666 ASCIIToUTF16("line one\nline two\nline three"));
667 EXPECT_GT(0, a.Compare(b));
668 EXPECT_LT(0, b.Compare(a));
657 } 669 }
658 670
659 TEST(AutofillProfileTest, MultiValueNames) { 671 TEST(AutofillProfileTest, MultiValueNames) {
660 AutofillProfile p(base::GenerateGUID(), "https://www.example.com/"); 672 AutofillProfile p(base::GenerateGUID(), "https://www.example.com/");
661 const base::string16 kJohnDoe(ASCIIToUTF16("John Doe")); 673 const base::string16 kJohnDoe(ASCIIToUTF16("John Doe"));
662 const base::string16 kJohnPDoe(ASCIIToUTF16("John P. Doe")); 674 const base::string16 kJohnPDoe(ASCIIToUTF16("John P. Doe"));
663 std::vector<base::string16> set_values; 675 std::vector<base::string16> set_values;
664 set_values.push_back(kJohnDoe); 676 set_values.push_back(kJohnDoe);
665 set_values.push_back(kJohnPDoe); 677 set_values.push_back(kJohnPDoe);
666 p.SetRawMultiInfo(NAME_FULL, set_values); 678 p.SetRawMultiInfo(NAME_FULL, set_values);
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 ASCIIToUTF16("CA"), 904 ASCIIToUTF16("CA"),
893 "en-US"); 905 "en-US");
894 EXPECT_FALSE(profile.GetInfo(full_address, "en-US").empty()); 906 EXPECT_FALSE(profile.GetInfo(full_address, "en-US").empty());
895 profile.SetInfo(AutofillType(ADDRESS_HOME_COUNTRY), 907 profile.SetInfo(AutofillType(ADDRESS_HOME_COUNTRY),
896 base::string16(), 908 base::string16(),
897 "en-US"); 909 "en-US");
898 EXPECT_TRUE(profile.GetInfo(full_address, "en-US").empty()); 910 EXPECT_TRUE(profile.GetInfo(full_address, "en-US").empty());
899 } 911 }
900 912
901 } // namespace autofill 913 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_profile.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698