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

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

Issue 2849523003: Add billing address as a mandatory field of Payments credit cards. (Closed)
Patch Set: OWNER comments 2 + fixed new tests 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/payment_request_browsertest_base.cc
diff --git a/chrome/browser/ui/views/payments/payment_request_browsertest_base.cc b/chrome/browser/ui/views/payments/payment_request_browsertest_base.cc
index 34b5bce76b81540df2529c47f9c8d3560151cbd4..7d2077ddab248d4126c11a5a3b3996d468c33c81 100644
--- a/chrome/browser/ui/views/payments/payment_request_browsertest_base.cc
+++ b/chrome/browser/ui/views/payments/payment_request_browsertest_base.cc
@@ -24,6 +24,7 @@
#include "chrome/browser/ui/views/payments/validating_textfield.h"
#include "chrome/browser/ui/views/payments/view_stack.h"
#include "chrome/test/base/ui_test_utils.h"
+#include "components/autofill/core/browser/address_combobox_model.h"
#include "components/autofill/core/browser/autofill_profile.h"
#include "components/autofill/core/browser/credit_card.h"
#include "components/autofill/core/browser/personal_data_manager.h"
@@ -47,6 +48,10 @@
namespace payments {
+namespace {
+const auto kBillingAddressType = autofill::ADDRESS_BILLING_LINE1;
+} // namespace
+
PersonalDataLoadedObserverMock::PersonalDataLoadedObserverMock() {}
PersonalDataLoadedObserverMock::~PersonalDataLoadedObserverMock() {}
@@ -557,6 +562,17 @@ void PaymentRequestBrowserTestBase::SetComboboxValue(
combobox->OnBlur();
}
+void PaymentRequestBrowserTestBase::SelectBillingAddress(
+ const std::string& billing_address_id) {
+ views::Combobox* address_combobox(static_cast<views::Combobox*>(
+ dialog_view()->GetViewByID(static_cast<int>(kBillingAddressType))));
+ ASSERT_NE(address_combobox, nullptr);
+ autofill::AddressComboboxModel* address_combobox_model(
+ static_cast<autofill::AddressComboboxModel*>(address_combobox->model()));
+ address_combobox->SetSelectedIndex(
+ address_combobox_model->GetIndexOfIdentifier(billing_address_id));
+}
+
bool PaymentRequestBrowserTestBase::IsEditorTextfieldInvalid(
autofill::ServerFieldType type) {
ValidatingTextfield* textfield = static_cast<ValidatingTextfield*>(

Powered by Google App Engine
This is Rietveld 408576698