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..2c20bc0810a2add76dfbbc148be6343ad8eae200 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,29 @@ 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 SetComboboxRowForValue(views::Combobox* combobox, |
Mathieu
2017/05/29 16:45:36
nit: *SelectComboboxRowForValue?
tmartino
2017/05/29 21:06:58
Done
|
+ 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(0); |
Mathieu
2017/05/29 16:45:36
The SelectBillingAddress code seems to get away wi
tmartino
2017/05/29 21:06:58
Yup, done.
|
+ combobox->SetSelectedRow(i); |
+ |
+ // Hit enter twice to trigger events. |
Mathieu
2017/05/29 16:45:36
Are we doing this to make sure OnBlur is called on
tmartino
2017/05/29 21:06:58
n/a anymore
|
+ ui::KeyEvent enter_event(ui::ET_KEY_PRESSED, ui::VKEY_RETURN, 0); |
+ LOG(ERROR) << "Pressing enter..."; |
Mathieu
2017/05/29 16:45:36
plz remove :)
tmartino
2017/05/29 21:06:58
n/a
|
+ combobox->OnKeyPressed(enter_event); |
+ LOG(ERROR) << "Pressing enter..."; |
+ combobox->OnKeyPressed(enter_event); |
+ LOG(ERROR) << "Done pressing enter..."; |
+} |
+ |
} // namespace |
PersonalDataLoadedObserverMock::PersonalDataLoadedObserverMock() {} |
@@ -571,8 +594,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,13 +615,13 @@ void PaymentRequestBrowserTestBase::SetComboboxValue( |
static_cast<ValidatingCombobox*>(delegate_->dialog_view()->GetViewByID( |
EditorViewController::GetInputFieldViewId(type))); |
DCHECK(combobox); |
- combobox->SelectValue(value); |
- combobox->OnContentsChanged(); |
+ SetComboboxRowForValue(combobox, value); |
combobox->OnBlur(); |
} |
void PaymentRequestBrowserTestBase::SelectBillingAddress( |
const std::string& billing_address_id) { |
+ LOG(ERROR) << "Setting billing address"; |
Mathieu
2017/05/29 16:45:36
please fix
tmartino
2017/05/29 21:06:58
Done
|
views::Combobox* address_combobox( |
static_cast<views::Combobox*>(dialog_view()->GetViewByID( |
EditorViewController::GetInputFieldViewId(kBillingAddressType)))); |