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

Side by Side Diff: chrome/browser/ui/views/payments/payment_request_browsertest_base.cc

Issue 2779283002: [Web Payments] Implement the CVC Unmask dialog. (Closed)
Patch Set: BUILD Created 3 years, 8 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 unified diff | Download patch
OLDNEW
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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 void PaymentRequestBrowserTestBase::OnErrorMessageShown() { 144 void PaymentRequestBrowserTestBase::OnErrorMessageShown() {
145 if (event_observer_) 145 if (event_observer_)
146 event_observer_->Observe(DialogEvent::ERROR_MESSAGE_SHOWN); 146 event_observer_->Observe(DialogEvent::ERROR_MESSAGE_SHOWN);
147 } 147 }
148 148
149 void PaymentRequestBrowserTestBase::OnSpecDoneUpdating() { 149 void PaymentRequestBrowserTestBase::OnSpecDoneUpdating() {
150 if (event_observer_) 150 if (event_observer_)
151 event_observer_->Observe(DialogEvent::SPEC_DONE_UPDATING); 151 event_observer_->Observe(DialogEvent::SPEC_DONE_UPDATING);
152 } 152 }
153 153
154 void PaymentRequestBrowserTestBase::OnCvcPromptShown() {
155 if (event_observer_)
156 event_observer_->Observe(DialogEvent::CVC_PROMPT_SHOWN);
157 }
158
154 void PaymentRequestBrowserTestBase::OnWidgetDestroyed(views::Widget* widget) { 159 void PaymentRequestBrowserTestBase::OnWidgetDestroyed(views::Widget* widget) {
155 if (event_observer_) 160 if (event_observer_)
156 event_observer_->Observe(DialogEvent::DIALOG_CLOSED); 161 event_observer_->Observe(DialogEvent::DIALOG_CLOSED);
157 } 162 }
158 163
159 void PaymentRequestBrowserTestBase::InvokePaymentRequestUI() { 164 void PaymentRequestBrowserTestBase::InvokePaymentRequestUI() {
160 ResetEventObserver(DialogEvent::DIALOG_OPENED); 165 ResetEventObserver(DialogEvent::DIALOG_OPENED);
161 166
162 content::WebContents* web_contents = GetActiveWebContents(); 167 content::WebContents* web_contents = GetActiveWebContents();
163 const std::string click_buy_button_js = 168 const std::string click_buy_button_js =
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 static_cast<int>(DialogViewID::SHIPPING_OPTION_DESCRIPTION)); 376 static_cast<int>(DialogViewID::SHIPPING_OPTION_DESCRIPTION));
372 DCHECK(view); 377 DCHECK(view);
373 labels.push_back(static_cast<views::Label*>(view)->text()); 378 labels.push_back(static_cast<views::Label*>(view)->text());
374 view = parent_view->GetViewByID( 379 view = parent_view->GetViewByID(
375 static_cast<int>(DialogViewID::SHIPPING_OPTION_AMOUNT)); 380 static_cast<int>(DialogViewID::SHIPPING_OPTION_AMOUNT));
376 DCHECK(view); 381 DCHECK(view);
377 labels.push_back(static_cast<views::Label*>(view)->text()); 382 labels.push_back(static_cast<views::Label*>(view)->text());
378 return labels; 383 return labels;
379 } 384 }
380 385
386 void PaymentRequestBrowserTestBase::OpenCVCPromptWithCVC(
387 const base::string16& cvc) {
388 ResetEventObserver(DialogEvent::CVC_PROMPT_SHOWN);
389 ClickOnDialogViewAndWait(DialogViewID::PAY_BUTTON);
390
391 views::Textfield* cvc_field =
392 static_cast<views::Textfield*>(delegate_->dialog_view()->GetViewByID(
393 static_cast<int>(DialogViewID::CVC_PROMPT_TEXT_FIELD)));
394 cvc_field->SetText(cvc);
395 }
396
397 void PaymentRequestBrowserTestBase::PayWithCreditCardAndWait(
398 const base::string16& cvc) {
399 OpenCVCPromptWithCVC(cvc);
400
401 ResetEventObserver(DialogEvent::DIALOG_CLOSED);
402 ClickOnDialogViewAndWait(DialogViewID::CVC_PROMPT_CONFIRM_BUTTON);
403 }
404
381 void PaymentRequestBrowserTestBase::SetEditorTextfieldValue( 405 void PaymentRequestBrowserTestBase::SetEditorTextfieldValue(
382 const base::string16& value, 406 const base::string16& value,
383 autofill::ServerFieldType type) { 407 autofill::ServerFieldType type) {
384 ValidatingTextfield* textfield = static_cast<ValidatingTextfield*>( 408 ValidatingTextfield* textfield = static_cast<ValidatingTextfield*>(
385 delegate_->dialog_view()->GetViewByID(static_cast<int>(type))); 409 delegate_->dialog_view()->GetViewByID(static_cast<int>(type)));
386 DCHECK(textfield); 410 DCHECK(textfield);
387 textfield->SetText(value); 411 textfield->SetText(value);
388 textfield->OnContentsChanged(); 412 textfield->OnContentsChanged();
389 textfield->OnBlur(); 413 textfield->OnBlur();
390 } 414 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 std::list<DialogEvent> event_sequence) { 514 std::list<DialogEvent> event_sequence) {
491 event_observer_ = 515 event_observer_ =
492 base::MakeUnique<DialogEventObserver>(std::move(event_sequence)); 516 base::MakeUnique<DialogEventObserver>(std::move(event_sequence));
493 } 517 }
494 518
495 void PaymentRequestBrowserTestBase::WaitForObservedEvent() { 519 void PaymentRequestBrowserTestBase::WaitForObservedEvent() {
496 event_observer_->Wait(); 520 event_observer_->Wait();
497 } 521 }
498 522
499 } // namespace payments 523 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698