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

Unified Diff: chrome/browser/ui/views/payments/payment_request_credit_card_editor_interactive_uitest.cc

Issue 2694693003: [Payments] Add support for required fields in editor validation (Closed)
Patch Set: Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/payments/payment_request_credit_card_editor_interactive_uitest.cc
diff --git a/chrome/browser/ui/views/payments/payment_request_credit_card_editor_interactive_uitest.cc b/chrome/browser/ui/views/payments/payment_request_credit_card_editor_interactive_uitest.cc
index 2dfcc616ea0a0b2f90a365f81bec896fc5860e0b..ae2a95be9090f5aac860b1883c35c194fb671b4d 100644
--- a/chrome/browser/ui/views/payments/payment_request_credit_card_editor_interactive_uitest.cc
+++ b/chrome/browser/ui/views/payments/payment_request_credit_card_editor_interactive_uitest.cc
@@ -6,6 +6,7 @@
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h"
#include "chrome/browser/ui/views/payments/payment_request_interactive_uitest_base.h"
+#include "chrome/browser/ui/views/payments/validating_textfield.h"
#include "components/autofill/core/browser/field_types.h"
#include "components/autofill/core/browser/personal_data_manager.h"
#include "components/payments/payment_request.h"
@@ -81,4 +82,23 @@ IN_PROC_BROWSER_TEST_F(PaymentRequestCreditCardEditorTest,
EXPECT_EQ(0u, personal_data_manager->GetCreditCards().size());
}
+IN_PROC_BROWSER_TEST_F(PaymentRequestCreditCardEditorTest, EnteringEmptyData) {
+ InvokePaymentRequestUI();
+
+ OpenPaymentMethodScreen();
+
+ OpenCreditCardEditorScreen();
+
+ // Setting empty data and unfocusing a required textfield will make it
+ // invalid.
+ SetEditorTextfieldValue(base::ASCIIToUTF16(""),
+ autofill::CREDIT_CARD_NAME_FULL);
+
+ ValidatingTextfield* textfield =
+ static_cast<ValidatingTextfield*>(dialog_view()->GetViewByID(
+ static_cast<int>(autofill::CREDIT_CARD_NAME_FULL)));
+ DCHECK(textfield);
anthonyvd 2017/02/13 15:53:53 Don't we prefer EXPECT to DCHECK in tests? EXPECT_
Mathieu 2017/02/13 15:58:15 Done.
+ EXPECT_TRUE(textfield->invalid());
+}
+
} // namespace payments

Powered by Google App Engine
This is Rietveld 408576698