OLD | NEW |
---|---|
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 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1172 form_structure()->field(1)->Type().GetStorableType()); | 1172 form_structure()->field(1)->Type().GetStorableType()); |
1173 EXPECT_EQ(PHONE_BILLING, form_structure()->field(1)->Type().group()); | 1173 EXPECT_EQ(PHONE_BILLING, form_structure()->field(1)->Type().group()); |
1174 EXPECT_EQ(shipping_profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER), | 1174 EXPECT_EQ(shipping_profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER), |
1175 form_structure()->field(0)->value); | 1175 form_structure()->field(0)->value); |
1176 EXPECT_EQ(billing_profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER), | 1176 EXPECT_EQ(billing_profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER), |
1177 form_structure()->field(1)->value); | 1177 form_structure()->field(1)->value); |
1178 EXPECT_NE(form_structure()->field(1)->value, | 1178 EXPECT_NE(form_structure()->field(1)->value, |
1179 form_structure()->field(0)->value); | 1179 form_structure()->field(0)->value); |
1180 } | 1180 } |
1181 | 1181 |
1182 // Similar to the above, but tests that street-address (i.e. all lines of the | |
1183 // street address) is successfully filled for both shipping and billing | |
1184 // sections. | |
1185 TEST_F(AutofillDialogControllerTest, BillingVsShippingStreetAddress) { | |
1186 FormFieldData shipping_address; | |
1187 shipping_address.autocomplete_attribute = "shipping street-address"; | |
1188 FormFieldData billing_address; | |
1189 billing_address.autocomplete_attribute = "billing street-address"; | |
1190 FormFieldData shipping_address_textarea; | |
1191 shipping_address.autocomplete_attribute = "shipping street-address"; | |
1192 shipping_address.form_control_type = "textarea"; | |
Ilya Sherman
2014/01/08 00:09:35
Hmm, did you mean these to be modifying shipping_a
Evan Stade
2014/01/08 22:16:56
ah yes, I did mean to. Good thing the tests didn't
| |
1193 FormFieldData billing_address_textarea; | |
1194 billing_address.autocomplete_attribute = "billing street-address"; | |
1195 billing_address.form_control_type = "textarea"; | |
Ilya Sherman
2014/01/08 00:09:35
Likewise, did you mean these to be modifying billi
Evan Stade
2014/01/08 22:16:56
Done.
| |
1196 | |
1197 FormData form_data; | |
1198 form_data.fields.push_back(shipping_address); | |
1199 form_data.fields.push_back(billing_address); | |
1200 form_data.fields.push_back(shipping_address_textarea); | |
1201 form_data.fields.push_back(billing_address_textarea); | |
1202 SetUpControllerWithFormData(form_data); | |
1203 | |
1204 SwitchToAutofill(); | |
1205 | |
1206 // The profile that will be chosen for the shipping section. | |
1207 AutofillProfile shipping_profile(test::GetVerifiedProfile()); | |
1208 // The profile that will be chosen for the billing section. | |
1209 AutofillProfile billing_profile(test::GetVerifiedProfile2()); | |
1210 CreditCard credit_card(test::GetVerifiedCreditCard()); | |
1211 controller()->GetTestingManager()->AddTestingProfile(&shipping_profile); | |
1212 controller()->GetTestingManager()->AddTestingProfile(&billing_profile); | |
1213 controller()->GetTestingManager()->AddTestingCreditCard(&credit_card); | |
1214 ui::MenuModel* billing_model = | |
1215 controller()->MenuModelForSection(SECTION_BILLING); | |
1216 billing_model->ActivatedAt(1); | |
1217 | |
1218 controller()->OnAccept(); | |
1219 ASSERT_EQ(4U, form_structure()->field_count()); | |
1220 EXPECT_EQ(ADDRESS_HOME_STREET_ADDRESS, | |
1221 form_structure()->field(0)->Type().GetStorableType()); | |
Ilya Sherman
2014/01/08 00:09:35
Why do you check this for fields 0 and 1, but not
Evan Stade
2014/01/08 22:16:56
Because that would be redundant, imo. That should
| |
1222 EXPECT_EQ(ADDRESS_HOME, form_structure()->field(0)->Type().group()); | |
1223 EXPECT_EQ(ADDRESS_HOME_STREET_ADDRESS, | |
1224 form_structure()->field(1)->Type().GetStorableType()); | |
1225 EXPECT_EQ(ADDRESS_BILLING, form_structure()->field(1)->Type().group()); | |
1226 // Inexact matching; single-line inputs get the address data concatenated but | |
1227 // separated by commas. | |
1228 EXPECT_TRUE(StartsWith(form_structure()->field(0)->value, | |
1229 shipping_profile.GetRawInfo(ADDRESS_HOME_LINE1), | |
1230 true)); | |
1231 EXPECT_TRUE(EndsWith(form_structure()->field(0)->value, | |
1232 shipping_profile.GetRawInfo(ADDRESS_HOME_LINE2), | |
1233 true)); | |
1234 EXPECT_TRUE(StartsWith(form_structure()->field(1)->value, | |
1235 billing_profile.GetRawInfo(ADDRESS_HOME_LINE1), | |
1236 true)); | |
1237 EXPECT_TRUE(EndsWith(form_structure()->field(1)->value, | |
1238 billing_profile.GetRawInfo(ADDRESS_HOME_LINE2), | |
1239 true)); | |
1240 // The textareas should be an exact match. | |
1241 EXPECT_EQ(shipping_profile.GetRawInfo(ADDRESS_HOME_STREET_ADDRESS), | |
1242 form_structure()->field(2)->value); | |
1243 EXPECT_EQ(billing_profile.GetRawInfo(ADDRESS_HOME_STREET_ADDRESS), | |
1244 form_structure()->field(3)->value); | |
1245 | |
1246 EXPECT_NE(form_structure()->field(1)->value, | |
1247 form_structure()->field(0)->value); | |
1248 EXPECT_NE(form_structure()->field(3)->value, | |
1249 form_structure()->field(2)->value); | |
1250 } | |
1251 | |
1182 TEST_F(AutofillDialogControllerTest, AcceptLegalDocuments) { | 1252 TEST_F(AutofillDialogControllerTest, AcceptLegalDocuments) { |
1183 for (size_t i = 0; i < 2; ++i) { | 1253 for (size_t i = 0; i < 2; ++i) { |
1184 SCOPED_TRACE(testing::Message() << "Case " << i); | 1254 SCOPED_TRACE(testing::Message() << "Case " << i); |
1185 | 1255 |
1186 EXPECT_CALL(*controller()->GetTestingWalletClient(), | 1256 EXPECT_CALL(*controller()->GetTestingWalletClient(), |
1187 AcceptLegalDocuments(_, _)); | 1257 AcceptLegalDocuments(_, _)); |
1188 EXPECT_CALL(*controller()->GetTestingWalletClient(), GetFullWallet(_)); | 1258 EXPECT_CALL(*controller()->GetTestingWalletClient(), GetFullWallet(_)); |
1189 EXPECT_CALL(*controller(), LoadRiskFingerprintData()); | 1259 EXPECT_CALL(*controller(), LoadRiskFingerprintData()); |
1190 | 1260 |
1191 EXPECT_TRUE(controller()->LegalDocumentLinks().empty()); | 1261 EXPECT_TRUE(controller()->LegalDocumentLinks().empty()); |
(...skipping 1571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2763 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 2833 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
2764 for (size_t i = 0; i < arraysize(kSupportedCardIdrs); ++i) { | 2834 for (size_t i = 0; i < arraysize(kSupportedCardIdrs); ++i) { |
2765 SCOPED_TRACE(base::IntToString(i)); | 2835 SCOPED_TRACE(base::IntToString(i)); |
2766 gfx::Image supported_card_icon = rb.GetImageNamed(kSupportedCardIdrs[i]); | 2836 gfx::Image supported_card_icon = rb.GetImageNamed(kSupportedCardIdrs[i]); |
2767 EXPECT_GE(placeholder_icon.Width(), supported_card_icon.Width()); | 2837 EXPECT_GE(placeholder_icon.Width(), supported_card_icon.Width()); |
2768 EXPECT_GE(placeholder_icon.Height(), supported_card_icon.Height()); | 2838 EXPECT_GE(placeholder_icon.Height(), supported_card_icon.Height()); |
2769 } | 2839 } |
2770 } | 2840 } |
2771 | 2841 |
2772 } // namespace autofill | 2842 } // namespace autofill |
OLD | NEW |