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 "base/strings/utf_string_conversions.h" | 5 #include "base/strings/utf_string_conversions.h" |
6 #include "chrome/browser/ui/views/payments/payment_request_browsertest_base.h" | 6 #include "chrome/browser/ui/views/payments/payment_request_browsertest_base.h" |
| 7 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" |
7 #include "components/autofill/core/browser/autofill_test_utils.h" | 8 #include "components/autofill/core/browser/autofill_test_utils.h" |
8 | 9 |
9 namespace payments { | 10 namespace payments { |
10 | 11 |
11 class PaymentRequestCvcUnmaskViewControllerTest | 12 class PaymentRequestCvcUnmaskViewControllerTest |
12 : public PaymentRequestBrowserTestBase { | 13 : public PaymentRequestBrowserTestBase { |
13 protected: | 14 protected: |
14 PaymentRequestCvcUnmaskViewControllerTest() | 15 PaymentRequestCvcUnmaskViewControllerTest() |
15 : PaymentRequestBrowserTestBase( | 16 : PaymentRequestBrowserTestBase( |
16 "/payment_request_no_shipping_test.html") {} | 17 "/payment_request_no_shipping_test.html") {} |
(...skipping 23 matching lines...) Expand all Loading... |
40 OpenCVCPromptWithCVC(base::ASCIIToUTF16("012")); | 41 OpenCVCPromptWithCVC(base::ASCIIToUTF16("012")); |
41 | 42 |
42 // Go back before confirming the CVC. | 43 // Go back before confirming the CVC. |
43 ClickOnBackArrow(); | 44 ClickOnBackArrow(); |
44 | 45 |
45 // Now pay for real. | 46 // Now pay for real. |
46 PayWithCreditCardAndWait(base::ASCIIToUTF16("012")); | 47 PayWithCreditCardAndWait(base::ASCIIToUTF16("012")); |
47 ExpectBodyContains({"\"cardSecurityCode\": \"012\""}); | 48 ExpectBodyContains({"\"cardSecurityCode\": \"012\""}); |
48 } | 49 } |
49 | 50 |
| 51 IN_PROC_BROWSER_TEST_F(PaymentRequestCvcUnmaskViewControllerTest, |
| 52 EnterAcceleratorConfirmsCvc) { |
| 53 AddCreditCard(autofill::test::GetCreditCard()); // Visa. |
| 54 |
| 55 InvokePaymentRequestUI(); |
| 56 ResetEventObserver(DialogEvent::DIALOG_CLOSED); |
| 57 OpenCVCPromptWithCVC(base::ASCIIToUTF16("012")); |
| 58 |
| 59 ResetEventObserver(DialogEvent::DIALOG_CLOSED); |
| 60 views::View* cvc_sheet = dialog_view()->GetViewByID( |
| 61 static_cast<int>(DialogViewID::CVC_UNMASK_SHEET)); |
| 62 cvc_sheet->AcceleratorPressed(ui::Accelerator(ui::VKEY_RETURN, ui::EF_NONE)); |
| 63 WaitForAnimation(); |
| 64 WaitForObservedEvent(); |
| 65 |
| 66 ExpectBodyContains({"\"cardSecurityCode\": \"012\""}); |
| 67 } |
| 68 |
50 } // namespace payments | 69 } // namespace payments |
OLD | NEW |