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 "components/payments/content/payment_request_state.h" | 5 #include "components/payments/content/payment_request_state.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
333 "\"recipient\":\"John H. Doe\"," | 333 "\"recipient\":\"John H. Doe\"," |
334 "\"region\":\"CA\"}," | 334 "\"region\":\"CA\"}," |
335 "\"cardNumber\":\"4111111111111111\"," | 335 "\"cardNumber\":\"4111111111111111\"," |
336 "\"cardSecurityCode\":\"123\"," | 336 "\"cardSecurityCode\":\"123\"," |
337 "\"cardholderName\":\"Test User\"," | 337 "\"cardholderName\":\"Test User\"," |
338 "\"expiryMonth\":\"11\"," | 338 "\"expiryMonth\":\"11\"," |
339 "\"expiryYear\":\"2017\"}", | 339 "\"expiryYear\":\"2017\"}", |
340 response()->stringified_details); | 340 response()->stringified_details); |
341 } | 341 } |
342 | 342 |
343 // Tests the the generated PaymentResponse has the correct values for the | |
344 // shipping address. | |
345 TEST_F(PaymentRequestStateTest, GeneratePaymentResponse_ShippingAddress) { | |
346 mojom::PaymentOptionsPtr options = mojom::PaymentOptions::New(); | |
347 options->request_shipping = true; | |
348 RecreateStateWithOptions(std::move(options)); | |
349 | |
350 EXPECT_TRUE(state()->is_ready_to_pay()); | |
351 | |
352 // TODO(mathp): Currently synchronous, when async will need a RunLoop. | |
353 // "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.
| |
354 state()->GeneratePaymentResponse(); | |
355 | |
356 // Check that all the expected values were set. | |
357 EXPECT_EQ("US", response()->shipping_address->country); | |
358 EXPECT_EQ("666 Erebus St.", response()->shipping_address->address_line[0]); | |
359 EXPECT_EQ("Apt 8", response()->shipping_address->address_line[1]); | |
360 EXPECT_EQ("CA", response()->shipping_address->region); | |
361 EXPECT_EQ("Elysium", response()->shipping_address->city); | |
362 EXPECT_EQ("", response()->shipping_address->dependent_locality); | |
363 EXPECT_EQ("91111", response()->shipping_address->postal_code); | |
364 EXPECT_EQ("", response()->shipping_address->sorting_code); | |
365 EXPECT_EQ("", response()->shipping_address->language_code); | |
366 EXPECT_EQ("Underworld", response()->shipping_address->organization); | |
367 EXPECT_EQ("John H. Doe", response()->shipping_address->recipient); | |
368 EXPECT_EQ("16502111111", response()->shipping_address->phone); | |
369 } | |
370 | |
343 } // namespace payments | 371 } // namespace payments |
OLD | NEW |