| 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 27 matching lines...) Expand all Loading... |
| 38 // Setup a credit card with an associated billing address. | 38 // Setup a credit card with an associated billing address. |
| 39 autofill::AutofillProfile billing_address = autofill::test::GetFullProfile(); | 39 autofill::AutofillProfile billing_address = autofill::test::GetFullProfile(); |
| 40 AddAutofillProfile(billing_address); | 40 AddAutofillProfile(billing_address); |
| 41 autofill::CreditCard card = autofill::test::GetCreditCard(); | 41 autofill::CreditCard card = autofill::test::GetCreditCard(); |
| 42 card.set_billing_address_id(billing_address.guid()); | 42 card.set_billing_address_id(billing_address.guid()); |
| 43 AddCreditCard(card); // Visa. | 43 AddCreditCard(card); // Visa. |
| 44 | 44 |
| 45 // Complete the Payment Request. | 45 // Complete the Payment Request. |
| 46 InvokePaymentRequestUI(); | 46 InvokePaymentRequestUI(); |
| 47 ResetEventObserver(DialogEvent::DIALOG_CLOSED); | 47 ResetEventObserver(DialogEvent::DIALOG_CLOSED); |
| 48 ClickOnDialogViewAndWait(DialogViewID::PAY_BUTTON); | 48 PayWithCreditCardAndWait(base::ASCIIToUTF16("123")); |
| 49 | 49 |
| 50 // Test that the card details were sent to the merchant. | 50 // Test that the card details were sent to the merchant. |
| 51 ExpectBodyContains(std::vector<base::string16>{ | 51 ExpectBodyContains(std::vector<base::string16>{ |
| 52 base::UTF8ToUTF16("\"cardNumber\": \"4111111111111111\""), | 52 base::UTF8ToUTF16("\"cardNumber\": \"4111111111111111\""), |
| 53 base::UTF8ToUTF16("\"cardSecurityCode\": \"123\""), | 53 base::UTF8ToUTF16("\"cardSecurityCode\": \"123\""), |
| 54 base::UTF8ToUTF16("\"cardholderName\": \"Test User\""), | 54 base::UTF8ToUTF16("\"cardholderName\": \"Test User\""), |
| 55 base::UTF8ToUTF16("\"expiryMonth\": \"11\""), | 55 base::UTF8ToUTF16("\"expiryMonth\": \"11\""), |
| 56 base::UTF8ToUTF16("\"expiryYear\": \"2017\"")}); | 56 base::UTF8ToUTF16("\"expiryYear\": \"2017\"")}); |
| 57 | 57 |
| 58 // Test that the billing address was sent to the merchant. | 58 // Test that the billing address was sent to the merchant. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // Create a shipping address with a higher frecency score, so that it is | 93 // Create a shipping address with a higher frecency score, so that it is |
| 94 // selected as the defautl shipping address. | 94 // selected as the defautl shipping address. |
| 95 autofill::AutofillProfile shipping_address = | 95 autofill::AutofillProfile shipping_address = |
| 96 autofill::test::GetFullProfile2(); | 96 autofill::test::GetFullProfile2(); |
| 97 shipping_address.set_use_count(2000); | 97 shipping_address.set_use_count(2000); |
| 98 AddAutofillProfile(shipping_address); | 98 AddAutofillProfile(shipping_address); |
| 99 | 99 |
| 100 // Complete the Payment Request. | 100 // Complete the Payment Request. |
| 101 InvokePaymentRequestUI(); | 101 InvokePaymentRequestUI(); |
| 102 ResetEventObserver(DialogEvent::DIALOG_CLOSED); | 102 ResetEventObserver(DialogEvent::DIALOG_CLOSED); |
| 103 ClickOnDialogViewAndWait(DialogViewID::PAY_BUTTON); | 103 PayWithCreditCardAndWait(base::ASCIIToUTF16("123")); |
| 104 | 104 |
| 105 // Test that the shipping address was sent to the merchant. | 105 // Test that the shipping address was sent to the merchant. |
| 106 ExpectBodyContains(std::vector<base::string16>{ | 106 ExpectBodyContains(std::vector<base::string16>{ |
| 107 base::UTF8ToUTF16("\"country\": \"US\""), | 107 base::UTF8ToUTF16("\"country\": \"US\""), |
| 108 base::UTF8ToUTF16("\"123 Main Street\""), base::UTF8ToUTF16("\"Unit 1\""), | 108 base::UTF8ToUTF16("\"123 Main Street\""), base::UTF8ToUTF16("\"Unit 1\""), |
| 109 base::UTF8ToUTF16("\"region\": \"MI\""), | 109 base::UTF8ToUTF16("\"region\": \"MI\""), |
| 110 base::UTF8ToUTF16("\"city\": \"Greensdale\""), | 110 base::UTF8ToUTF16("\"city\": \"Greensdale\""), |
| 111 base::UTF8ToUTF16("\"dependentLocality\": \"\""), | 111 base::UTF8ToUTF16("\"dependentLocality\": \"\""), |
| 112 base::UTF8ToUTF16("\"postalCode\": \"48838\""), | 112 base::UTF8ToUTF16("\"postalCode\": \"48838\""), |
| 113 base::UTF8ToUTF16("\"sortingCode\": \"\""), | 113 base::UTF8ToUTF16("\"sortingCode\": \"\""), |
| (...skipping 25 matching lines...) Expand all Loading... |
| 139 // Setup a credit card with an associated billing address. | 139 // Setup a credit card with an associated billing address. |
| 140 autofill::AutofillProfile billing_address = autofill::test::GetFullProfile(); | 140 autofill::AutofillProfile billing_address = autofill::test::GetFullProfile(); |
| 141 AddAutofillProfile(billing_address); | 141 AddAutofillProfile(billing_address); |
| 142 autofill::CreditCard card = autofill::test::GetCreditCard(); | 142 autofill::CreditCard card = autofill::test::GetCreditCard(); |
| 143 card.set_billing_address_id(billing_address.guid()); | 143 card.set_billing_address_id(billing_address.guid()); |
| 144 AddCreditCard(card); // Visa. | 144 AddCreditCard(card); // Visa. |
| 145 | 145 |
| 146 // Complete the Payment Request. | 146 // Complete the Payment Request. |
| 147 InvokePaymentRequestUI(); | 147 InvokePaymentRequestUI(); |
| 148 ResetEventObserver(DialogEvent::DIALOG_CLOSED); | 148 ResetEventObserver(DialogEvent::DIALOG_CLOSED); |
| 149 ClickOnDialogViewAndWait(DialogViewID::PAY_BUTTON); | 149 PayWithCreditCardAndWait(base::ASCIIToUTF16("123")); |
| 150 | 150 |
| 151 // Test that the contact details were sent to the merchant. | 151 // Test that the contact details were sent to the merchant. |
| 152 ExpectBodyContains(std::vector<base::string16>{ | 152 ExpectBodyContains(std::vector<base::string16>{ |
| 153 base::UTF8ToUTF16("\"payerName\": \"John H. Doe\""), | 153 base::UTF8ToUTF16("\"payerName\": \"John H. Doe\""), |
| 154 base::UTF8ToUTF16("\"payerEmail\": \"johndoe@hades.com\""), | 154 base::UTF8ToUTF16("\"payerEmail\": \"johndoe@hades.com\""), |
| 155 base::UTF8ToUTF16("\"payerPhone\": \"16502111111\"")}); | 155 base::UTF8ToUTF16("\"payerPhone\": \"16502111111\"")}); |
| 156 } | 156 } |
| 157 | 157 |
| 158 class PaymentRequestPaymentResponseOneContactDetailTest | 158 class PaymentRequestPaymentResponseOneContactDetailTest |
| 159 : public PaymentRequestBrowserTestBase { | 159 : public PaymentRequestBrowserTestBase { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 173 // Setup a credit card with an associated billing address. | 173 // Setup a credit card with an associated billing address. |
| 174 autofill::AutofillProfile billing_address = autofill::test::GetFullProfile(); | 174 autofill::AutofillProfile billing_address = autofill::test::GetFullProfile(); |
| 175 AddAutofillProfile(billing_address); | 175 AddAutofillProfile(billing_address); |
| 176 autofill::CreditCard card = autofill::test::GetCreditCard(); | 176 autofill::CreditCard card = autofill::test::GetCreditCard(); |
| 177 card.set_billing_address_id(billing_address.guid()); | 177 card.set_billing_address_id(billing_address.guid()); |
| 178 AddCreditCard(card); // Visa. | 178 AddCreditCard(card); // Visa. |
| 179 | 179 |
| 180 // Complete the Payment Request. | 180 // Complete the Payment Request. |
| 181 InvokePaymentRequestUI(); | 181 InvokePaymentRequestUI(); |
| 182 ResetEventObserver(DialogEvent::DIALOG_CLOSED); | 182 ResetEventObserver(DialogEvent::DIALOG_CLOSED); |
| 183 ClickOnDialogViewAndWait(DialogViewID::PAY_BUTTON); | 183 PayWithCreditCardAndWait(base::ASCIIToUTF16("123")); |
| 184 | 184 |
| 185 // Test that the contact details were sent to the merchant. | 185 // Test that the contact details were sent to the merchant. |
| 186 ExpectBodyContains(std::vector<base::string16>{ | 186 ExpectBodyContains(std::vector<base::string16>{ |
| 187 base::UTF8ToUTF16("\"payerName\": null"), | 187 base::UTF8ToUTF16("\"payerName\": null"), |
| 188 base::UTF8ToUTF16("\"payerEmail\": \"johndoe@hades.com\""), | 188 base::UTF8ToUTF16("\"payerEmail\": \"johndoe@hades.com\""), |
| 189 base::UTF8ToUTF16("\"payerPhone\": null")}); | 189 base::UTF8ToUTF16("\"payerPhone\": null")}); |
| 190 } | 190 } |
| 191 | 191 |
| 192 } // namespace payments | 192 } // namespace payments |
| OLD | NEW |