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/browser_commands.h" | 9 #include "chrome/browser/ui/browser_commands.h" |
| 10 #include "chrome/browser/ui/views/payments/payment_request_browsertest_base.h" | 10 #include "chrome/browser/ui/views/payments/payment_request_browsertest_base.h" |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 DISALLOW_COPY_AND_ASSIGN(PaymentRequestWebContentsManagerTest); | 31 DISALLOW_COPY_AND_ASSIGN(PaymentRequestWebContentsManagerTest); |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 // If the page creates multiple PaymentRequest objects, it should not crash. | 34 // If the page creates multiple PaymentRequest objects, it should not crash. |
| 35 IN_PROC_BROWSER_TEST_F(PaymentRequestWebContentsManagerTest, MultipleRequests) { | 35 IN_PROC_BROWSER_TEST_F(PaymentRequestWebContentsManagerTest, MultipleRequests) { |
| 36 const std::vector<PaymentRequest*> payment_requests = | 36 const std::vector<PaymentRequest*> payment_requests = |
| 37 GetPaymentRequests(GetActiveWebContents()); | 37 GetPaymentRequests(GetActiveWebContents()); |
| 38 EXPECT_EQ(5U, payment_requests.size()); | 38 EXPECT_EQ(5U, payment_requests.size()); |
| 39 } | 39 } |
| 40 | 40 |
| 41 class PaymentRequestNoShippingTest : public PaymentRequestBrowserTestBase { | 41 class PaymentRequestNoShippingTest : public PaymentRequestBrowserTestBase { |
|
Mathieu
2017/04/17 03:20:45
Do you think we could have a test that tries to sh
please use gerrit instead
2017/04/17 18:19:54
Done.
| |
| 42 protected: | 42 protected: |
| 43 PaymentRequestNoShippingTest() | 43 PaymentRequestNoShippingTest() |
| 44 : PaymentRequestBrowserTestBase( | 44 : PaymentRequestBrowserTestBase( |
| 45 "/payment_request_no_shipping_test.html") {} | 45 "/payment_request_no_shipping_test.html") {} |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 DISALLOW_COPY_AND_ASSIGN(PaymentRequestNoShippingTest); | 48 DISALLOW_COPY_AND_ASSIGN(PaymentRequestNoShippingTest); |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 IN_PROC_BROWSER_TEST_F(PaymentRequestNoShippingTest, OpenAndNavigateTo404) { | 51 IN_PROC_BROWSER_TEST_F(PaymentRequestNoShippingTest, OpenAndNavigateTo404) { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 | 111 |
| 112 InvokePaymentRequestUI(); | 112 InvokePaymentRequestUI(); |
| 113 | 113 |
| 114 ResetEventObserver(DialogEvent::DIALOG_CLOSED); | 114 ResetEventObserver(DialogEvent::DIALOG_CLOSED); |
| 115 | 115 |
| 116 PayWithCreditCardAndWait(base::ASCIIToUTF16("123")); | 116 PayWithCreditCardAndWait(base::ASCIIToUTF16("123")); |
| 117 | 117 |
| 118 WaitForObservedEvent(); | 118 WaitForObservedEvent(); |
| 119 | 119 |
| 120 // The actual structure of the card response is unit-tested. | 120 // The actual structure of the card response is unit-tested. |
| 121 ExpectBodyContains(std::vector<base::string16>{ | 121 ExpectBodyContains({card.GetRawInfo(autofill::CREDIT_CARD_NUMBER), |
| 122 card.GetRawInfo(autofill::CREDIT_CARD_NUMBER), | 122 card.GetRawInfo(autofill::CREDIT_CARD_NAME_FULL), |
| 123 card.GetRawInfo(autofill::CREDIT_CARD_NAME_FULL), | 123 card.GetRawInfo(autofill::CREDIT_CARD_EXP_MONTH), |
| 124 card.GetRawInfo(autofill::CREDIT_CARD_EXP_MONTH), | 124 card.GetRawInfo(autofill::CREDIT_CARD_EXP_4_DIGIT_YEAR)}); |
| 125 card.GetRawInfo(autofill::CREDIT_CARD_EXP_4_DIGIT_YEAR)}); | 125 ExpectBodyContains( |
| 126 ExpectBodyContains(std::vector<base::string16>{ | 126 {billing_address.GetRawInfo(autofill::NAME_FIRST), |
| 127 billing_address.GetRawInfo(autofill::NAME_FIRST), | 127 billing_address.GetRawInfo(autofill::NAME_LAST), |
| 128 billing_address.GetRawInfo(autofill::NAME_LAST), | 128 billing_address.GetRawInfo(autofill::ADDRESS_HOME_LINE1), |
| 129 billing_address.GetRawInfo(autofill::ADDRESS_HOME_LINE1), | 129 billing_address.GetRawInfo(autofill::ADDRESS_HOME_LINE2), |
| 130 billing_address.GetRawInfo(autofill::ADDRESS_HOME_LINE2), | 130 billing_address.GetRawInfo(autofill::ADDRESS_HOME_COUNTRY), |
| 131 billing_address.GetRawInfo(autofill::ADDRESS_HOME_COUNTRY), | 131 billing_address.GetRawInfo(autofill::ADDRESS_HOME_ZIP), |
| 132 billing_address.GetRawInfo(autofill::ADDRESS_HOME_ZIP), | 132 billing_address.GetRawInfo(autofill::ADDRESS_HOME_CITY), |
| 133 billing_address.GetRawInfo(autofill::ADDRESS_HOME_CITY), | 133 billing_address.GetRawInfo(autofill::ADDRESS_HOME_STATE)}); |
| 134 billing_address.GetRawInfo(autofill::ADDRESS_HOME_STATE)}); | |
| 135 } | 134 } |
| 136 | 135 |
| 137 class PaymentRequestAbortTest : public PaymentRequestBrowserTestBase { | 136 class PaymentRequestAbortTest : public PaymentRequestBrowserTestBase { |
| 138 protected: | 137 protected: |
| 139 PaymentRequestAbortTest() | 138 PaymentRequestAbortTest() |
| 140 : PaymentRequestBrowserTestBase("/payment_request_abort_test.html") {} | 139 : PaymentRequestBrowserTestBase("/payment_request_abort_test.html") {} |
| 141 | 140 |
| 142 private: | 141 private: |
| 143 DISALLOW_COPY_AND_ASSIGN(PaymentRequestAbortTest); | 142 DISALLOW_COPY_AND_ASSIGN(PaymentRequestAbortTest); |
| 144 }; | 143 }; |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 295 EXPECT_EQ(1u, requests.size()); | 294 EXPECT_EQ(1u, requests.size()); |
| 296 std::vector<std::string> supported_card_networks = | 295 std::vector<std::string> supported_card_networks = |
| 297 requests[0]->spec()->supported_card_networks(); | 296 requests[0]->spec()->supported_card_networks(); |
| 298 EXPECT_EQ(3u, supported_card_networks.size()); | 297 EXPECT_EQ(3u, supported_card_networks.size()); |
| 299 EXPECT_EQ("mastercard", supported_card_networks[0]); | 298 EXPECT_EQ("mastercard", supported_card_networks[0]); |
| 300 EXPECT_EQ("visa", supported_card_networks[1]); | 299 EXPECT_EQ("visa", supported_card_networks[1]); |
| 301 EXPECT_EQ("jcb", supported_card_networks[2]); | 300 EXPECT_EQ("jcb", supported_card_networks[2]); |
| 302 } | 301 } |
| 303 | 302 |
| 304 } // namespace payments | 303 } // namespace payments |
| OLD | NEW |