Index: chrome/browser/ui/views/payments/credit_card_editor_view_controller_browsertest.cc |
diff --git a/chrome/browser/ui/views/payments/credit_card_editor_view_controller_browsertest.cc b/chrome/browser/ui/views/payments/credit_card_editor_view_controller_browsertest.cc |
index 471ace6096f838d904fd4d9831abcd16ad039ad2..f7d35261c0b53c1baaa650c1289b744daeb8f676 100644 |
--- a/chrome/browser/ui/views/payments/credit_card_editor_view_controller_browsertest.cc |
+++ b/chrome/browser/ui/views/payments/credit_card_editor_view_controller_browsertest.cc |
@@ -8,6 +8,7 @@ |
#include "base/macros.h" |
#include "base/strings/utf_string_conversions.h" |
#include "base/time/time.h" |
+#include "chrome/browser/ui/views/payments/editor_view_controller.h" |
#include "chrome/browser/ui/views/payments/payment_request_browsertest_base.h" |
#include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" |
#include "chrome/browser/ui/views/payments/validating_textfield.h" |
@@ -190,10 +191,11 @@ IN_PROC_BROWSER_TEST_F(PaymentRequestCreditCardEditorTest, |
EXPECT_FALSE(IsEditorTextfieldInvalid(autofill::CREDIT_CARD_NAME_FULL)); |
EXPECT_FALSE(IsEditorTextfieldInvalid(autofill::CREDIT_CARD_NUMBER)); |
- // TODO(mathp): Both expiration fields should be marked as invalid when the |
- // card is expired. |
- EXPECT_FALSE(IsEditorComboboxInvalid(autofill::CREDIT_CARD_EXP_MONTH)); |
- EXPECT_FALSE(IsEditorComboboxInvalid(autofill::CREDIT_CARD_EXP_4_DIGIT_YEAR)); |
+ EXPECT_TRUE(IsEditorComboboxInvalid(autofill::CREDIT_CARD_EXP_MONTH)); |
+ EXPECT_TRUE(IsEditorComboboxInvalid(autofill::CREDIT_CARD_EXP_4_DIGIT_YEAR)); |
+ EXPECT_EQ(l10n_util::GetStringUTF16( |
+ IDS_PAYMENTS_VALIDATION_INVALID_CREDIT_CARD_EXPIRED), |
+ GetErrorLabelForType(autofill::CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR)); |
autofill::PersonalDataManager* personal_data_manager = GetDataManager(); |
EXPECT_EQ(0u, personal_data_manager->GetCreditCards().size()); |
@@ -527,7 +529,8 @@ IN_PROC_BROWSER_TEST_F(PaymentRequestCreditCardEditorTest, |
// The billing address must be properly selected and valid. |
views::Combobox* billing_combobox = static_cast<views::Combobox*>( |
- dialog_view()->GetViewByID(autofill::ADDRESS_BILLING_LINE1)); |
+ dialog_view()->GetViewByID(EditorViewController::GetInputFieldViewId( |
+ autofill::ADDRESS_BILLING_LINE1))); |
ASSERT_NE(nullptr, billing_combobox); |
EXPECT_FALSE(billing_combobox->invalid()); |
@@ -595,9 +598,9 @@ IN_PROC_BROWSER_TEST_F(PaymentRequestCreditCardEditorTest, EnteringEmptyData) { |
SetEditorTextfieldValue(base::ASCIIToUTF16(""), |
autofill::CREDIT_CARD_NAME_FULL); |
- ValidatingTextfield* textfield = |
- static_cast<ValidatingTextfield*>(dialog_view()->GetViewByID( |
- static_cast<int>(autofill::CREDIT_CARD_NAME_FULL))); |
+ ValidatingTextfield* textfield = static_cast<ValidatingTextfield*>( |
+ dialog_view()->GetViewByID(EditorViewController::GetInputFieldViewId( |
+ autofill::CREDIT_CARD_NAME_FULL))); |
EXPECT_TRUE(textfield); |
EXPECT_TRUE(textfield->invalid()); |
} |