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

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

Issue 11635039: [Autofill] Update unit tests to use country codes when setting raw address info. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/string16.h" 10 #include "base/string16.h"
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 for (size_t i = 0; i < arraysize(kCountries); ++i) { 751 for (size_t i = 0; i < arraysize(kCountries); ++i) {
752 options[i] = ASCIIToUTF16(kCountries[i]); 752 options[i] = ASCIIToUTF16(kCountries[i]);
753 } 753 }
754 754
755 FormFieldData field; 755 FormFieldData field;
756 field.form_control_type = "select-one"; 756 field.form_control_type = "select-one";
757 field.option_values = options; 757 field.option_values = options;
758 field.option_contents = options; 758 field.option_contents = options;
759 759
760 AutofillProfile profile; 760 AutofillProfile profile;
761 profile.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("Canada")); 761 profile.SetInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("Canada"), "en-US");
762 profile.FillSelectControl(ADDRESS_HOME_COUNTRY, &field); 762 profile.FillSelectControl(ADDRESS_HOME_COUNTRY, &field);
763 EXPECT_EQ(ASCIIToUTF16("CA"), field.value); 763 EXPECT_EQ(ASCIIToUTF16("CA"), field.value);
764 } 764 }
765 765
766 TEST(AutofillProfileTest, AddressStateFull) { 766 TEST(AutofillProfileTest, AddressStateFull) {
767 const char* const kStates[] = { 767 const char* const kStates[] = {
768 "Alabama", "California" 768 "Alabama", "California"
769 }; 769 };
770 std::vector<string16> options(arraysize(kStates)); 770 std::vector<string16> options(arraysize(kStates));
771 for (size_t i = 0; i < arraysize(kStates); ++i) { 771 for (size_t i = 0; i < arraysize(kStates); ++i) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 FormFieldData field; 839 FormFieldData field;
840 field.form_control_type = "select-one"; 840 field.form_control_type = "select-one";
841 field.option_values = values; 841 field.option_values = values;
842 field.option_contents = contents; 842 field.option_contents = contents;
843 843
844 AutofillProfile profile; 844 AutofillProfile profile;
845 profile.SetRawInfo(ADDRESS_HOME_STATE, ASCIIToUTF16("California")); 845 profile.SetRawInfo(ADDRESS_HOME_STATE, ASCIIToUTF16("California"));
846 profile.FillSelectControl(ADDRESS_HOME_STATE, &field); 846 profile.FillSelectControl(ADDRESS_HOME_STATE, &field);
847 EXPECT_EQ(ASCIIToUTF16("2"), field.value); 847 EXPECT_EQ(ASCIIToUTF16("2"), field.value);
848 } 848 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_metrics_unittest.cc ('k') | chrome/browser/autofill/personal_data_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698