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 be25d9a84f41ea2cc7900362e118e5f473e484d5..16501b9b74d1d95046c42434ba3434cdf3d7f234 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 |
@@ -685,4 +685,45 @@ IN_PROC_BROWSER_TEST_F(PaymentRequestCreditCardEditorTest, EnteringEmptyData) { |
EXPECT_FALSE(textfield->IsValid()); |
} |
+IN_PROC_BROWSER_TEST_F(PaymentRequestCreditCardEditorTest, DoneButtonDisabled) { |
+ autofill::TestAutofillClock test_clock; |
+ test_clock.SetNow(kJune2017); |
+ InvokePaymentRequestUI(); |
+ |
+ autofill::AutofillProfile billing_profile(autofill::test::GetFullProfile()); |
+ AddAutofillProfile(billing_profile); |
+ |
+ OpenCreditCardEditorScreen(); |
+ |
+ views::View* save_button = dialog_view()->GetViewByID( |
+ static_cast<int>(DialogViewID::EDITOR_SAVE_BUTTON)); |
+ |
+ EXPECT_FALSE(save_button->enabled()); |
+ |
+ // Set all fields but one: |
+ SetEditorTextfieldValue(base::ASCIIToUTF16("Bob Jones"), |
+ autofill::CREDIT_CARD_NAME_FULL); |
+ SetEditorTextfieldValue(base::ASCIIToUTF16("4111111111111111"), |
+ autofill::CREDIT_CARD_NUMBER); |
+ SetComboboxValue(base::ASCIIToUTF16("05"), autofill::CREDIT_CARD_EXP_MONTH); |
+ SetComboboxValue(base::ASCIIToUTF16("2026"), |
+ autofill::CREDIT_CARD_EXP_4_DIGIT_YEAR); |
+ |
+ // Still disabled. |
+ EXPECT_FALSE(save_button->enabled()); |
+ |
+ // Set the last field. |
+ SelectBillingAddress(billing_profile.guid()); |
+ |
+ // Should be good to go. |
+ EXPECT_TRUE(save_button->enabled()); |
+ |
+ // Change a field to something invalid, to make sure it works both ways. |
+ SetEditorTextfieldValue(base::ASCIIToUTF16("Ni!"), |
+ autofill::CREDIT_CARD_NUMBER); |
+ |
+ // Back to being disabled. |
+ EXPECT_FALSE(save_button->enabled()); |
+} |
+ |
} // namespace payments |