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

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

Issue 6484022: Autofill i18n: Set postal code and state field labels based on the selected country. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Properly merged with ToT Created 9 years, 10 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 (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"
11 #include "chrome/browser/autofill/autofill_common_test.h" 11 #include "chrome/browser/autofill/autofill_common_test.h"
12 #include "chrome/browser/autofill/autofill_profile.h" 12 #include "chrome/browser/autofill/autofill_profile.h"
13 #include "chrome/common/guid.h" 13 #include "chrome/common/guid.h"
14 #include "grit/generated_resources.h" 14 #include "grit/generated_resources.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 namespace { 17 namespace {
18 18
19 bool UpdateProfileLabel(AutoFillProfile *profile) { 19 bool UpdateProfileLabel(AutoFillProfile *profile) {
20 std::vector<AutoFillProfile*> profiles; 20 std::vector<AutoFillProfile*> profiles;
21 profiles.push_back(profile); 21 profiles.push_back(profile);
22 return AutoFillProfile::AdjustInferredLabels(&profiles); 22 return AutoFillProfile::AdjustInferredLabels(&profiles);
23 } 23 }
24 24
25 } // namespace
26
25 // Tests different possibilities for summary string generation. 27 // Tests different possibilities for summary string generation.
26 // Based on existence of first name, last name, and address line 1. 28 // Based on existence of first name, last name, and address line 1.
27 TEST(AutoFillProfileTest, PreviewSummaryString) { 29 TEST(AutoFillProfileTest, PreviewSummaryString) {
28 // Case 0/null: "" 30 // Case 0/null: ""
29 AutoFillProfile profile0; 31 AutoFillProfile profile0;
30 // Empty profile - nothing to update. 32 // Empty profile - nothing to update.
31 EXPECT_FALSE(UpdateProfileLabel(&profile0)); 33 EXPECT_FALSE(UpdateProfileLabel(&profile0));
32 string16 summary0 = profile0.Label(); 34 string16 summary0 = profile0.Label();
33 EXPECT_EQ(string16(), summary0); 35 EXPECT_EQ(string16(), summary0);
34 36
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 628
627 // Different values produce non-zero results. 629 // Different values produce non-zero results.
628 autofill_test::SetProfileInfo(&a, "Jimmy", NULL, NULL, NULL, 630 autofill_test::SetProfileInfo(&a, "Jimmy", NULL, NULL, NULL,
629 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); 631 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
630 autofill_test::SetProfileInfo(&b, "Ringo", NULL, NULL, NULL, 632 autofill_test::SetProfileInfo(&b, "Ringo", NULL, NULL, NULL,
631 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); 633 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
632 EXPECT_GT(0, a.Compare(b)); 634 EXPECT_GT(0, a.Compare(b));
633 EXPECT_LT(0, b.Compare(a)); 635 EXPECT_LT(0, b.Compare(a));
634 } 636 }
635 637
636 } // namespace 638 TEST(AutoFillProfileTest, CountryCode) {
639 AutoFillProfile profile;
640 EXPECT_EQ(std::string(), profile.CountryCode());
641
642 profile.SetCountryCode("US");
643 EXPECT_EQ("US", profile.CountryCode());
644 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_profile.cc ('k') | chrome/browser/autofill/select_control_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698