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

Side by Side Diff: chrome/browser/autofill/autofill_profile_unittest.cc

Issue 6650014: Autofill extend profiles to include multi-valued fields, part 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nit Created 9 years, 9 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 | « chrome/browser/autofill/autofill_profile.cc ('k') | chrome/browser/autofill/autofill_type.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/scoped_ptr.h" 6 #include "base/scoped_ptr.h"
7 #include "base/scoped_vector.h" 7 #include "base/scoped_vector.h"
8 #include "base/stl_util-inl.h" 8 #include "base/stl_util-inl.h"
9 #include "base/string16.h" 9 #include "base/string16.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 "Hollywood", "CA", "91601", "US", "12345678910", 596 "Hollywood", "CA", "91601", "US", "12345678910",
597 "01987654321"); 597 "01987654321");
598 b = a; 598 b = a;
599 EXPECT_TRUE(a == b); 599 EXPECT_TRUE(a == b);
600 600
601 // Assignment to self should not change the profile value. 601 // Assignment to self should not change the profile value.
602 a = a; 602 a = a;
603 EXPECT_TRUE(a == b); 603 EXPECT_TRUE(a == b);
604 } 604 }
605 605
606 TEST(AutoFillProfileTest, Clone) { 606 TEST(AutoFillProfileTest, Copy) {
607 AutoFillProfile a; 607 AutoFillProfile a;
608 608
609 // Clone should be logically equal to the original. 609 // Clone should be logically equal to the original.
610 autofill_test::SetProfileInfo(&a, "Marion", "Mitchell", "Morrison", 610 autofill_test::SetProfileInfo(&a, "Marion", "Mitchell", "Morrison",
611 "marion@me.xyz", "Fox", "123 Zoo St.", "unit 5", 611 "marion@me.xyz", "Fox", "123 Zoo St.", "unit 5",
612 "Hollywood", "CA", "91601", "US", "12345678910", 612 "Hollywood", "CA", "91601", "US", "12345678910",
613 "01987654321"); 613 "01987654321");
614 scoped_ptr<AutoFillProfile> b(static_cast<AutoFillProfile*>(a.Clone())); 614 AutoFillProfile b(a);
615 EXPECT_TRUE(a == *b); 615 EXPECT_TRUE(a == b);
616 } 616 }
617 617
618 TEST(AutoFillProfileTest, Compare) { 618 TEST(AutoFillProfileTest, Compare) {
619 AutoFillProfile a, b; 619 AutoFillProfile a, b;
620 620
621 // Empty profiles are the same. 621 // Empty profiles are the same.
622 EXPECT_EQ(0, a.Compare(b)); 622 EXPECT_EQ(0, a.Compare(b));
623 623
624 // GUIDs don't count. 624 // GUIDs don't count.
625 a.set_guid(guid::GenerateGUID()); 625 a.set_guid(guid::GenerateGUID());
626 b.set_guid(guid::GenerateGUID()); 626 b.set_guid(guid::GenerateGUID());
627 EXPECT_EQ(0, a.Compare(b)); 627 EXPECT_EQ(0, a.Compare(b));
628 628
629 // Different values produce non-zero results. 629 // Different values produce non-zero results.
630 autofill_test::SetProfileInfo(&a, "Jimmy", NULL, NULL, NULL, 630 autofill_test::SetProfileInfo(&a, "Jimmy", NULL, NULL, NULL,
631 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); 631 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
632 autofill_test::SetProfileInfo(&b, "Ringo", NULL, NULL, NULL, 632 autofill_test::SetProfileInfo(&b, "Ringo", NULL, NULL, NULL,
633 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); 633 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
634 EXPECT_GT(0, a.Compare(b)); 634 EXPECT_GT(0, a.Compare(b));
635 EXPECT_LT(0, b.Compare(a)); 635 EXPECT_LT(0, b.Compare(a));
636 } 636 }
637 637
638 TEST(AutoFillProfileTest, CountryCode) { 638 TEST(AutoFillProfileTest, CountryCode) {
639 AutoFillProfile profile; 639 AutoFillProfile profile;
640 EXPECT_EQ(std::string(), profile.CountryCode()); 640 EXPECT_EQ(std::string(), profile.CountryCode());
641 641
642 profile.SetCountryCode("US"); 642 profile.SetCountryCode("US");
643 EXPECT_EQ("US", profile.CountryCode()); 643 EXPECT_EQ("US", profile.CountryCode());
644 } 644 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_profile.cc ('k') | chrome/browser/autofill/autofill_type.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698