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

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

Issue 2849523003: Add billing address as a mandatory field of Payments credit cards. (Closed)
Patch Set: Components Unittests fix 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 <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 "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/ui/views/payments/payment_request_browsertest_base.h" 9 #include "chrome/browser/ui/views/payments/payment_request_browsertest_base.h"
10 #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"
11 #include "chrome/test/base/ui_test_utils.h" 11 #include "chrome/test/base/ui_test_utils.h"
12 #include "components/autofill/core/browser/autofill_test_utils.h" 12 #include "components/autofill/core/browser/autofill_test_utils.h"
13 #include "components/autofill/core/browser/credit_card.h" 13 #include "components/autofill/core/browser/credit_card.h"
14 #include "content/public/test/browser_test_utils.h" 14 #include "content/public/test/browser_test_utils.h"
15 15
16 namespace payments { 16 namespace payments {
17 17
18 class PaymentRequestErrorMessageTest : public PaymentRequestBrowserTestBase { 18 class PaymentRequestErrorMessageTest : public PaymentRequestBrowserTestBase {
19 protected: 19 protected:
20 PaymentRequestErrorMessageTest() 20 PaymentRequestErrorMessageTest()
21 : PaymentRequestBrowserTestBase( 21 : PaymentRequestBrowserTestBase(
22 "/payment_request_fail_complete_test.html") {} 22 "/payment_request_fail_complete_test.html") {}
23 23
24 private: 24 private:
25 DISALLOW_COPY_AND_ASSIGN(PaymentRequestErrorMessageTest); 25 DISALLOW_COPY_AND_ASSIGN(PaymentRequestErrorMessageTest);
26 }; 26 };
27 27
28 // 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.
29 IN_PROC_BROWSER_TEST_F(PaymentRequestErrorMessageTest, CompleteFail) { 29 IN_PROC_BROWSER_TEST_F(PaymentRequestErrorMessageTest, CompleteFail) {
30 AddCreditCard(autofill::test::GetCreditCard()); // Visa 30 autofill::AutofillProfile billing_profile(autofill::test::GetFullProfile());
31 PaymentRequestBrowserTestBase::AddAutofillProfile(billing_profile);
32 autofill::CreditCard card(autofill::test::GetCreditCard()); // Visa
33 card.set_billing_address_id(billing_profile.guid());
34 AddCreditCard(card);
31 InvokePaymentRequestUI(); 35 InvokePaymentRequestUI();
32 36
33 // We are ready to pay. 37 // We are ready to pay.
34 ASSERT_TRUE(IsPayButtonEnabled()); 38 ASSERT_TRUE(IsPayButtonEnabled());
35 39
36 // Once "Pay" is clicked, the page will call complete('fail') and the error 40 // Once "Pay" is clicked, the page will call complete('fail') and the error
37 // message should be shown. 41 // message should be shown.
38 OpenCVCPromptWithCVC(base::ASCIIToUTF16("123")); 42 OpenCVCPromptWithCVC(base::ASCIIToUTF16("123"));
39 43
40 ResetEventObserver(DialogEvent::ERROR_MESSAGE_SHOWN); 44 ResetEventObserver(DialogEvent::ERROR_MESSAGE_SHOWN);
41 ClickOnDialogViewAndWait(DialogViewID::CVC_PROMPT_CONFIRM_BUTTON); 45 ClickOnDialogViewAndWait(DialogViewID::CVC_PROMPT_CONFIRM_BUTTON);
42 46
43 // The user can only close the dialog at this point. 47 // The user can only close the dialog at this point.
44 ResetEventObserver(DialogEvent::DIALOG_CLOSED); 48 ResetEventObserver(DialogEvent::DIALOG_CLOSED);
45 ClickOnDialogViewAndWait(DialogViewID::CANCEL_BUTTON, 49 ClickOnDialogViewAndWait(DialogViewID::CANCEL_BUTTON,
46 /*wait_for_animation=*/false); 50 /*wait_for_animation=*/false);
47 } 51 }
48 52
49 } // namespace payments 53 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698