| 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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 } | 395 } |
| 396 | 396 |
| 397 void PaymentRequestBrowserTestBase::PayWithCreditCardAndWait( | 397 void PaymentRequestBrowserTestBase::PayWithCreditCardAndWait( |
| 398 const base::string16& cvc) { | 398 const base::string16& cvc) { |
| 399 OpenCVCPromptWithCVC(cvc); | 399 OpenCVCPromptWithCVC(cvc); |
| 400 | 400 |
| 401 ResetEventObserver(DialogEvent::DIALOG_CLOSED); | 401 ResetEventObserver(DialogEvent::DIALOG_CLOSED); |
| 402 ClickOnDialogViewAndWait(DialogViewID::CVC_PROMPT_CONFIRM_BUTTON); | 402 ClickOnDialogViewAndWait(DialogViewID::CVC_PROMPT_CONFIRM_BUTTON); |
| 403 } | 403 } |
| 404 | 404 |
| 405 base::string16 PaymentRequestBrowserTestBase::GetEditorTextfieldValue( |
| 406 autofill::ServerFieldType type) { |
| 407 ValidatingTextfield* textfield = static_cast<ValidatingTextfield*>( |
| 408 delegate_->dialog_view()->GetViewByID(static_cast<int>(type))); |
| 409 DCHECK(textfield); |
| 410 return textfield->text(); |
| 411 } |
| 412 |
| 405 void PaymentRequestBrowserTestBase::SetEditorTextfieldValue( | 413 void PaymentRequestBrowserTestBase::SetEditorTextfieldValue( |
| 406 const base::string16& value, | 414 const base::string16& value, |
| 407 autofill::ServerFieldType type) { | 415 autofill::ServerFieldType type) { |
| 408 ValidatingTextfield* textfield = static_cast<ValidatingTextfield*>( | 416 ValidatingTextfield* textfield = static_cast<ValidatingTextfield*>( |
| 409 delegate_->dialog_view()->GetViewByID(static_cast<int>(type))); | 417 delegate_->dialog_view()->GetViewByID(static_cast<int>(type))); |
| 410 DCHECK(textfield); | 418 DCHECK(textfield); |
| 411 textfield->SetText(value); | 419 textfield->SetText(value); |
| 412 textfield->OnContentsChanged(); | 420 textfield->OnContentsChanged(); |
| 413 textfield->OnBlur(); | 421 textfield->OnBlur(); |
| 414 } | 422 } |
| 415 | 423 |
| 424 base::string16 PaymentRequestBrowserTestBase::GetComboboxValue( |
| 425 autofill::ServerFieldType type) { |
| 426 ValidatingCombobox* combobox = static_cast<ValidatingCombobox*>( |
| 427 delegate_->dialog_view()->GetViewByID(static_cast<int>(type))); |
| 428 DCHECK(combobox); |
| 429 return combobox->model()->GetItemAt(combobox->selected_index()); |
| 430 } |
| 431 |
| 416 void PaymentRequestBrowserTestBase::SetComboboxValue( | 432 void PaymentRequestBrowserTestBase::SetComboboxValue( |
| 417 const base::string16& value, | 433 const base::string16& value, |
| 418 autofill::ServerFieldType type) { | 434 autofill::ServerFieldType type) { |
| 419 ValidatingCombobox* combobox = static_cast<ValidatingCombobox*>( | 435 ValidatingCombobox* combobox = static_cast<ValidatingCombobox*>( |
| 420 delegate_->dialog_view()->GetViewByID(static_cast<int>(type))); | 436 delegate_->dialog_view()->GetViewByID(static_cast<int>(type))); |
| 421 DCHECK(combobox); | 437 DCHECK(combobox); |
| 422 combobox->SelectValue(value); | 438 combobox->SelectValue(value); |
| 423 combobox->OnContentsChanged(); | 439 combobox->OnContentsChanged(); |
| 424 combobox->OnBlur(); | 440 combobox->OnBlur(); |
| 425 } | 441 } |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 std::list<DialogEvent> event_sequence) { | 530 std::list<DialogEvent> event_sequence) { |
| 515 event_observer_ = | 531 event_observer_ = |
| 516 base::MakeUnique<DialogEventObserver>(std::move(event_sequence)); | 532 base::MakeUnique<DialogEventObserver>(std::move(event_sequence)); |
| 517 } | 533 } |
| 518 | 534 |
| 519 void PaymentRequestBrowserTestBase::WaitForObservedEvent() { | 535 void PaymentRequestBrowserTestBase::WaitForObservedEvent() { |
| 520 event_observer_->Wait(); | 536 event_observer_->Wait(); |
| 521 } | 537 } |
| 522 | 538 |
| 523 } // namespace payments | 539 } // namespace payments |
| OLD | NEW |