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

Unified Diff: chrome/browser/ui/views/payments/error_message_view_controller_browsertest.cc

Issue 2768093006: [Payments] Desktop: Error message in the dialog. (Closed)
Patch Set: Test Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/payments/error_message_view_controller_browsertest.cc
diff --git a/chrome/browser/ui/views/payments/error_message_view_controller_browsertest.cc b/chrome/browser/ui/views/payments/error_message_view_controller_browsertest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ef726c82c733523bce1f566799bf6a354f3fed5d
--- /dev/null
+++ b/chrome/browser/ui/views/payments/error_message_view_controller_browsertest.cc
@@ -0,0 +1,46 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <vector>
+
+#include "base/macros.h"
+#include "chrome/browser/ui/views/payments/payment_request_browsertest_base.h"
+#include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h"
+#include "chrome/test/base/ui_test_utils.h"
+#include "components/autofill/core/browser/autofill_test_utils.h"
+#include "components/autofill/core/browser/credit_card.h"
+#include "content/public/test/browser_test_utils.h"
+
+namespace payments {
+
+class PaymentRequestErrorMessageTest : public PaymentRequestBrowserTestBase {
+ protected:
+ PaymentRequestErrorMessageTest()
+ : PaymentRequestBrowserTestBase(
+ "/payment_request_fail_complete_test.html") {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(PaymentRequestErrorMessageTest);
+};
+
+// Testing the use of the complete('fail') JS API and the error message.
+IN_PROC_BROWSER_TEST_F(PaymentRequestErrorMessageTest, CompleteFail) {
+ AddCreditCard(autofill::test::GetCreditCard()); // Visa
+ InvokePaymentRequestUI();
+
+ // We are ready to pay.
+ ASSERT_TRUE(IsPayButtonEnabled());
+
+ // Once "Pay" is clicked, the page will call complete('fail') and the error
+ // message should be shown.
+ ResetEventObserver(DialogEvent::ERROR_MESSAGE_SHOWN);
+ ClickOnDialogViewAndWait(DialogViewID::PAY_BUTTON);
+
+ // The user can only close the dialog at this point.
+ ResetEventObserver(DialogEvent::DIALOG_CLOSED);
+ ClickOnDialogViewAndWait(DialogViewID::CANCEL_BUTTON,
+ /*wait_for_animation=*/false);
+}
+
+} // namespace payments

Powered by Google App Engine
This is Rietveld 408576698