Chromium Code Reviews| 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 "base/strings/utf_string_conversions.h" | |
| 9 #include "chrome/browser/ui/views/payments/payment_request_browsertest_base.h" | |
| 10 #include "components/autofill/core/browser/autofill_test_utils.h" | |
| 11 #include "components/autofill/core/browser/credit_card.h" | |
| 12 #include "content/public/test/browser_test_utils.h" | |
| 13 | |
| 14 namespace payments { | |
| 15 | |
| 16 class PaymentRequestCanMakePaymentQueryTest | |
| 17 : public PaymentRequestBrowserTestBase { | |
| 18 protected: | |
| 19 PaymentRequestCanMakePaymentQueryTest() | |
| 20 : PaymentRequestBrowserTestBase( | |
| 21 "/payment_request_can_make_payment_query_test.html") {} | |
|
please use gerrit instead
2017/03/24 14:47:25
Need to override the destructor.
Mathieu
2017/03/24 15:38:40
Acknowledged.
| |
| 22 | |
| 23 void CallCanMakePayment() { | |
| 24 ASSERT_TRUE(content::ExecuteScript(GetActiveWebContents(), "buy();")); | |
| 25 } | |
| 26 | |
| 27 private: | |
| 28 DISALLOW_COPY_AND_ASSIGN(PaymentRequestCanMakePaymentQueryTest); | |
| 29 }; | |
| 30 | |
| 31 // Visa is required, and user has a visa instrument. | |
| 32 IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentQueryTest, | |
| 33 CanMakePayment_Supported) { | |
| 34 const autofill::CreditCard card = autofill::test::GetCreditCard(); // Visa. | |
| 35 AddCreditCard(card); | |
| 36 | |
| 37 CallCanMakePayment(); | |
| 38 | |
| 39 ExpectBodyContains(std::vector<base::string16>{base::ASCIIToUTF16("true")}); | |
| 40 } | |
| 41 | |
| 42 // Visa is required, and user doesn't have a visa instrument. | |
| 43 IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentQueryTest, | |
| 44 CanMakePayment_NotSupported) { | |
| 45 const autofill::CreditCard card = autofill::test::GetCreditCard2(); // Amex. | |
| 46 AddCreditCard(card); | |
| 47 | |
| 48 CallCanMakePayment(); | |
| 49 | |
| 50 ExpectBodyContains(std::vector<base::string16>{base::ASCIIToUTF16("false")}); | |
| 51 } | |
| 52 | |
| 53 } // namespace payments | |
| OLD | NEW |