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

Side by Side Diff: chrome/browser/autofill/autofill_address_model_mac_unittest.mm

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
« no previous file with comments | « chrome/browser/autofill/address_unittest.cc ('k') | chrome/browser/autofill/autofill_country.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/scoped_nsobject.h" 5 #include "base/scoped_nsobject.h"
6 #include "base/utf_string_conversions.h" 6 #include "base/utf_string_conversions.h"
7 #import "chrome/browser/autofill/autofill_address_model_mac.h" 7 #import "chrome/browser/autofill/autofill_address_model_mac.h"
8 #include "chrome/browser/autofill/autofill_common_test.h" 8 #include "chrome/browser/autofill/autofill_common_test.h"
9 #include "chrome/browser/autofill/autofill_profile.h" 9 #include "chrome/browser/autofill/autofill_profile.h"
10 #include "chrome/browser/ui/cocoa/browser_test_helper.h" 10 #include "chrome/browser/ui/cocoa/browser_test_helper.h"
(...skipping 19 matching lines...) Expand all
30 &profile, 30 &profile,
31 "Marion", 31 "Marion",
32 "Mitchell", 32 "Mitchell",
33 "Morrison", 33 "Morrison",
34 "johnwayne@me.xyz", 34 "johnwayne@me.xyz",
35 "Fox", 35 "Fox",
36 "123 Zoo St.", 36 "123 Zoo St.",
37 "unit 5", 37 "unit 5",
38 "Hollywood", "CA", 38 "Hollywood", "CA",
39 "91601", 39 "91601",
40 "US", 40 "United States",
41 "12345678910", 41 "12345678910",
42 "01987654321"); 42 "01987654321");
43 scoped_nsobject<AutoFillAddressModel> model([[AutoFillAddressModel alloc] 43 scoped_nsobject<AutoFillAddressModel> model([[AutoFillAddressModel alloc]
44 initWithProfile:profile]); 44 initWithProfile:profile]);
45 EXPECT_TRUE(model.get()); 45 EXPECT_TRUE(model.get());
46 46
47 EXPECT_TRUE([[model fullName] isEqualToString:@"Marion Mitchell Morrison"]); 47 EXPECT_TRUE([[model fullName] isEqualToString:@"Marion Mitchell Morrison"]);
48 EXPECT_TRUE([[model email] isEqualToString:@"johnwayne@me.xyz"]); 48 EXPECT_TRUE([[model email] isEqualToString:@"johnwayne@me.xyz"]);
49 EXPECT_TRUE([[model companyName] isEqualToString:@"Fox"]); 49 EXPECT_TRUE([[model companyName] isEqualToString:@"Fox"]);
50 EXPECT_TRUE([[model addressLine1] isEqualToString:@"123 Zoo St."]); 50 EXPECT_TRUE([[model addressLine1] isEqualToString:@"123 Zoo St."]);
51 EXPECT_TRUE([[model addressLine2] isEqualToString:@"unit 5"]); 51 EXPECT_TRUE([[model addressLine2] isEqualToString:@"unit 5"]);
52 EXPECT_TRUE([[model addressCity] isEqualToString:@"Hollywood"]); 52 EXPECT_TRUE([[model addressCity] isEqualToString:@"Hollywood"]);
53 EXPECT_TRUE([[model addressState] isEqualToString:@"CA"]); 53 EXPECT_TRUE([[model addressState] isEqualToString:@"CA"]);
54 EXPECT_TRUE([[model addressZip] isEqualToString:@"91601"]); 54 EXPECT_TRUE([[model addressZip] isEqualToString:@"91601"]);
55 EXPECT_TRUE([[model addressCountry] isEqualToString:@"US"]); 55 EXPECT_TRUE([[model addressCountry] isEqualToString:@"United States"]);
56 EXPECT_TRUE([[model phoneWholeNumber] isEqualToString:@"12345678910"]); 56 EXPECT_TRUE([[model phoneWholeNumber] isEqualToString:@"12345678910"]);
57 EXPECT_TRUE([[model faxWholeNumber] isEqualToString:@"01987654321"]); 57 EXPECT_TRUE([[model faxWholeNumber] isEqualToString:@"01987654321"]);
58 } 58 }
59 59
60 TEST(AutoFillAddressModelTest, CopyModelToProfile) { 60 TEST(AutoFillAddressModelTest, CopyModelToProfile) {
61 AutoFillProfile profile; 61 AutoFillProfile profile;
62 autofill_test::SetProfileInfo( 62 autofill_test::SetProfileInfo(
63 &profile, 63 &profile,
64 "Marion", 64 "Marion",
65 "Mitchell", 65 "Mitchell",
66 "Morrison", 66 "Morrison",
67 "johnwayne@me.xyz", 67 "johnwayne@me.xyz",
68 "Fox", 68 "Fox",
69 "123 Zoo St.", 69 "123 Zoo St.",
70 "unit 5", 70 "unit 5",
71 "Hollywood", "CA", 71 "Hollywood", "CA",
72 "91601", 72 "91601",
73 "US", 73 "United States",
74 "12345678910", 74 "12345678910",
75 "01987654321"); 75 "01987654321");
76 scoped_nsobject<AutoFillAddressModel> model([[AutoFillAddressModel alloc] 76 scoped_nsobject<AutoFillAddressModel> model([[AutoFillAddressModel alloc]
77 initWithProfile:profile]); 77 initWithProfile:profile]);
78 EXPECT_TRUE(model.get()); 78 EXPECT_TRUE(model.get());
79 79
80 [model setFullName:@"MarionX MitchellX MorrisonX"]; 80 [model setFullName:@"MarionX MitchellX MorrisonX"];
81 [model setEmail:@"trigger@me.xyz"]; 81 [model setEmail:@"trigger@me.xyz"];
82 [model setCompanyName:@"FoxX"]; 82 [model setCompanyName:@"FoxX"];
83 [model setAddressLine1:@"123 Xoo St."]; 83 [model setAddressLine1:@"123 Xoo St."];
84 [model setAddressLine2:@"unit 5X"]; 84 [model setAddressLine2:@"unit 5X"];
85 [model setAddressCity:@"Seattle"]; 85 [model setAddressCity:@"Seattle"];
86 [model setAddressState:@"WA"]; 86 [model setAddressState:@"WA"];
87 [model setAddressZip:@"81601"]; 87 [model setAddressZip:@"81601"];
88 [model setAddressCountry:@"CA"]; 88 [model setAddressCountry:@"Canada"];
89 [model setPhoneWholeNumber:@"23346678910"]; 89 [model setPhoneWholeNumber:@"23346678910"];
90 [model setFaxWholeNumber:@"12988654321"]; 90 [model setFaxWholeNumber:@"12988654321"];
91 91
92 [model copyModelToProfile:&profile]; 92 [model copyModelToProfile:&profile];
93 93
94 EXPECT_EQ(ASCIIToUTF16("MarionX"), 94 EXPECT_EQ(ASCIIToUTF16("MarionX"),
95 profile.GetFieldText(AutoFillType(NAME_FIRST))); 95 profile.GetFieldText(AutoFillType(NAME_FIRST)));
96 EXPECT_EQ(ASCIIToUTF16("MitchellX"), 96 EXPECT_EQ(ASCIIToUTF16("MitchellX"),
97 profile.GetFieldText(AutoFillType(NAME_MIDDLE))); 97 profile.GetFieldText(AutoFillType(NAME_MIDDLE)));
98 EXPECT_EQ(ASCIIToUTF16("MorrisonX"), 98 EXPECT_EQ(ASCIIToUTF16("MorrisonX"),
99 profile.GetFieldText(AutoFillType(NAME_LAST))); 99 profile.GetFieldText(AutoFillType(NAME_LAST)));
100 EXPECT_EQ(ASCIIToUTF16("MarionX MitchellX MorrisonX"), 100 EXPECT_EQ(ASCIIToUTF16("MarionX MitchellX MorrisonX"),
101 profile.GetFieldText(AutoFillType(NAME_FULL))); 101 profile.GetFieldText(AutoFillType(NAME_FULL)));
102 EXPECT_EQ(ASCIIToUTF16("trigger@me.xyz"), 102 EXPECT_EQ(ASCIIToUTF16("trigger@me.xyz"),
103 profile.GetFieldText(AutoFillType(EMAIL_ADDRESS))); 103 profile.GetFieldText(AutoFillType(EMAIL_ADDRESS)));
104 EXPECT_EQ(ASCIIToUTF16("FoxX"), 104 EXPECT_EQ(ASCIIToUTF16("FoxX"),
105 profile.GetFieldText(AutoFillType(COMPANY_NAME))); 105 profile.GetFieldText(AutoFillType(COMPANY_NAME)));
106 EXPECT_EQ(ASCIIToUTF16("123 Xoo St."), 106 EXPECT_EQ(ASCIIToUTF16("123 Xoo St."),
107 profile.GetFieldText(AutoFillType(ADDRESS_HOME_LINE1))); 107 profile.GetFieldText(AutoFillType(ADDRESS_HOME_LINE1)));
108 EXPECT_EQ(ASCIIToUTF16("unit 5X"), 108 EXPECT_EQ(ASCIIToUTF16("unit 5X"),
109 profile.GetFieldText(AutoFillType(ADDRESS_HOME_LINE2))); 109 profile.GetFieldText(AutoFillType(ADDRESS_HOME_LINE2)));
110 EXPECT_EQ(ASCIIToUTF16("Seattle"), 110 EXPECT_EQ(ASCIIToUTF16("Seattle"),
111 profile.GetFieldText(AutoFillType(ADDRESS_HOME_CITY))); 111 profile.GetFieldText(AutoFillType(ADDRESS_HOME_CITY)));
112 EXPECT_EQ(ASCIIToUTF16("WA"), 112 EXPECT_EQ(ASCIIToUTF16("WA"),
113 profile.GetFieldText(AutoFillType(ADDRESS_HOME_STATE))); 113 profile.GetFieldText(AutoFillType(ADDRESS_HOME_STATE)));
114 EXPECT_EQ(ASCIIToUTF16("81601"), 114 EXPECT_EQ(ASCIIToUTF16("81601"),
115 profile.GetFieldText(AutoFillType(ADDRESS_HOME_ZIP))); 115 profile.GetFieldText(AutoFillType(ADDRESS_HOME_ZIP)));
116 EXPECT_EQ(ASCIIToUTF16("CA"), 116 EXPECT_EQ(ASCIIToUTF16("Canada"),
117 profile.GetFieldText(AutoFillType(ADDRESS_HOME_COUNTRY))); 117 profile.GetFieldText(AutoFillType(ADDRESS_HOME_COUNTRY)));
118 EXPECT_EQ(ASCIIToUTF16("23346678910"), 118 EXPECT_EQ(ASCIIToUTF16("23346678910"),
119 profile.GetFieldText(AutoFillType(PHONE_HOME_WHOLE_NUMBER))); 119 profile.GetFieldText(AutoFillType(PHONE_HOME_WHOLE_NUMBER)));
120 EXPECT_EQ(ASCIIToUTF16("12988654321"), 120 EXPECT_EQ(ASCIIToUTF16("12988654321"),
121 profile.GetFieldText(AutoFillType(PHONE_FAX_WHOLE_NUMBER))); 121 profile.GetFieldText(AutoFillType(PHONE_FAX_WHOLE_NUMBER)));
122 } 122 }
123 123
124 } // namespace 124 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/autofill/address_unittest.cc ('k') | chrome/browser/autofill/autofill_country.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698