OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/views/payments/payment_request_browsertest_base.h" | 5 #include "chrome/browser/ui/views/payments/payment_request_browsertest_base.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 } | 406 } |
407 | 407 |
408 void PaymentRequestBrowserTestBase::PayWithCreditCardAndWait( | 408 void PaymentRequestBrowserTestBase::PayWithCreditCardAndWait( |
409 const base::string16& cvc) { | 409 const base::string16& cvc) { |
410 OpenCVCPromptWithCVC(cvc); | 410 OpenCVCPromptWithCVC(cvc); |
411 | 411 |
412 ResetEventObserver(DialogEvent::DIALOG_CLOSED); | 412 ResetEventObserver(DialogEvent::DIALOG_CLOSED); |
413 ClickOnDialogViewAndWait(DialogViewID::CVC_PROMPT_CONFIRM_BUTTON); | 413 ClickOnDialogViewAndWait(DialogViewID::CVC_PROMPT_CONFIRM_BUTTON); |
414 } | 414 } |
415 | 415 |
| 416 base::string16 PaymentRequestBrowserTestBase::GetEditorTextfieldValue( |
| 417 autofill::ServerFieldType type) { |
| 418 ValidatingTextfield* textfield = static_cast<ValidatingTextfield*>( |
| 419 delegate_->dialog_view()->GetViewByID(static_cast<int>(type))); |
| 420 DCHECK(textfield); |
| 421 return textfield->text(); |
| 422 } |
| 423 |
416 void PaymentRequestBrowserTestBase::SetEditorTextfieldValue( | 424 void PaymentRequestBrowserTestBase::SetEditorTextfieldValue( |
417 const base::string16& value, | 425 const base::string16& value, |
418 autofill::ServerFieldType type) { | 426 autofill::ServerFieldType type) { |
419 ValidatingTextfield* textfield = static_cast<ValidatingTextfield*>( | 427 ValidatingTextfield* textfield = static_cast<ValidatingTextfield*>( |
420 delegate_->dialog_view()->GetViewByID(static_cast<int>(type))); | 428 delegate_->dialog_view()->GetViewByID(static_cast<int>(type))); |
421 DCHECK(textfield); | 429 DCHECK(textfield); |
422 textfield->SetText(value); | 430 textfield->SetText(value); |
423 textfield->OnContentsChanged(); | 431 textfield->OnContentsChanged(); |
424 textfield->OnBlur(); | 432 textfield->OnBlur(); |
425 } | 433 } |
426 | 434 |
| 435 base::string16 PaymentRequestBrowserTestBase::GetComboboxValue( |
| 436 autofill::ServerFieldType type) { |
| 437 ValidatingCombobox* combobox = static_cast<ValidatingCombobox*>( |
| 438 delegate_->dialog_view()->GetViewByID(static_cast<int>(type))); |
| 439 DCHECK(combobox); |
| 440 return combobox->model()->GetItemAt(combobox->selected_index()); |
| 441 } |
| 442 |
427 void PaymentRequestBrowserTestBase::SetComboboxValue( | 443 void PaymentRequestBrowserTestBase::SetComboboxValue( |
428 const base::string16& value, | 444 const base::string16& value, |
429 autofill::ServerFieldType type) { | 445 autofill::ServerFieldType type) { |
430 ValidatingCombobox* combobox = static_cast<ValidatingCombobox*>( | 446 ValidatingCombobox* combobox = static_cast<ValidatingCombobox*>( |
431 delegate_->dialog_view()->GetViewByID(static_cast<int>(type))); | 447 delegate_->dialog_view()->GetViewByID(static_cast<int>(type))); |
432 DCHECK(combobox); | 448 DCHECK(combobox); |
433 combobox->SelectValue(value); | 449 combobox->SelectValue(value); |
434 combobox->OnContentsChanged(); | 450 combobox->OnContentsChanged(); |
435 combobox->OnBlur(); | 451 combobox->OnBlur(); |
436 } | 452 } |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 std::list<DialogEvent> event_sequence) { | 541 std::list<DialogEvent> event_sequence) { |
526 event_observer_ = | 542 event_observer_ = |
527 base::MakeUnique<DialogEventObserver>(std::move(event_sequence)); | 543 base::MakeUnique<DialogEventObserver>(std::move(event_sequence)); |
528 } | 544 } |
529 | 545 |
530 void PaymentRequestBrowserTestBase::WaitForObservedEvent() { | 546 void PaymentRequestBrowserTestBase::WaitForObservedEvent() { |
531 event_observer_->Wait(); | 547 event_observer_->Wait(); |
532 } | 548 } |
533 | 549 |
534 } // namespace payments | 550 } // namespace payments |
OLD | NEW |