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

Unified Diff: components/payments/content/payment_request_state_unittest.cc

Issue 2779813003: [Payments] Add Ship. Addr. & Contact Info in Payment Response on Desktop. (Closed)
Patch Set: Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: components/payments/content/payment_request_state_unittest.cc
diff --git a/components/payments/content/payment_request_state_unittest.cc b/components/payments/content/payment_request_state_unittest.cc
index 3f1ac1166e406cd7aca68d9550fc7ba823e45604..17ece6eac788b3849d0a3c042ac069d02357263a 100644
--- a/components/payments/content/payment_request_state_unittest.cc
+++ b/components/payments/content/payment_request_state_unittest.cc
@@ -340,4 +340,32 @@ TEST_F(PaymentRequestStateTest, GeneratePaymentResponse_BasicCard) {
response()->stringified_details);
}
+// Tests the the generated PaymentResponse has the correct values for the
+// shipping address.
+TEST_F(PaymentRequestStateTest, GeneratePaymentResponse_ShippingAddress) {
+ mojom::PaymentOptionsPtr options = mojom::PaymentOptions::New();
+ options->request_shipping = true;
+ RecreateStateWithOptions(std::move(options));
+
+ EXPECT_TRUE(state()->is_ready_to_pay());
+
+ // TODO(mathp): Currently synchronous, when async will need a RunLoop.
+ // "basic-card" is specified so it is returned as the method name.
Mathieu 2017/03/27 23:42:42 remove this line
sebsg 2017/03/28 20:33:53 Done.
+ state()->GeneratePaymentResponse();
+
+ // Check that all the expected values were set.
+ EXPECT_EQ("US", response()->shipping_address->country);
+ EXPECT_EQ("666 Erebus St.", response()->shipping_address->address_line[0]);
+ EXPECT_EQ("Apt 8", response()->shipping_address->address_line[1]);
+ EXPECT_EQ("CA", response()->shipping_address->region);
+ EXPECT_EQ("Elysium", response()->shipping_address->city);
+ EXPECT_EQ("", response()->shipping_address->dependent_locality);
+ EXPECT_EQ("91111", response()->shipping_address->postal_code);
+ EXPECT_EQ("", response()->shipping_address->sorting_code);
+ EXPECT_EQ("", response()->shipping_address->language_code);
+ EXPECT_EQ("Underworld", response()->shipping_address->organization);
+ EXPECT_EQ("John H. Doe", response()->shipping_address->recipient);
+ EXPECT_EQ("16502111111", response()->shipping_address->phone);
+}
+
} // namespace payments

Powered by Google App Engine
This is Rietveld 408576698