Commit 734eeaf5 authored by Aleksandr Popov's avatar Aleksandr Popov Committed by Commit Bot

Fix disabled billing address field and unit test.

Billing address field is no more disabled after adding a new billing
address. There is also a small fix for CreateNewBillingAddress unit
test: the phone number field is changed to match the expected format.

R=anthonyvd@chromium.org
Bug: 785666

TEST=Make clean installation of the browser (no credit cards and/or
billing addresses should exist), then open:
Press "Buy", then add a credit card; then add a billing address.
The billing address combo box should become enabled, and one may
select a billing address it it.

https: //googlechrome.github.io/samples/paymentrequest/credit-cards/
Change-Id: I60f281b38feb849357ee0679167bb42f68db221e
Reviewed-on: https://chromium-review.googlesource.com/774260Reviewed-by: default avataranthonyvd <anthonyvd@chromium.org>
Reviewed-by: default avatarMathieu Perreault <mathp@chromium.org>
Commit-Queue: Mathieu Perreault <mathp@chromium.org>
Cr-Commit-Position: refs/heads/master@{#518623}
parent 55e4f90f
......@@ -642,6 +642,9 @@ void CreditCardEditorViewController::AddAndSelectNewBillingAddress(
// SetSelectedIndex doesn't trigger a perform action notification, which is
// needed to update the valid state.
address_combobox->SetSelectedRow(index);
// The combobox might be initially disabled in FillContentView, but we've
// added an item; check if we should re-enable it.
address_combobox->SetEnabled(address_combobox->GetRowCount() > 1);
// But it needs to be blured at least once.
address_combobox->OnBlur();
}
......
......@@ -831,7 +831,7 @@ IN_PROC_BROWSER_TEST_F(PaymentRequestCreditCardEditorTest,
autofill::ADDRESS_HOME_STATE);
SetEditorTextfieldValue(base::ASCIIToUTF16("BobZip"),
autofill::ADDRESS_HOME_ZIP);
SetEditorTextfieldValue(base::ASCIIToUTF16("5755555555"),
SetEditorTextfieldValue(base::ASCIIToUTF16("+15755555555"),
autofill::PHONE_HOME_WHOLE_NUMBER);
// Come back to credit card editor.
......@@ -844,6 +844,7 @@ IN_PROC_BROWSER_TEST_F(PaymentRequestCreditCardEditorTest,
autofill::ADDRESS_BILLING_LINE1)));
ASSERT_NE(nullptr, billing_combobox);
EXPECT_FALSE(billing_combobox->invalid());
EXPECT_TRUE(billing_combobox->enabled());
// And then save credit card state and come back to payment sheet.
ResetEventObserver(DialogEvent::BACK_TO_PAYMENT_SHEET_NAVIGATION);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment