| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/ui/views/payments/payment_request_browsertest_base.h" | 9 #include "chrome/browser/ui/views/payments/payment_request_browsertest_base.h" |
| 9 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" | 10 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" |
| 10 #include "chrome/test/base/ui_test_utils.h" | 11 #include "chrome/test/base/ui_test_utils.h" |
| 11 #include "components/autofill/core/browser/autofill_test_utils.h" | 12 #include "components/autofill/core/browser/autofill_test_utils.h" |
| 12 #include "components/autofill/core/browser/credit_card.h" | 13 #include "components/autofill/core/browser/credit_card.h" |
| 13 #include "content/public/test/browser_test_utils.h" | 14 #include "content/public/test/browser_test_utils.h" |
| 14 | 15 |
| 15 namespace payments { | 16 namespace payments { |
| 16 | 17 |
| 17 class PaymentRequestErrorMessageTest : public PaymentRequestBrowserTestBase { | 18 class PaymentRequestErrorMessageTest : public PaymentRequestBrowserTestBase { |
| 18 protected: | 19 protected: |
| 19 PaymentRequestErrorMessageTest() | 20 PaymentRequestErrorMessageTest() |
| 20 : PaymentRequestBrowserTestBase( | 21 : PaymentRequestBrowserTestBase( |
| 21 "/payment_request_fail_complete_test.html") {} | 22 "/payment_request_fail_complete_test.html") {} |
| 22 | 23 |
| 23 private: | 24 private: |
| 24 DISALLOW_COPY_AND_ASSIGN(PaymentRequestErrorMessageTest); | 25 DISALLOW_COPY_AND_ASSIGN(PaymentRequestErrorMessageTest); |
| 25 }; | 26 }; |
| 26 | 27 |
| 27 // Testing the use of the complete('fail') JS API and the error message. | 28 // Testing the use of the complete('fail') JS API and the error message. |
| 28 IN_PROC_BROWSER_TEST_F(PaymentRequestErrorMessageTest, CompleteFail) { | 29 IN_PROC_BROWSER_TEST_F(PaymentRequestErrorMessageTest, CompleteFail) { |
| 29 AddCreditCard(autofill::test::GetCreditCard()); // Visa | 30 AddCreditCard(autofill::test::GetCreditCard()); // Visa |
| 30 InvokePaymentRequestUI(); | 31 InvokePaymentRequestUI(); |
| 31 | 32 |
| 32 // We are ready to pay. | 33 // We are ready to pay. |
| 33 ASSERT_TRUE(IsPayButtonEnabled()); | 34 ASSERT_TRUE(IsPayButtonEnabled()); |
| 34 | 35 |
| 35 // Once "Pay" is clicked, the page will call complete('fail') and the error | 36 // Once "Pay" is clicked, the page will call complete('fail') and the error |
| 36 // message should be shown. | 37 // message should be shown. |
| 38 OpenCVCPromptWithCVC(base::ASCIIToUTF16("123")); |
| 39 |
| 37 ResetEventObserver(DialogEvent::ERROR_MESSAGE_SHOWN); | 40 ResetEventObserver(DialogEvent::ERROR_MESSAGE_SHOWN); |
| 38 ClickOnDialogViewAndWait(DialogViewID::PAY_BUTTON); | 41 ClickOnDialogViewAndWait(DialogViewID::CVC_PROMPT_CONFIRM_BUTTON); |
| 39 | 42 |
| 40 // The user can only close the dialog at this point. | 43 // The user can only close the dialog at this point. |
| 41 ResetEventObserver(DialogEvent::DIALOG_CLOSED); | 44 ResetEventObserver(DialogEvent::DIALOG_CLOSED); |
| 42 ClickOnDialogViewAndWait(DialogViewID::CANCEL_BUTTON, | 45 ClickOnDialogViewAndWait(DialogViewID::CANCEL_BUTTON, |
| 43 /*wait_for_animation=*/false); | 46 /*wait_for_animation=*/false); |
| 44 } | 47 } |
| 45 | 48 |
| 46 } // namespace payments | 49 } // namespace payments |
| OLD | NEW |