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

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

Issue 2844293002: [Payments] Handle clicking back on the CVC unmask dialog (Closed)
Patch Set: Test Created 3 years, 7 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 "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 "components/autofill/core/browser/autofill_test_utils.h" 7 #include "components/autofill/core/browser/autofill_test_utils.h"
8 8
9 namespace payments { 9 namespace payments {
10 10
11 class CvcUnmaskViewControllerTest : public PaymentRequestBrowserTestBase { 11 class PaymentRequestCvcUnmaskViewControllerTest
12 : public PaymentRequestBrowserTestBase {
12 protected: 13 protected:
13 CvcUnmaskViewControllerTest() 14 PaymentRequestCvcUnmaskViewControllerTest()
14 : PaymentRequestBrowserTestBase( 15 : PaymentRequestBrowserTestBase(
15 "/payment_request_no_shipping_test.html") {} 16 "/payment_request_no_shipping_test.html") {}
16 17
17 private: 18 private:
18 DISALLOW_COPY_AND_ASSIGN(CvcUnmaskViewControllerTest); 19 DISALLOW_COPY_AND_ASSIGN(PaymentRequestCvcUnmaskViewControllerTest);
19 }; 20 };
20 21
21 IN_PROC_BROWSER_TEST_F(CvcUnmaskViewControllerTest, CvcSentToResponse) { 22 IN_PROC_BROWSER_TEST_F(PaymentRequestCvcUnmaskViewControllerTest,
23 CvcSentToResponse) {
22 AddCreditCard(autofill::test::GetCreditCard()); // Visa. 24 AddCreditCard(autofill::test::GetCreditCard()); // Visa.
23 25
24 InvokePaymentRequestUI(); 26 InvokePaymentRequestUI();
25 ResetEventObserver(DialogEvent::DIALOG_CLOSED); 27 ResetEventObserver(DialogEvent::DIALOG_CLOSED);
26 PayWithCreditCardAndWait(base::ASCIIToUTF16("012")); 28 PayWithCreditCardAndWait(base::ASCIIToUTF16("012"));
27 29
28 ExpectBodyContains({"\"cardSecurityCode\": \"012\""}); 30 ExpectBodyContains({"\"cardSecurityCode\": \"012\""});
29 } 31 }
30 32
33 // Test that going in the CVC editor, backing out and opening it again to pay
34 // does not crash.
35 IN_PROC_BROWSER_TEST_F(PaymentRequestCvcUnmaskViewControllerTest,
36 OpenGoBackOpenPay) {
37 AddCreditCard(autofill::test::GetCreditCard()); // Visa.
38
39 InvokePaymentRequestUI();
40 OpenCVCPromptWithCVC(base::ASCIIToUTF16("012"));
41
42 // Go back before confirming the CVC.
43 ClickOnBackArrow();
44
45 // Now pay for real.
46 PayWithCreditCardAndWait(base::ASCIIToUTF16("012"));
47 ExpectBodyContains({"\"cardSecurityCode\": \"012\""});
48 }
49
31 } // namespace payments 50 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698