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