Chromium Code Reviews| 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 "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 "components/autofill/core/browser/autofill_test_utils.h" | 10 #include "components/autofill/core/browser/autofill_test_utils.h" |
| 11 #include "components/autofill/core/browser/credit_card.h" | 11 #include "components/autofill/core/browser/credit_card.h" |
| 12 #include "content/public/test/browser_test_utils.h" | 12 #include "content/public/test/browser_test_utils.h" |
| 13 | 13 |
| 14 namespace payments { | 14 namespace payments { |
| 15 | 15 |
| 16 class PaymentRequestCanMakePaymentQueryTest | 16 class PaymentRequestCanMakePaymentQueryTest |
| 17 : public PaymentRequestBrowserTestBase { | 17 : public PaymentRequestBrowserTestBase { |
| 18 protected: | 18 protected: |
| 19 PaymentRequestCanMakePaymentQueryTest() | 19 PaymentRequestCanMakePaymentQueryTest() |
| 20 : PaymentRequestBrowserTestBase( | 20 : PaymentRequestBrowserTestBase( |
| 21 "/payment_request_can_make_payment_query_test.html") {} | 21 "/payment_request_can_make_payment_query_test.html") {} |
| 22 | 22 |
| 23 void CallCanMakePayment() { | 23 void CallCanMakePayment() { |
| 24 ResetEventObserver(DialogEvent::CAN_MAKE_PAYMENT_CALLED); | |
| 24 ASSERT_TRUE(content::ExecuteScript(GetActiveWebContents(), "buy();")); | 25 ASSERT_TRUE(content::ExecuteScript(GetActiveWebContents(), "buy();")); |
| 26 WaitForObservedEvent(); | |
| 25 } | 27 } |
| 26 | 28 |
| 27 private: | 29 private: |
| 28 DISALLOW_COPY_AND_ASSIGN(PaymentRequestCanMakePaymentQueryTest); | 30 DISALLOW_COPY_AND_ASSIGN(PaymentRequestCanMakePaymentQueryTest); |
| 29 }; | 31 }; |
| 30 | 32 |
| 31 // Visa is required, and user has a visa instrument. | 33 // Visa is required, and user has a visa instrument. |
| 32 // Test is flaky. crbug.com/705225 | |
| 33 IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentQueryTest, | 34 IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentQueryTest, |
| 34 DISABLED_CanMakePayment_Supported) { | 35 CanMakePayment_Supported) { |
| 35 const autofill::CreditCard card = autofill::test::GetCreditCard(); // Visa. | 36 const autofill::CreditCard card = autofill::test::GetCreditCard(); // Visa. |
| 36 AddCreditCard(card); | 37 AddCreditCard(card); |
| 37 | 38 |
| 38 CallCanMakePayment(); | 39 CallCanMakePayment(); |
| 39 | 40 |
| 40 ExpectBodyContains(std::vector<base::string16>{base::ASCIIToUTF16("true")}); | 41 ExpectBodyContains(std::vector<base::string16>{base::ASCIIToUTF16("true")}); |
| 41 } | 42 } |
| 42 | 43 |
| 43 // Visa is required, and user has a visa instrument, and user is in incognito | 44 // Visa is required, and user has a visa instrument, and user is in incognito |
| 44 // mode. | 45 // mode. |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 60 const autofill::CreditCard card = autofill::test::GetCreditCard2(); // Amex. | 61 const autofill::CreditCard card = autofill::test::GetCreditCard2(); // Amex. |
| 61 AddCreditCard(card); | 62 AddCreditCard(card); |
| 62 | 63 |
| 63 CallCanMakePayment(); | 64 CallCanMakePayment(); |
| 64 | 65 |
| 65 ExpectBodyContains(std::vector<base::string16>{base::ASCIIToUTF16("false")}); | 66 ExpectBodyContains(std::vector<base::string16>{base::ASCIIToUTF16("false")}); |
| 66 } | 67 } |
| 67 | 68 |
| 68 // Visa is required, and user doesn't have a visa instrument and the user is in | 69 // Visa is required, and user doesn't have a visa instrument and the user is in |
| 69 // incognito mode. | 70 // incognito mode. |
| 70 // Test is flaky. crbug.com/705271 | |
| 71 IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentQueryTest, | 71 IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentQueryTest, |
| 72 DISABLED_CanMakePayment_NotSupported_Incognito) { | 72 CanMakePayment_NotSupported_Incognito) { |
|
please use gerrit instead
2017/03/27 18:12:32
NotSupported seems like the wrong phrase. Should i
Mathieu
2017/03/27 18:28:24
It's the name of the test case. We are calling Can
| |
| 73 SetIncognitoForTesting(); | 73 SetIncognitoForTesting(); |
| 74 | 74 |
| 75 const autofill::CreditCard card = autofill::test::GetCreditCard2(); // Amex. | 75 const autofill::CreditCard card = autofill::test::GetCreditCard2(); // Amex. |
| 76 AddCreditCard(card); | 76 AddCreditCard(card); |
| 77 | 77 |
| 78 CallCanMakePayment(); | 78 CallCanMakePayment(); |
| 79 | 79 |
| 80 // Returns true because the user is in incognito mode, even though it should | 80 // Returns true because the user is in incognito mode, even though it should |
| 81 // return false in a normal profile. | 81 // return false in a normal profile. |
| 82 ExpectBodyContains(std::vector<base::string16>{base::ASCIIToUTF16("true")}); | 82 ExpectBodyContains(std::vector<base::string16>{base::ASCIIToUTF16("true")}); |
| 83 } | 83 } |
| 84 | 84 |
| 85 } // namespace payments | 85 } // namespace payments |
| OLD | NEW |