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 #include <utility> | |
6 | 7 |
8 #include "base/basictypes.h" | |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 11 #include "base/callback.h" |
10 #include "base/command_line.h" | 12 #include "base/command_line.h" |
11 #include "base/guid.h" | 13 #include "base/guid.h" |
12 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
13 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
14 #include "base/prefs/pref_service.h" | 16 #include "base/prefs/pref_service.h" |
15 #include "base/run_loop.h" | 17 #include "base/run_loop.h" |
16 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
(...skipping 30 matching lines...) Expand all Loading... | |
47 #include "components/autofill/core/common/autofill_switches.h" | 49 #include "components/autofill/core/common/autofill_switches.h" |
48 #include "components/autofill/core/common/form_data.h" | 50 #include "components/autofill/core/common/form_data.h" |
49 #include "components/user_prefs/user_prefs.h" | 51 #include "components/user_prefs/user_prefs.h" |
50 #include "content/public/browser/web_contents.h" | 52 #include "content/public/browser/web_contents.h" |
51 #include "content/public/test/mock_render_process_host.h" | 53 #include "content/public/test/mock_render_process_host.h" |
52 #include "google_apis/gaia/google_service_auth_error.h" | 54 #include "google_apis/gaia/google_service_auth_error.h" |
53 #include "grit/component_scaled_resources.h" | 55 #include "grit/component_scaled_resources.h" |
54 #include "grit/generated_resources.h" | 56 #include "grit/generated_resources.h" |
55 #include "testing/gmock/include/gmock/gmock.h" | 57 #include "testing/gmock/include/gmock/gmock.h" |
56 #include "testing/gtest/include/gtest/gtest.h" | 58 #include "testing/gtest/include/gtest/gtest.h" |
57 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/addre ss_data.h" | 59 #include "third_party/libaddressinput/chromium/preload_address_validator.h" |
58 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/addre ss_validator.h" | 60 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_fi eld.h" |
61 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_pr oblem.h" | |
62 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_va lidator.h" | |
59 #include "ui/base/resource/resource_bundle.h" | 63 #include "ui/base/resource/resource_bundle.h" |
60 | 64 |
61 #if defined(OS_WIN) | 65 #if defined(OS_WIN) |
62 #include "ui/base/win/scoped_ole_initializer.h" | 66 #include "ui/base/win/scoped_ole_initializer.h" |
63 #endif | 67 #endif |
64 | 68 |
65 using base::ASCIIToUTF16; | 69 using base::ASCIIToUTF16; |
66 using base::UTF8ToUTF16; | 70 using base::UTF8ToUTF16; |
67 | 71 |
68 namespace autofill { | 72 namespace autofill { |
69 | 73 |
70 namespace { | 74 namespace { |
71 | 75 |
72 using ::i18n::addressinput::AddressData; | 76 using ::i18n::addressinput::FieldProblemMap; |
73 using ::i18n::addressinput::AddressProblemFilter; | |
74 using ::i18n::addressinput::AddressProblem; | |
75 using ::i18n::addressinput::AddressProblems; | |
76 using ::i18n::addressinput::AddressValidator; | |
77 using testing::AtLeast; | 77 using testing::AtLeast; |
78 using testing::DoAll; | 78 using testing::DoAll; |
79 using testing::Return; | 79 using testing::Return; |
80 using testing::SetArgPointee; | 80 using testing::SetArgPointee; |
81 using testing::_; | 81 using testing::_; |
82 | 82 |
83 const char kSourceUrl[] = "http://localbike.shop"; | 83 const char kSourceUrl[] = "http://localbike.shop"; |
84 const char kFakeEmail[] = "user@chromium.org"; | 84 const char kFakeEmail[] = "user@chromium.org"; |
85 const char kFakeFingerprintEncoded[] = "CgVaAwiACA=="; | 85 const char kFakeFingerprintEncoded[] = "CgVaAwiACA=="; |
86 const char kEditedBillingAddress[] = "123 edited billing address"; | 86 const char kEditedBillingAddress[] = "123 edited billing address"; |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
336 using AutofillDialogControllerImpl::NOT_CHECKED; | 336 using AutofillDialogControllerImpl::NOT_CHECKED; |
337 using AutofillDialogControllerImpl::popup_input_type; | 337 using AutofillDialogControllerImpl::popup_input_type; |
338 using AutofillDialogControllerImpl::SignedInState; | 338 using AutofillDialogControllerImpl::SignedInState; |
339 | 339 |
340 protected: | 340 protected: |
341 virtual PersonalDataManager* GetManager() const OVERRIDE { | 341 virtual PersonalDataManager* GetManager() const OVERRIDE { |
342 return const_cast<TestAutofillDialogController*>(this)-> | 342 return const_cast<TestAutofillDialogController*>(this)-> |
343 GetTestingManager(); | 343 GetTestingManager(); |
344 } | 344 } |
345 | 345 |
346 virtual AddressValidator* GetValidator() OVERRIDE { | 346 virtual PreloadAddressValidator* GetValidator() OVERRIDE { |
347 return &mock_validator_; | 347 return &mock_validator_; |
348 } | 348 } |
349 | 349 |
350 virtual wallet::WalletClient* GetWalletClient() OVERRIDE { | 350 virtual wallet::WalletClient* GetWalletClient() OVERRIDE { |
351 return &mock_wallet_client_; | 351 return &mock_wallet_client_; |
352 } | 352 } |
353 | 353 |
354 virtual void OpenTabWithUrl(const GURL& url) OVERRIDE { | 354 virtual void OpenTabWithUrl(const GURL& url) OVERRIDE { |
355 open_tab_url_ = url; | 355 open_tab_url_ = url; |
356 } | 356 } |
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1001 | 1001 |
1002 AutofillProfile verified_profile(test::GetVerifiedProfile()); | 1002 AutofillProfile verified_profile(test::GetVerifiedProfile()); |
1003 controller()->GetTestingManager()->AddTestingProfile(&verified_profile); | 1003 controller()->GetTestingManager()->AddTestingProfile(&verified_profile); |
1004 EXPECT_EQ(4, shipping_model->GetItemCount()); | 1004 EXPECT_EQ(4, shipping_model->GetItemCount()); |
1005 EXPECT_FALSE(controller()->IsManuallyEditingSection(SECTION_SHIPPING)); | 1005 EXPECT_FALSE(controller()->IsManuallyEditingSection(SECTION_SHIPPING)); |
1006 EXPECT_FALSE(controller()->IsManuallyEditingSection(SECTION_BILLING)); | 1006 EXPECT_FALSE(controller()->IsManuallyEditingSection(SECTION_BILLING)); |
1007 | 1007 |
1008 // Now make up a problem and make sure the profile isn't in the list. | 1008 // Now make up a problem and make sure the profile isn't in the list. |
1009 Reset(); | 1009 Reset(); |
1010 SwitchToAutofill(); | 1010 SwitchToAutofill(); |
1011 AddressProblems problems; | 1011 FieldProblemMap problems; |
1012 problems.push_back( | 1012 problems.insert(std::make_pair(::i18n::addressinput::POSTAL_CODE, |
1013 AddressProblem(::i18n::addressinput::POSTAL_CODE, | 1013 ::i18n::addressinput::MISMATCHING_VALUE)); |
1014 AddressProblem::MISMATCHING_VALUE, | |
1015 IDS_LEARN_MORE)); | |
1016 EXPECT_CALL(*controller()->GetMockValidator(), | 1014 EXPECT_CALL(*controller()->GetMockValidator(), |
1017 ValidateAddress(CountryCodeMatcher("US"), _, _)). | 1015 Validate(CountryCodeMatcher("US"), _, _)). |
1018 WillRepeatedly(DoAll(SetArgPointee<2>(problems), | 1016 WillRepeatedly(DoAll(SetArgPointee<2>(problems), |
1019 Return(AddressValidator::SUCCESS))); | 1017 Return(PreloadAddressValidator::SUCCESS))); |
1020 | 1018 |
1021 controller()->GetTestingManager()->AddTestingProfile(&verified_profile); | 1019 controller()->GetTestingManager()->AddTestingProfile(&verified_profile); |
1022 shipping_model = GetMenuModelForSection(SECTION_SHIPPING); | 1020 shipping_model = GetMenuModelForSection(SECTION_SHIPPING); |
1023 EXPECT_EQ(4, shipping_model->GetItemCount()); | 1021 EXPECT_EQ(4, shipping_model->GetItemCount()); |
1024 EXPECT_TRUE(controller()->IsManuallyEditingSection(SECTION_SHIPPING)); | 1022 EXPECT_TRUE(controller()->IsManuallyEditingSection(SECTION_SHIPPING)); |
1025 EXPECT_TRUE(controller()->IsManuallyEditingSection(SECTION_BILLING)); | 1023 EXPECT_TRUE(controller()->IsManuallyEditingSection(SECTION_BILLING)); |
1026 } | 1024 } |
1027 | 1025 |
1028 // Makes sure suggestion profiles are re-validated when validation rules load. | 1026 // Makes sure suggestion profiles are re-validated when validation rules load. |
1029 TEST_F(AutofillDialogControllerTest, AutofillProfilesRevalidateAfterRulesLoad) { | 1027 TEST_F(AutofillDialogControllerTest, AutofillProfilesRevalidateAfterRulesLoad) { |
1030 SwitchToAutofill(); | 1028 SwitchToAutofill(); |
1031 SuggestionsMenuModel* shipping_model = | 1029 SuggestionsMenuModel* shipping_model = |
1032 GetMenuModelForSection(SECTION_SHIPPING); | 1030 GetMenuModelForSection(SECTION_SHIPPING); |
1033 EXPECT_EQ(3, shipping_model->GetItemCount()); | 1031 EXPECT_EQ(3, shipping_model->GetItemCount()); |
1034 // "Same as billing" is selected. | 1032 // "Same as billing" is selected. |
1035 EXPECT_FALSE(controller()->IsManuallyEditingSection(SECTION_SHIPPING)); | 1033 EXPECT_FALSE(controller()->IsManuallyEditingSection(SECTION_SHIPPING)); |
1036 EXPECT_TRUE(controller()->IsManuallyEditingSection(SECTION_BILLING)); | 1034 EXPECT_TRUE(controller()->IsManuallyEditingSection(SECTION_BILLING)); |
1037 AutofillProfile verified_profile(test::GetVerifiedProfile()); | 1035 AutofillProfile verified_profile(test::GetVerifiedProfile()); |
1038 controller()->GetTestingManager()->AddTestingProfile(&verified_profile); | 1036 controller()->GetTestingManager()->AddTestingProfile(&verified_profile); |
1039 EXPECT_EQ(4, shipping_model->GetItemCount()); | 1037 EXPECT_EQ(4, shipping_model->GetItemCount()); |
1040 EXPECT_FALSE(controller()->IsManuallyEditingSection(SECTION_SHIPPING)); | 1038 EXPECT_FALSE(controller()->IsManuallyEditingSection(SECTION_SHIPPING)); |
1041 EXPECT_FALSE(controller()->IsManuallyEditingSection(SECTION_BILLING)); | 1039 EXPECT_FALSE(controller()->IsManuallyEditingSection(SECTION_BILLING)); |
1042 | 1040 |
1043 AddressProblems problems; | 1041 FieldProblemMap problems; |
1044 problems.push_back( | 1042 problems.insert(std::make_pair(::i18n::addressinput::POSTAL_CODE, |
1045 AddressProblem(::i18n::addressinput::POSTAL_CODE, | 1043 ::i18n::addressinput::MISMATCHING_VALUE)); |
1046 AddressProblem::MISMATCHING_VALUE, | |
1047 IDS_LEARN_MORE)); | |
1048 EXPECT_CALL(*controller()->GetMockValidator(), | 1044 EXPECT_CALL(*controller()->GetMockValidator(), |
1049 ValidateAddress(CountryCodeMatcher("US"), _, _)). | 1045 Validate(CountryCodeMatcher("US"), _, _)). |
1050 WillRepeatedly(DoAll(SetArgPointee<2>(problems), | 1046 WillRepeatedly(DoAll(SetArgPointee<2>(problems), |
1051 Return(AddressValidator::SUCCESS))); | 1047 Return(PreloadAddressValidator::SUCCESS))); |
1052 | 1048 |
1053 controller()->OnAddressValidationRulesLoaded("US", true); | 1049 controller()->AddressValidationRulesLoaded(true, "US", 0); |
1054 EXPECT_EQ(4, shipping_model->GetItemCount()); | 1050 EXPECT_EQ(4, shipping_model->GetItemCount()); |
1055 EXPECT_TRUE(controller()->IsManuallyEditingSection(SECTION_SHIPPING)); | 1051 EXPECT_TRUE(controller()->IsManuallyEditingSection(SECTION_SHIPPING)); |
1056 EXPECT_TRUE(controller()->IsManuallyEditingSection(SECTION_BILLING)); | 1052 EXPECT_TRUE(controller()->IsManuallyEditingSection(SECTION_BILLING)); |
1057 } | 1053 } |
1058 | 1054 |
1059 // Makes sure that the choice of which Autofill profile to use for each section | 1055 // Makes sure that the choice of which Autofill profile to use for each section |
1060 // is sticky. | 1056 // is sticky. |
1061 TEST_F(AutofillDialogControllerTest, AutofillProfileDefaults) { | 1057 TEST_F(AutofillDialogControllerTest, AutofillProfileDefaults) { |
1062 SwitchToAutofill(); | 1058 SwitchToAutofill(); |
1063 AutofillProfile profile(test::GetVerifiedProfile()); | 1059 AutofillProfile profile(test::GetVerifiedProfile()); |
(...skipping 2137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3201 gfx::Rect(), | 3197 gfx::Rect(), |
3202 ASCIIToUTF16("Italy"), | 3198 ASCIIToUTF16("Italy"), |
3203 true); | 3199 true); |
3204 updates = view->section_updates(); | 3200 updates = view->section_updates(); |
3205 EXPECT_EQ(1U, updates[SECTION_BILLING]); | 3201 EXPECT_EQ(1U, updates[SECTION_BILLING]); |
3206 EXPECT_EQ(1U, updates.size()); | 3202 EXPECT_EQ(1U, updates.size()); |
3207 } | 3203 } |
3208 | 3204 |
3209 TEST_F(AutofillDialogControllerTest, CorrectCountryFromInputs) { | 3205 TEST_F(AutofillDialogControllerTest, CorrectCountryFromInputs) { |
3210 EXPECT_CALL(*controller()->GetMockValidator(), | 3206 EXPECT_CALL(*controller()->GetMockValidator(), |
3211 ValidateAddress(CountryCodeMatcher("DE"), _, _)); | 3207 Validate(CountryCodeMatcher("DE"), _, _)); |
3212 | 3208 |
3213 FieldValueMap billing_inputs; | 3209 FieldValueMap billing_inputs; |
3214 billing_inputs[ADDRESS_BILLING_COUNTRY] = ASCIIToUTF16("Germany"); | 3210 billing_inputs[ADDRESS_BILLING_COUNTRY] = ASCIIToUTF16("Germany"); |
3215 controller()->InputsAreValid(SECTION_BILLING, billing_inputs); | 3211 controller()->InputsAreValid(SECTION_BILLING, billing_inputs); |
3216 | 3212 |
3217 EXPECT_CALL(*controller()->GetMockValidator(), | 3213 EXPECT_CALL(*controller()->GetMockValidator(), |
3218 ValidateAddress(CountryCodeMatcher("FR"), _, _)); | 3214 Validate(CountryCodeMatcher("FR"), _, _)); |
3219 | 3215 |
3220 FieldValueMap shipping_inputs; | 3216 FieldValueMap shipping_inputs; |
3221 shipping_inputs[ADDRESS_HOME_COUNTRY] = ASCIIToUTF16("France"); | 3217 shipping_inputs[ADDRESS_HOME_COUNTRY] = ASCIIToUTF16("France"); |
3222 controller()->InputsAreValid(SECTION_SHIPPING, shipping_inputs); | 3218 controller()->InputsAreValid(SECTION_SHIPPING, shipping_inputs); |
3223 } | 3219 } |
3224 | 3220 |
3225 TEST_F(AutofillDialogControllerTest, ValidationRulesLoadedOnCountryChange) { | 3221 TEST_F(AutofillDialogControllerTest, ValidationRulesLoadedOnCountryChange) { |
3226 ResetControllerWithFormData(DefaultFormData()); | 3222 ResetControllerWithFormData(DefaultFormData()); |
3227 EXPECT_CALL(*controller()->GetMockValidator(), | 3223 EXPECT_CALL(*controller()->GetMockValidator(), |
3228 LoadRules("US")).Times(AtLeast(1)); | 3224 LoadRules("US", _)).Times(AtLeast(1)); |
please use gerrit instead
2014/06/05 22:22:47
To reduce reviewer burden: Make LoadRules() not ta
please use gerrit instead
2014/06/09 23:28:16
Done.
| |
3229 controller()->Show(); | 3225 controller()->Show(); |
3230 | 3226 |
3231 EXPECT_CALL(*controller()->GetMockValidator(), LoadRules("FR")); | 3227 EXPECT_CALL(*controller()->GetMockValidator(), LoadRules("FR", _)); |
3232 controller()->UserEditedOrActivatedInput(SECTION_BILLING, | 3228 controller()->UserEditedOrActivatedInput(SECTION_BILLING, |
3233 ADDRESS_BILLING_COUNTRY, | 3229 ADDRESS_BILLING_COUNTRY, |
3234 gfx::NativeView(), | 3230 gfx::NativeView(), |
3235 gfx::Rect(), | 3231 gfx::Rect(), |
3236 ASCIIToUTF16("France"), | 3232 ASCIIToUTF16("France"), |
3237 true); | 3233 true); |
3238 } | 3234 } |
3239 | 3235 |
3240 TEST_F(AutofillDialogControllerTest, UsValidationRulesLoadedForJpOnlyProfile) { | 3236 TEST_F(AutofillDialogControllerTest, UsValidationRulesLoadedForJpOnlyProfile) { |
3241 ResetControllerWithFormData(DefaultFormData()); | 3237 ResetControllerWithFormData(DefaultFormData()); |
3242 AutofillProfile jp_profile(base::GenerateGUID(), kSettingsOrigin); | 3238 AutofillProfile jp_profile(base::GenerateGUID(), kSettingsOrigin); |
3243 jp_profile.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("JP")); | 3239 jp_profile.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("JP")); |
3244 controller()->GetTestingManager()->AddTestingProfile(&jp_profile); | 3240 controller()->GetTestingManager()->AddTestingProfile(&jp_profile); |
3245 EXPECT_CALL(*controller()->GetMockValidator(), LoadRules("US")); | 3241 EXPECT_CALL(*controller()->GetMockValidator(), LoadRules("US", _)); |
3246 EXPECT_CALL(*controller()->GetMockValidator(), | 3242 EXPECT_CALL(*controller()->GetMockValidator(), |
3247 LoadRules("JP")).Times(AtLeast(1)); | 3243 LoadRules("JP", _)).Times(AtLeast(1)); |
3248 controller()->Show(); | 3244 controller()->Show(); |
3249 } | 3245 } |
3250 | 3246 |
3251 TEST_F(AutofillDialogControllerTest, InvalidWhenRulesNotReady) { | 3247 TEST_F(AutofillDialogControllerTest, InvalidWhenRulesNotReady) { |
3252 // Select "Add new shipping address...". | 3248 // Select "Add new shipping address...". |
3253 controller()->MenuModelForSection(SECTION_SHIPPING)->ActivatedAt(1); | 3249 controller()->MenuModelForSection(SECTION_SHIPPING)->ActivatedAt(1); |
3254 | 3250 |
3255 // If the rules haven't loaded yet, validation errors should show on submit. | 3251 // If the rules haven't loaded yet, validation errors should show on submit. |
3256 EXPECT_CALL(*controller()->GetMockValidator(), | 3252 EXPECT_CALL(*controller()->GetMockValidator(), |
3257 ValidateAddress(CountryCodeMatcher("US"), _, _)). | 3253 Validate(CountryCodeMatcher("US"), _, _)). |
3258 WillRepeatedly(Return(AddressValidator::RULES_NOT_READY)); | 3254 WillRepeatedly(Return(PreloadAddressValidator::RULES_NOT_READY)); |
3259 | 3255 |
3260 FieldValueMap inputs; | 3256 FieldValueMap inputs; |
3261 inputs[ADDRESS_HOME_ZIP] = ASCIIToUTF16("1234"); | 3257 inputs[ADDRESS_HOME_ZIP] = ASCIIToUTF16("1234"); |
3262 inputs[ADDRESS_HOME_COUNTRY] = ASCIIToUTF16("United States"); | 3258 inputs[ADDRESS_HOME_COUNTRY] = ASCIIToUTF16("United States"); |
3263 | 3259 |
3264 ValidityMessages messages = | 3260 ValidityMessages messages = |
3265 controller()->InputsAreValid(SECTION_SHIPPING, inputs); | 3261 controller()->InputsAreValid(SECTION_SHIPPING, inputs); |
3266 EXPECT_FALSE(messages.GetMessageOrDefault(ADDRESS_HOME_ZIP).text.empty()); | 3262 EXPECT_FALSE(messages.GetMessageOrDefault(ADDRESS_HOME_ZIP).text.empty()); |
3267 EXPECT_FALSE(messages.HasSureError(ADDRESS_HOME_ZIP)); | 3263 EXPECT_FALSE(messages.HasSureError(ADDRESS_HOME_ZIP)); |
3268 // Country should never show an error message as it's always valid. | 3264 // Country should never show an error message as it's always valid. |
3269 EXPECT_TRUE(messages.GetMessageOrDefault(ADDRESS_HOME_COUNTRY).text.empty()); | 3265 EXPECT_TRUE(messages.GetMessageOrDefault(ADDRESS_HOME_COUNTRY).text.empty()); |
3270 } | 3266 } |
3271 | 3267 |
3272 TEST_F(AutofillDialogControllerTest, ValidButUnverifiedWhenRulesFail) { | 3268 TEST_F(AutofillDialogControllerTest, ValidButUnverifiedWhenRulesFail) { |
3273 SwitchToAutofill(); | 3269 SwitchToAutofill(); |
3274 | 3270 |
3275 // Add suggestions so the credit card and billing sections aren't showing | 3271 // Add suggestions so the credit card and billing sections aren't showing |
3276 // their manual inputs (to isolate to just shipping). | 3272 // their manual inputs (to isolate to just shipping). |
3277 AutofillProfile verified_profile(test::GetVerifiedProfile()); | 3273 AutofillProfile verified_profile(test::GetVerifiedProfile()); |
3278 controller()->GetTestingManager()->AddTestingProfile(&verified_profile); | 3274 controller()->GetTestingManager()->AddTestingProfile(&verified_profile); |
3279 CreditCard verified_card(test::GetVerifiedCreditCard()); | 3275 CreditCard verified_card(test::GetVerifiedCreditCard()); |
3280 controller()->GetTestingManager()->AddTestingCreditCard(&verified_card); | 3276 controller()->GetTestingManager()->AddTestingCreditCard(&verified_card); |
3281 | 3277 |
3282 // Select "Add new shipping address...". | 3278 // Select "Add new shipping address...". |
3283 controller()->MenuModelForSection(SECTION_SHIPPING)->ActivatedAt(2); | 3279 controller()->MenuModelForSection(SECTION_SHIPPING)->ActivatedAt(2); |
3284 | 3280 |
3285 // If the rules are unavailable, validation errors should not show. | 3281 // If the rules are unavailable, validation errors should not show. |
3286 EXPECT_CALL(*controller()->GetMockValidator(), | 3282 EXPECT_CALL(*controller()->GetMockValidator(), |
3287 ValidateAddress(CountryCodeMatcher("US"), _, _)). | 3283 Validate(CountryCodeMatcher("US"), _, _)) |
3288 WillRepeatedly(Return(AddressValidator::RULES_UNAVAILABLE)); | 3284 .WillRepeatedly(Return(PreloadAddressValidator::RULES_UNAVAILABLE)); |
3289 | 3285 |
3290 FieldValueMap outputs; | 3286 FieldValueMap outputs; |
3291 AutofillProfile full_profile(test::GetFullProfile()); | 3287 AutofillProfile full_profile(test::GetFullProfile()); |
3292 const DetailInputs& inputs = | 3288 const DetailInputs& inputs = |
3293 controller()->RequestedFieldsForSection(SECTION_SHIPPING); | 3289 controller()->RequestedFieldsForSection(SECTION_SHIPPING); |
3294 for (size_t i = 0; i < inputs.size(); ++i) { | 3290 for (size_t i = 0; i < inputs.size(); ++i) { |
3295 const ServerFieldType type = inputs[i].type; | 3291 const ServerFieldType type = inputs[i].type; |
3296 outputs[type] = full_profile.GetInfo(AutofillType(type), "en-US"); | 3292 outputs[type] = full_profile.GetInfo(AutofillType(type), "en-US"); |
3297 } | 3293 } |
3298 controller()->GetView()->SetUserInput(SECTION_SHIPPING, outputs); | 3294 controller()->GetView()->SetUserInput(SECTION_SHIPPING, outputs); |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3528 controller()->MenuModelForSection(SECTION_CC_BILLING)->ActivatedAt(2); | 3524 controller()->MenuModelForSection(SECTION_CC_BILLING)->ActivatedAt(2); |
3529 | 3525 |
3530 FieldValueMap outputs; | 3526 FieldValueMap outputs; |
3531 outputs[NAME_FULL] = ASCIIToUTF16("madonna"); | 3527 outputs[NAME_FULL] = ASCIIToUTF16("madonna"); |
3532 controller()->GetView()->SetUserInput(SECTION_CC_BILLING, outputs); | 3528 controller()->GetView()->SetUserInput(SECTION_CC_BILLING, outputs); |
3533 | 3529 |
3534 ASSERT_NO_FATAL_FAILURE(SwitchToAutofill()); | 3530 ASSERT_NO_FATAL_FAILURE(SwitchToAutofill()); |
3535 } | 3531 } |
3536 | 3532 |
3537 } // namespace autofill | 3533 } // namespace autofill |
OLD | NEW |