Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(258)

Side by Side Diff: chrome/browser/ui/views/payments/payment_request_payment_response_browsertest.cc

Issue 2815763002: Prevent usage of web payments API over insecure HTTPS. (Closed)
Patch Set: Fix typo Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 30 matching lines...) Expand all
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 PayWithCreditCardAndWait(base::ASCIIToUTF16("123")); 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({"\"cardNumber\": \"4111111111111111\"",
52 base::UTF8ToUTF16("\"cardNumber\": \"4111111111111111\""), 52 "\"cardSecurityCode\": \"123\"",
53 base::UTF8ToUTF16("\"cardSecurityCode\": \"123\""), 53 "\"cardholderName\": \"Test User\"",
54 base::UTF8ToUTF16("\"cardholderName\": \"Test User\""), 54 "\"expiryMonth\": \"11\"", "\"expiryYear\": \"2022\""});
55 base::UTF8ToUTF16("\"expiryMonth\": \"11\""),
56 base::UTF8ToUTF16("\"expiryYear\": \"2022\"")});
57 55
58 // Test that the billing address was sent to the merchant. 56 // Test that the billing address was sent to the merchant.
59 ExpectBodyContains(std::vector<base::string16>{ 57 ExpectBodyContains({"\"billingAddress\": {", "\"666 Erebus St.\"",
60 base::UTF8ToUTF16("\"billingAddress\": {"), 58 "\"Apt 8\"", "\"city\": \"Elysium\"",
61 base::UTF8ToUTF16("\"666 Erebus St.\""), base::UTF8ToUTF16("\"Apt 8\""), 59 "\"country\": \"US\"", "\"organization\": \"Underworld\"",
62 base::UTF8ToUTF16("\"city\": \"Elysium\""), 60 "\"phone\": \"16502111111\"", "\"postalCode\": \"91111\"",
63 base::UTF8ToUTF16("\"country\": \"US\""), 61 "\"recipient\": \"John H. Doe\"", "\"region\": \"CA\""});
64 base::UTF8ToUTF16("\"organization\": \"Underworld\""),
65 base::UTF8ToUTF16("\"phone\": \"16502111111\""),
66 base::UTF8ToUTF16("\"postalCode\": \"91111\""),
67 base::UTF8ToUTF16("\"recipient\": \"John H. Doe\""),
68 base::UTF8ToUTF16("\"region\": \"CA\"")});
69 } 62 }
70 63
71 class PaymentRequestPaymentResponseShippingAddressTest 64 class PaymentRequestPaymentResponseShippingAddressTest
72 : public PaymentRequestBrowserTestBase { 65 : public PaymentRequestBrowserTestBase {
73 protected: 66 protected:
74 PaymentRequestPaymentResponseShippingAddressTest() 67 PaymentRequestPaymentResponseShippingAddressTest()
75 : PaymentRequestBrowserTestBase( 68 : PaymentRequestBrowserTestBase(
76 "/payment_request_free_shipping_test.html") {} 69 "/payment_request_free_shipping_test.html") {}
77 70
78 private: 71 private:
(...skipping 17 matching lines...) Expand all
96 autofill::test::GetFullProfile2(); 89 autofill::test::GetFullProfile2();
97 shipping_address.set_use_count(2000); 90 shipping_address.set_use_count(2000);
98 AddAutofillProfile(shipping_address); 91 AddAutofillProfile(shipping_address);
99 92
100 // Complete the Payment Request. 93 // Complete the Payment Request.
101 InvokePaymentRequestUI(); 94 InvokePaymentRequestUI();
102 ResetEventObserver(DialogEvent::DIALOG_CLOSED); 95 ResetEventObserver(DialogEvent::DIALOG_CLOSED);
103 PayWithCreditCardAndWait(base::ASCIIToUTF16("123")); 96 PayWithCreditCardAndWait(base::ASCIIToUTF16("123"));
104 97
105 // Test that the shipping address was sent to the merchant. 98 // Test that the shipping address was sent to the merchant.
106 ExpectBodyContains(std::vector<base::string16>{ 99 ExpectBodyContains({"\"country\": \"US\"", "\"123 Main Street\"",
107 base::UTF8ToUTF16("\"country\": \"US\""), 100 "\"Unit 1\"", "\"region\": \"MI\"",
108 base::UTF8ToUTF16("\"123 Main Street\""), base::UTF8ToUTF16("\"Unit 1\""), 101 "\"city\": \"Greensdale\"", "\"dependentLocality\": \"\"",
109 base::UTF8ToUTF16("\"region\": \"MI\""), 102 "\"postalCode\": \"48838\"", "\"sortingCode\": \"\"",
110 base::UTF8ToUTF16("\"city\": \"Greensdale\""), 103 "\"languageCode\": \"\"", "\"organization\": \"ACME\"",
111 base::UTF8ToUTF16("\"dependentLocality\": \"\""), 104 "\"recipient\": \"Jane A. Smith\"",
112 base::UTF8ToUTF16("\"postalCode\": \"48838\""), 105 "\"phone\": \"13105557889\""});
113 base::UTF8ToUTF16("\"sortingCode\": \"\""),
114 base::UTF8ToUTF16("\"languageCode\": \"\""),
115 base::UTF8ToUTF16("\"organization\": \"ACME\""),
116 base::UTF8ToUTF16("\"recipient\": \"Jane A. Smith\""),
117 base::UTF8ToUTF16("\"phone\": \"13105557889\"")});
118 106
119 // Test that the shipping option was sent to the merchant. 107 // Test that the shipping option was sent to the merchant.
120 ExpectBodyContains(std::vector<base::string16>{ 108 ExpectBodyContains({"\"shippingOption\": \"freeShippingOption\""});
121 base::UTF8ToUTF16("\"shippingOption\": \"freeShippingOption\"")});
122 } 109 }
123 110
124 class PaymentRequestPaymentResponseAllContactDetailsTest 111 class PaymentRequestPaymentResponseAllContactDetailsTest
125 : public PaymentRequestBrowserTestBase { 112 : public PaymentRequestBrowserTestBase {
126 protected: 113 protected:
127 PaymentRequestPaymentResponseAllContactDetailsTest() 114 PaymentRequestPaymentResponseAllContactDetailsTest()
128 : PaymentRequestBrowserTestBase( 115 : PaymentRequestBrowserTestBase(
129 "/payment_request_contact_details_and_free_shipping_test.html") {} 116 "/payment_request_contact_details_and_free_shipping_test.html") {}
130 117
131 private: 118 private:
(...skipping 10 matching lines...) Expand all
142 autofill::CreditCard card = autofill::test::GetCreditCard(); 129 autofill::CreditCard card = autofill::test::GetCreditCard();
143 card.set_billing_address_id(billing_address.guid()); 130 card.set_billing_address_id(billing_address.guid());
144 AddCreditCard(card); // Visa. 131 AddCreditCard(card); // Visa.
145 132
146 // Complete the Payment Request. 133 // Complete the Payment Request.
147 InvokePaymentRequestUI(); 134 InvokePaymentRequestUI();
148 ResetEventObserver(DialogEvent::DIALOG_CLOSED); 135 ResetEventObserver(DialogEvent::DIALOG_CLOSED);
149 PayWithCreditCardAndWait(base::ASCIIToUTF16("123")); 136 PayWithCreditCardAndWait(base::ASCIIToUTF16("123"));
150 137
151 // Test that the contact details were sent to the merchant. 138 // Test that the contact details were sent to the merchant.
152 ExpectBodyContains(std::vector<base::string16>{ 139 ExpectBodyContains({"\"payerName\": \"John H. Doe\"",
153 base::UTF8ToUTF16("\"payerName\": \"John H. Doe\""), 140 "\"payerEmail\": \"johndoe@hades.com\"",
154 base::UTF8ToUTF16("\"payerEmail\": \"johndoe@hades.com\""), 141 "\"payerPhone\": \"+16502111111\""});
155 base::UTF8ToUTF16("\"payerPhone\": \"+16502111111\"")});
156 } 142 }
157 143
158 class PaymentRequestPaymentResponseOneContactDetailTest 144 class PaymentRequestPaymentResponseOneContactDetailTest
159 : public PaymentRequestBrowserTestBase { 145 : public PaymentRequestBrowserTestBase {
160 protected: 146 protected:
161 PaymentRequestPaymentResponseOneContactDetailTest() 147 PaymentRequestPaymentResponseOneContactDetailTest()
162 : PaymentRequestBrowserTestBase( 148 : PaymentRequestBrowserTestBase(
163 "/payment_request_email_and_free_shipping_test.html") {} 149 "/payment_request_email_and_free_shipping_test.html") {}
164 150
165 private: 151 private:
(...skipping 10 matching lines...) Expand all
176 autofill::CreditCard card = autofill::test::GetCreditCard(); 162 autofill::CreditCard card = autofill::test::GetCreditCard();
177 card.set_billing_address_id(billing_address.guid()); 163 card.set_billing_address_id(billing_address.guid());
178 AddCreditCard(card); // Visa. 164 AddCreditCard(card); // Visa.
179 165
180 // Complete the Payment Request. 166 // Complete the Payment Request.
181 InvokePaymentRequestUI(); 167 InvokePaymentRequestUI();
182 ResetEventObserver(DialogEvent::DIALOG_CLOSED); 168 ResetEventObserver(DialogEvent::DIALOG_CLOSED);
183 PayWithCreditCardAndWait(base::ASCIIToUTF16("123")); 169 PayWithCreditCardAndWait(base::ASCIIToUTF16("123"));
184 170
185 // Test that the contact details were sent to the merchant. 171 // Test that the contact details were sent to the merchant.
186 ExpectBodyContains(std::vector<base::string16>{ 172 ExpectBodyContains({"\"payerName\": null",
187 base::UTF8ToUTF16("\"payerName\": null"), 173 "\"payerEmail\": \"johndoe@hades.com\"",
188 base::UTF8ToUTF16("\"payerEmail\": \"johndoe@hades.com\""), 174 "\"payerPhone\": null"});
189 base::UTF8ToUTF16("\"payerPhone\": null")});
190 } 175 }
191 176
192 } // namespace payments 177 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698