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

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

Issue 2895473005: [Payments] Have expiration date be on the same line in CC editor (Closed)
Patch Set: addressed comments Created 3 years, 7 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/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 6b81c75c26df401383b5dcbfc30accaa254e3b15..2e081e933b7ea42a1c4b9b3f6e597e6dc44ac4d8 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());
@@ -505,8 +507,9 @@ IN_PROC_BROWSER_TEST_F(PaymentRequestCreditCardEditorTest,
ClickOnChildInListViewAndWait(/*child_index=*/0, /*num_children=*/1,
DialogViewID::PAYMENT_METHOD_SHEET_LIST_VIEW);
// Billing address combobox must be disabled since there are no saved address.
- views::View* billing_address_combobox = dialog_view()->GetViewByID(
- static_cast<int>(autofill::ADDRESS_BILLING_LINE1));
+ views::View* billing_address_combobox =
+ dialog_view()->GetViewByID(EditorViewController::GetInputFieldViewId(
+ autofill::ADDRESS_BILLING_LINE1));
ASSERT_NE(nullptr, billing_address_combobox);
EXPECT_FALSE(billing_address_combobox->enabled());
@@ -531,7 +534,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());
@@ -599,9 +603,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_FALSE(textfield->IsValid());
}

Powered by Google App Engine
This is Rietveld 408576698