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

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

Issue 2913223002: Make payment instrument labels dynamic (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/payments/payment_method_view_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ca784170d32beb7a6287c98386d6988f5914e435..c3813dfd82ec4b0ce10545697eff2bfded97cc6d 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
@@ -571,6 +571,57 @@ IN_PROC_BROWSER_TEST_F(PaymentRequestCreditCardEditorTest,
}
IN_PROC_BROWSER_TEST_F(PaymentRequestCreditCardEditorTest,
+ ChangeCardHolderName) {
+ autofill::AutofillProfile billing_profile(autofill::test::GetFullProfile());
+ AddAutofillProfile(billing_profile);
+ autofill::CreditCard card = autofill::test::GetCreditCard();
+ // Don't set billing address yet, so we can simply click on list view to edit.
+ card.set_billing_address_id("");
+ AddCreditCard(card);
+
+ InvokePaymentRequestUI();
+
+ // One instrument is available, it is not selected, but is properly named.
+ PaymentRequest* request = GetPaymentRequests(GetActiveWebContents()).front();
+ EXPECT_EQ(1U, request->state()->available_instruments().size());
+ EXPECT_EQ(nullptr, request->state()->selected_instrument());
+ EXPECT_EQ(
+ card.GetInfo(autofill::AutofillType(autofill::CREDIT_CARD_NAME_FULL),
+ request->state()->GetApplicationLocale()),
+ request->state()->available_instruments()[0]->GetSublabel());
+
+ OpenPaymentMethodScreen();
+
+ ResetEventObserver(DialogEvent::CREDIT_CARD_EDITOR_OPENED);
+ ClickOnChildInListViewAndWait(/*child_index=*/0, /*num_children=*/1,
+ DialogViewID::PAYMENT_METHOD_SHEET_LIST_VIEW);
+ // Change the name.
+ SetEditorTextfieldValue(base::ASCIIToUTF16("Bob the second"),
+ autofill::CREDIT_CARD_NAME_FULL);
+ // Make the card valid.
+ SelectBillingAddress(billing_profile.guid());
+
+ // Verifying the data is in the DB.
+ autofill::PersonalDataManager* personal_data_manager = GetDataManager();
+ personal_data_manager->AddObserver(&personal_data_observer_);
+
+ ResetEventObserver(DialogEvent::BACK_TO_PAYMENT_SHEET_NAVIGATION);
+
+ // Wait until the web database has been updated and the notification sent.
+ base::RunLoop data_loop;
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged())
+ .WillOnce(QuitMessageLoop(&data_loop));
+ ClickOnDialogViewAndWait(DialogViewID::EDITOR_SAVE_BUTTON);
+ data_loop.Run();
+
+ // One instrument is available, is selected, and is properly named.
+ EXPECT_EQ(1U, request->state()->available_instruments().size());
+ EXPECT_NE(nullptr, request->state()->selected_instrument());
+ EXPECT_EQ(base::ASCIIToUTF16("Bob the second"),
+ request->state()->selected_instrument()->GetSublabel());
+}
+
+IN_PROC_BROWSER_TEST_F(PaymentRequestCreditCardEditorTest,
CreateNewBillingAddress) {
autofill::CreditCard card = autofill::test::GetCreditCard();
// Make sure to clear billing address and have none available.
« no previous file with comments | « no previous file | chrome/browser/ui/views/payments/payment_method_view_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698