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

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

Issue 876343004: fix autofill shadowing vars warning (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | no next file » | 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) 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 #include <utility>
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 ServerFieldType phone = i == 0 ? PHONE_HOME_WHOLE_NUMBER : 736 ServerFieldType phone = i == 0 ? PHONE_HOME_WHOLE_NUMBER :
737 PHONE_BILLING_WHOLE_NUMBER; 737 PHONE_BILLING_WHOLE_NUMBER;
738 ServerFieldType address = i == 0 ? ADDRESS_HOME_COUNTRY : 738 ServerFieldType address = i == 0 ? ADDRESS_HOME_COUNTRY :
739 ADDRESS_BILLING_COUNTRY; 739 ADDRESS_BILLING_COUNTRY;
740 DialogSection section = i == 0 ? SECTION_SHIPPING : SECTION_BILLING; 740 DialogSection section = i == 0 ? SECTION_SHIPPING : SECTION_BILLING;
741 741
742 FieldValueMap outputs; 742 FieldValueMap outputs;
743 const DetailInputs& inputs = 743 const DetailInputs& inputs =
744 controller()->RequestedFieldsForSection(section); 744 controller()->RequestedFieldsForSection(section);
745 AutofillProfile full_profile(test::GetVerifiedProfile()); 745 AutofillProfile full_profile(test::GetVerifiedProfile());
746 for (size_t i = 0; i < inputs.size(); ++i) { 746 for (size_t ix = 0; ix < inputs.size(); ++ix) {
Ilya Sherman 2015/01/28 01:35:48 nit: Please use 'j' instead of 'ix'
747 const ServerFieldType type = inputs[i].type; 747 const ServerFieldType type = inputs[ix].type;
748 outputs[type] = full_profile.GetInfo(AutofillType(type), "en-US"); 748 outputs[type] = full_profile.GetInfo(AutofillType(type), "en-US");
749 } 749 }
750 750
751 // Make sure country is United States. 751 // Make sure country is United States.
752 outputs[address] = ASCIIToUTF16("United States"); 752 outputs[address] = ASCIIToUTF16("United States");
753 753
754 // Existing data should have no errors. 754 // Existing data should have no errors.
755 ValidityMessages messages = controller()->InputsAreValid(section, outputs); 755 ValidityMessages messages = controller()->InputsAreValid(section, outputs);
756 EXPECT_FALSE(HasAnyError(messages, phone)); 756 EXPECT_FALSE(HasAnyError(messages, phone));
757 757
(...skipping 2201 matching lines...) Expand 10 before | Expand all | Expand 10 after
2959 } 2959 }
2960 2960
2961 // Expired instrument: CC number + CVV are not editable. 2961 // Expired instrument: CC number + CVV are not editable.
2962 items = wallet::GetTestWalletItems(wallet::AMEX_DISALLOWED); 2962 items = wallet::GetTestWalletItems(wallet::AMEX_DISALLOWED);
2963 scoped_ptr<wallet::WalletItems::MaskedInstrument> expired_instrument = 2963 scoped_ptr<wallet::WalletItems::MaskedInstrument> expired_instrument =
2964 wallet::GetTestMaskedInstrumentExpired(); 2964 wallet::GetTestMaskedInstrumentExpired();
2965 items->AddInstrument(expired_instrument.Pass()); 2965 items->AddInstrument(expired_instrument.Pass());
2966 controller()->OnDidGetWalletItems(items.Pass()); 2966 controller()->OnDidGetWalletItems(items.Pass());
2967 EXPECT_TRUE(controller()->IsEditingExistingData(SECTION_CC_BILLING)); 2967 EXPECT_TRUE(controller()->IsEditingExistingData(SECTION_CC_BILLING));
2968 2968
2969 const DetailInputs& inputs =
2970 controller()->RequestedFieldsForSection(SECTION_CC_BILLING);
2971 FieldValueMap outputs; 2969 FieldValueMap outputs;
2972 CopyInitialValues(inputs, &outputs); 2970 CopyInitialValues(
2971 controller()->RequestedFieldsForSection(SECTION_CC_BILLING),
2972 &outputs);
2973 controller()->GetView()->SetUserInput(SECTION_CC_BILLING, outputs); 2973 controller()->GetView()->SetUserInput(SECTION_CC_BILLING, outputs);
2974 2974
2975 for (size_t i = 0; i < arraysize(sections); ++i) { 2975 for (size_t i = 0; i < arraysize(sections); ++i) {
2976 const DetailInputs& inputs = 2976 const DetailInputs& inputs =
2977 controller()->RequestedFieldsForSection(sections[i]); 2977 controller()->RequestedFieldsForSection(sections[i]);
2978 for (size_t j = 0; j < inputs.size(); ++j) { 2978 for (size_t j = 0; j < inputs.size(); ++j) {
2979 if (inputs[j].type == CREDIT_CARD_NUMBER || 2979 if (inputs[j].type == CREDIT_CARD_NUMBER ||
2980 inputs[j].type == CREDIT_CARD_VERIFICATION_CODE) { 2980 inputs[j].type == CREDIT_CARD_VERIFICATION_CODE) {
2981 EXPECT_FALSE(controller()->InputIsEditable(inputs[j], sections[i])); 2981 EXPECT_FALSE(controller()->InputIsEditable(inputs[j], sections[i]));
2982 } else { 2982 } else {
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
3646 EXPECT_EQ(ASCIIToUTF16("United States"), form_structure()->field(2)->value); 3646 EXPECT_EQ(ASCIIToUTF16("United States"), form_structure()->field(2)->value);
3647 EXPECT_EQ(ADDRESS_HOME_COUNTRY, 3647 EXPECT_EQ(ADDRESS_HOME_COUNTRY,
3648 form_structure()->field(3)->Type().GetStorableType()); 3648 form_structure()->field(3)->Type().GetStorableType());
3649 EXPECT_EQ(ASCIIToUTF16("US"), form_structure()->field(3)->value); 3649 EXPECT_EQ(ASCIIToUTF16("US"), form_structure()->field(3)->value);
3650 EXPECT_EQ(ADDRESS_HOME_COUNTRY, 3650 EXPECT_EQ(ADDRESS_HOME_COUNTRY,
3651 form_structure()->field(4)->Type().GetStorableType()); 3651 form_structure()->field(4)->Type().GetStorableType());
3652 EXPECT_EQ(ASCIIToUTF16("United States"), form_structure()->field(4)->value); 3652 EXPECT_EQ(ASCIIToUTF16("United States"), form_structure()->field(4)->value);
3653 } 3653 }
3654 3654
3655 } // namespace autofill 3655 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698