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

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

Issue 2905733002: [WebPayments] Disabling done button when form invalid (Closed)
Patch Set: nits 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 | « chrome/browser/ui/views/payments/editor_view_controller.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 39054abddfaa9deb1b2da4a4df3bf48b72ccc147..31509604bd1f1754c42bac8817f3cae90ea8d2d2 100644
--- a/chrome/browser/ui/views/payments/payment_request_browsertest_base.cc
+++ b/chrome/browser/ui/views/payments/payment_request_browsertest_base.cc
@@ -55,6 +55,20 @@ namespace payments {
namespace {
const auto kBillingAddressType = autofill::ADDRESS_BILLING_LINE1;
+
+// This is preferred to SelectValue, since only SetSelectedRow fires the events
+// as if done by a user.
+void SelectComboboxRowForValue(views::Combobox* combobox,
+ const base::string16& text) {
+ int i;
+ for (i = 0; i < combobox->GetRowCount(); i++) {
+ if (combobox->GetTextForRow(i) == text)
+ break;
+ }
+ DCHECK(i < combobox->GetRowCount()) << "Combobox does not contain " << text;
+ combobox->SetSelectedRow(i);
+}
+
} // namespace
PersonalDataLoadedObserverMock::PersonalDataLoadedObserverMock() {}
@@ -571,8 +585,8 @@ void PaymentRequestBrowserTestBase::SetEditorTextfieldValue(
static_cast<ValidatingTextfield*>(delegate_->dialog_view()->GetViewByID(
EditorViewController::GetInputFieldViewId(type)));
DCHECK(textfield);
- textfield->SetText(value);
- textfield->OnContentsChanged();
+ textfield->SetText(base::string16());
+ textfield->InsertText(value);
textfield->OnBlur();
}
@@ -592,8 +606,7 @@ void PaymentRequestBrowserTestBase::SetComboboxValue(
static_cast<ValidatingCombobox*>(delegate_->dialog_view()->GetViewByID(
EditorViewController::GetInputFieldViewId(type)));
DCHECK(combobox);
- combobox->SelectValue(value);
- combobox->OnContentsChanged();
+ SelectComboboxRowForValue(combobox, value);
combobox->OnBlur();
}
« no previous file with comments | « chrome/browser/ui/views/payments/editor_view_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698