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 100 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)}); | 134 } |
| 135 |
| 136 IN_PROC_BROWSER_TEST_F(PaymentRequestNoShippingTest, InvalidSSL) { |
| 137 SetInvalidSsl(); |
| 138 |
| 139 autofill::AutofillProfile billing_address = autofill::test::GetFullProfile(); |
| 140 AddAutofillProfile(billing_address); |
| 141 autofill::CreditCard card = autofill::test::GetCreditCard(); |
| 142 card.set_billing_address_id(billing_address.guid()); |
| 143 AddCreditCard(card); // Visa. |
| 144 |
| 145 ResetEventObserver(DialogEvent::NOT_SUPPORTED_ERROR); |
| 146 |
| 147 EXPECT_TRUE(content::ExecuteScript( |
| 148 GetActiveWebContents(), |
| 149 "(function() { document.getElementById('buy').click(); })();")); |
| 150 |
| 151 WaitForObservedEvent(); |
| 152 |
| 153 ExpectBodyContains({"NotSupportedError"}); |
135 } | 154 } |
136 | 155 |
137 class PaymentRequestAbortTest : public PaymentRequestBrowserTestBase { | 156 class PaymentRequestAbortTest : public PaymentRequestBrowserTestBase { |
138 protected: | 157 protected: |
139 PaymentRequestAbortTest() | 158 PaymentRequestAbortTest() |
140 : PaymentRequestBrowserTestBase("/payment_request_abort_test.html") {} | 159 : PaymentRequestBrowserTestBase("/payment_request_abort_test.html") {} |
141 | 160 |
142 private: | 161 private: |
143 DISALLOW_COPY_AND_ASSIGN(PaymentRequestAbortTest); | 162 DISALLOW_COPY_AND_ASSIGN(PaymentRequestAbortTest); |
144 }; | 163 }; |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 EXPECT_EQ(1u, requests.size()); | 314 EXPECT_EQ(1u, requests.size()); |
296 std::vector<std::string> supported_card_networks = | 315 std::vector<std::string> supported_card_networks = |
297 requests[0]->spec()->supported_card_networks(); | 316 requests[0]->spec()->supported_card_networks(); |
298 EXPECT_EQ(3u, supported_card_networks.size()); | 317 EXPECT_EQ(3u, supported_card_networks.size()); |
299 EXPECT_EQ("mastercard", supported_card_networks[0]); | 318 EXPECT_EQ("mastercard", supported_card_networks[0]); |
300 EXPECT_EQ("visa", supported_card_networks[1]); | 319 EXPECT_EQ("visa", supported_card_networks[1]); |
301 EXPECT_EQ("jcb", supported_card_networks[2]); | 320 EXPECT_EQ("jcb", supported_card_networks[2]); |
302 } | 321 } |
303 | 322 |
304 } // namespace payments | 323 } // namespace payments |
OLD | NEW |