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

Side by Side Diff: chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc

Issue 111853012: rAc: support street-address. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix assignments Created 6 years, 11 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) 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 <map> 5 #include <map>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/guid.h" 9 #include "base/guid.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 form_structure()->field(1)->Type().GetStorableType()); 1201 form_structure()->field(1)->Type().GetStorableType());
1202 EXPECT_EQ(PHONE_BILLING, form_structure()->field(1)->Type().group()); 1202 EXPECT_EQ(PHONE_BILLING, form_structure()->field(1)->Type().group());
1203 EXPECT_EQ(shipping_profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER), 1203 EXPECT_EQ(shipping_profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER),
1204 form_structure()->field(0)->value); 1204 form_structure()->field(0)->value);
1205 EXPECT_EQ(billing_profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER), 1205 EXPECT_EQ(billing_profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER),
1206 form_structure()->field(1)->value); 1206 form_structure()->field(1)->value);
1207 EXPECT_NE(form_structure()->field(1)->value, 1207 EXPECT_NE(form_structure()->field(1)->value,
1208 form_structure()->field(0)->value); 1208 form_structure()->field(0)->value);
1209 } 1209 }
1210 1210
1211 // Similar to the above, but tests that street-address (i.e. all lines of the
1212 // street address) is successfully filled for both shipping and billing
1213 // sections.
1214 TEST_F(AutofillDialogControllerTest, BillingVsShippingStreetAddress) {
1215 FormFieldData shipping_address;
1216 shipping_address.autocomplete_attribute = "shipping street-address";
1217 FormFieldData billing_address;
1218 billing_address.autocomplete_attribute = "billing street-address";
1219 FormFieldData shipping_address_textarea;
1220 shipping_address_textarea.autocomplete_attribute = "shipping street-address";
1221 shipping_address_textarea.form_control_type = "textarea";
1222 FormFieldData billing_address_textarea;
1223 billing_address_textarea.autocomplete_attribute = "billing street-address";
1224 billing_address_textarea.form_control_type = "textarea";
1225
1226 FormData form_data;
1227 form_data.fields.push_back(shipping_address);
1228 form_data.fields.push_back(billing_address);
1229 form_data.fields.push_back(shipping_address_textarea);
1230 form_data.fields.push_back(billing_address_textarea);
1231 SetUpControllerWithFormData(form_data);
1232
1233 SwitchToAutofill();
1234
1235 // The profile that will be chosen for the shipping section.
1236 AutofillProfile shipping_profile(test::GetVerifiedProfile());
1237 // The profile that will be chosen for the billing section.
1238 AutofillProfile billing_profile(test::GetVerifiedProfile2());
1239 CreditCard credit_card(test::GetVerifiedCreditCard());
1240 controller()->GetTestingManager()->AddTestingProfile(&shipping_profile);
1241 controller()->GetTestingManager()->AddTestingProfile(&billing_profile);
1242 controller()->GetTestingManager()->AddTestingCreditCard(&credit_card);
1243 ui::MenuModel* billing_model =
1244 controller()->MenuModelForSection(SECTION_BILLING);
1245 billing_model->ActivatedAt(1);
1246
1247 controller()->OnAccept();
1248 ASSERT_EQ(4U, form_structure()->field_count());
1249 EXPECT_EQ(ADDRESS_HOME_STREET_ADDRESS,
1250 form_structure()->field(0)->Type().GetStorableType());
1251 EXPECT_EQ(ADDRESS_HOME, form_structure()->field(0)->Type().group());
1252 EXPECT_EQ(ADDRESS_HOME_STREET_ADDRESS,
1253 form_structure()->field(1)->Type().GetStorableType());
1254 EXPECT_EQ(ADDRESS_BILLING, form_structure()->field(1)->Type().group());
1255 // Inexact matching; single-line inputs get the address data concatenated but
1256 // separated by commas.
1257 EXPECT_TRUE(StartsWith(form_structure()->field(0)->value,
1258 shipping_profile.GetRawInfo(ADDRESS_HOME_LINE1),
1259 true));
1260 EXPECT_TRUE(EndsWith(form_structure()->field(0)->value,
1261 shipping_profile.GetRawInfo(ADDRESS_HOME_LINE2),
1262 true));
1263 EXPECT_TRUE(StartsWith(form_structure()->field(1)->value,
1264 billing_profile.GetRawInfo(ADDRESS_HOME_LINE1),
1265 true));
1266 EXPECT_TRUE(EndsWith(form_structure()->field(1)->value,
1267 billing_profile.GetRawInfo(ADDRESS_HOME_LINE2),
1268 true));
1269 // The textareas should be an exact match.
1270 EXPECT_EQ(shipping_profile.GetRawInfo(ADDRESS_HOME_STREET_ADDRESS),
1271 form_structure()->field(2)->value);
1272 EXPECT_EQ(billing_profile.GetRawInfo(ADDRESS_HOME_STREET_ADDRESS),
1273 form_structure()->field(3)->value);
1274
1275 EXPECT_NE(form_structure()->field(1)->value,
1276 form_structure()->field(0)->value);
1277 EXPECT_NE(form_structure()->field(3)->value,
1278 form_structure()->field(2)->value);
1279 }
1280
1211 TEST_F(AutofillDialogControllerTest, AcceptLegalDocuments) { 1281 TEST_F(AutofillDialogControllerTest, AcceptLegalDocuments) {
1212 for (size_t i = 0; i < 2; ++i) { 1282 for (size_t i = 0; i < 2; ++i) {
1213 SCOPED_TRACE(testing::Message() << "Case " << i); 1283 SCOPED_TRACE(testing::Message() << "Case " << i);
1214 1284
1215 EXPECT_CALL(*controller()->GetTestingWalletClient(), 1285 EXPECT_CALL(*controller()->GetTestingWalletClient(),
1216 AcceptLegalDocuments(_, _)); 1286 AcceptLegalDocuments(_, _));
1217 EXPECT_CALL(*controller()->GetTestingWalletClient(), GetFullWallet(_)); 1287 EXPECT_CALL(*controller()->GetTestingWalletClient(), GetFullWallet(_));
1218 EXPECT_CALL(*controller(), LoadRiskFingerprintData()); 1288 EXPECT_CALL(*controller(), LoadRiskFingerprintData());
1219 1289
1220 EXPECT_TRUE(controller()->LegalDocumentLinks().empty()); 1290 EXPECT_TRUE(controller()->LegalDocumentLinks().empty());
(...skipping 1571 matching lines...) Expand 10 before | Expand all | Expand 10 after
2792 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 2862 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
2793 for (size_t i = 0; i < arraysize(kSupportedCardIdrs); ++i) { 2863 for (size_t i = 0; i < arraysize(kSupportedCardIdrs); ++i) {
2794 SCOPED_TRACE(base::IntToString(i)); 2864 SCOPED_TRACE(base::IntToString(i));
2795 gfx::Image supported_card_icon = rb.GetImageNamed(kSupportedCardIdrs[i]); 2865 gfx::Image supported_card_icon = rb.GetImageNamed(kSupportedCardIdrs[i]);
2796 EXPECT_GE(placeholder_icon.Width(), supported_card_icon.Width()); 2866 EXPECT_GE(placeholder_icon.Width(), supported_card_icon.Width());
2797 EXPECT_GE(placeholder_icon.Height(), supported_card_icon.Height()); 2867 EXPECT_GE(placeholder_icon.Height(), supported_card_icon.Height());
2798 } 2868 }
2799 } 2869 }
2800 2870
2801 } // namespace autofill 2871 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/ui/autofill/autofill_dialog_common.cc ('k') | components/autofill/content/browser/wallet/wallet_address.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698