| Index: chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc
|
| diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc
|
| index 48e65212395d73b6cb9e53cb78535619ca6e735e..7a3750d40a84abf5220158bd2233a969b6c839be 100644
|
| --- a/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc
|
| +++ b/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc
|
| @@ -240,9 +240,10 @@ class TestAutofillDialogController
|
|
|
| void set_dialog_type(DialogType dialog_type) { dialog_type_ = dialog_type; }
|
|
|
| - bool IsSectionInEditState(DialogSection section) {
|
| + bool IsSectionInEditState(DialogSection section) const {
|
| std::map<DialogSection, bool> state = section_editing_state();
|
| - return state[section];
|
| + std::map<DialogSection, bool>::const_iterator it = state.find(section);
|
| + return it != state.end() && it->second;
|
| }
|
|
|
| MOCK_METHOD0(LoadRiskFingerprintData, void());
|
| @@ -1822,4 +1823,28 @@ TEST_F(AutofillDialogControllerTest, NoManageMenuItemForNewWalletUsers) {
|
| 2, controller()->MenuModelForSection(SECTION_SHIPPING)->GetItemCount());
|
| }
|
|
|
| +// Ensure Wallet instruments marked expired by the server are shown as invalid.
|
| +TEST_F(AutofillDialogControllerTest, WalletExpiredCard) {
|
| + scoped_ptr<wallet::WalletItems> wallet_items = wallet::GetTestWalletItems();
|
| + wallet_items->AddInstrument(wallet::GetTestMaskedInstrumentExpired());
|
| + controller()->OnDidGetWalletItems(wallet_items.Pass());
|
| +
|
| + EXPECT_TRUE(controller()->IsSectionInEditState(SECTION_CC_BILLING));
|
| +
|
| + // Use |SetOutputValue()| to put the right AutofillFieldTypes into the map.
|
| + DetailOutputMap outputs;
|
| + SetOutputValue(controller()->RequestedFieldsForSection(SECTION_CC_BILLING),
|
| + &outputs, COMPANY_NAME, "Bluth Company");
|
| +
|
| + ValidityData validity_data = controller()->InputsAreValid(
|
| + outputs, AutofillDialogController::VALIDATE_SELECT);
|
| + EXPECT_EQ(1U, validity_data.count(CREDIT_CARD_EXP_MONTH));
|
| + EXPECT_EQ(1U, validity_data.count(CREDIT_CARD_EXP_4_DIGIT_YEAR));
|
| +
|
| + validity_data = controller()->InputsAreValid(
|
| + outputs, AutofillDialogController::VALIDATE_EDIT);
|
| + EXPECT_EQ(0U, validity_data.count(CREDIT_CARD_EXP_MONTH));
|
| + EXPECT_EQ(0U, validity_data.count(CREDIT_CARD_EXP_4_DIGIT_YEAR));
|
| +}
|
| +
|
| } // namespace autofill
|
|
|