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

Side by Side Diff: components/payments/content/payment_request_state_unittest.cc

Issue 2805263003: [Payments] Selecting incomplete items will open editors (Closed)
Patch Set: fix ios test for realz 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
« no previous file with comments | « components/payments/content/payment_request_state.cc ('k') | components/payments/core/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 "\"country\":\"US\"," 317 "\"country\":\"US\","
318 "\"organization\":\"Underworld\"," 318 "\"organization\":\"Underworld\","
319 "\"phone\":\"16502111111\"," 319 "\"phone\":\"16502111111\","
320 "\"postalCode\":\"91111\"," 320 "\"postalCode\":\"91111\","
321 "\"recipient\":\"John H. Doe\"," 321 "\"recipient\":\"John H. Doe\","
322 "\"region\":\"CA\"}," 322 "\"region\":\"CA\"},"
323 "\"cardNumber\":\"4111111111111111\"," 323 "\"cardNumber\":\"4111111111111111\","
324 "\"cardSecurityCode\":\"123\"," 324 "\"cardSecurityCode\":\"123\","
325 "\"cardholderName\":\"Test User\"," 325 "\"cardholderName\":\"Test User\","
326 "\"expiryMonth\":\"11\"," 326 "\"expiryMonth\":\"11\","
327 "\"expiryYear\":\"2017\"}", 327 "\"expiryYear\":\"2022\"}",
328 response()->stringified_details); 328 response()->stringified_details);
329 } 329 }
330 330
331 // Test generating a PaymentResponse when the method is specified through 331 // Test generating a PaymentResponse when the method is specified through
332 // "basic-card". 332 // "basic-card".
333 TEST_F(PaymentRequestStateTest, GeneratePaymentResponse_BasicCard) { 333 TEST_F(PaymentRequestStateTest, GeneratePaymentResponse_BasicCard) {
334 // The method data supports visa through basic-card. 334 // The method data supports visa through basic-card.
335 mojom::PaymentMethodDataPtr entry = mojom::PaymentMethodData::New(); 335 mojom::PaymentMethodDataPtr entry = mojom::PaymentMethodData::New();
336 entry->supported_methods.push_back("basic-card"); 336 entry->supported_methods.push_back("basic-card");
337 entry->supported_networks.push_back(mojom::BasicCardNetwork::VISA); 337 entry->supported_networks.push_back(mojom::BasicCardNetwork::VISA);
(...skipping 16 matching lines...) Expand all
354 "\"country\":\"US\"," 354 "\"country\":\"US\","
355 "\"organization\":\"Underworld\"," 355 "\"organization\":\"Underworld\","
356 "\"phone\":\"16502111111\"," 356 "\"phone\":\"16502111111\","
357 "\"postalCode\":\"91111\"," 357 "\"postalCode\":\"91111\","
358 "\"recipient\":\"John H. Doe\"," 358 "\"recipient\":\"John H. Doe\","
359 "\"region\":\"CA\"}," 359 "\"region\":\"CA\"},"
360 "\"cardNumber\":\"4111111111111111\"," 360 "\"cardNumber\":\"4111111111111111\","
361 "\"cardSecurityCode\":\"123\"," 361 "\"cardSecurityCode\":\"123\","
362 "\"cardholderName\":\"Test User\"," 362 "\"cardholderName\":\"Test User\","
363 "\"expiryMonth\":\"11\"," 363 "\"expiryMonth\":\"11\","
364 "\"expiryYear\":\"2017\"}", 364 "\"expiryYear\":\"2022\"}",
365 response()->stringified_details); 365 response()->stringified_details);
366 } 366 }
367 367
368 // Tests the the generated PaymentResponse has the correct values for the 368 // Tests the the generated PaymentResponse has the correct values for the
369 // shipping address. 369 // shipping address.
370 TEST_F(PaymentRequestStateTest, GeneratePaymentResponse_ShippingAddress) { 370 TEST_F(PaymentRequestStateTest, GeneratePaymentResponse_ShippingAddress) {
371 // Setup so that a shipping address is requested. 371 // Setup so that a shipping address is requested.
372 std::vector<mojom::PaymentShippingOptionPtr> shipping_options; 372 std::vector<mojom::PaymentShippingOptionPtr> shipping_options;
373 mojom::PaymentShippingOptionPtr option = mojom::PaymentShippingOption::New(); 373 mojom::PaymentShippingOptionPtr option = mojom::PaymentShippingOption::New();
374 option->id = "option:1"; 374 option->id = "option:1";
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 EXPECT_TRUE(state()->is_ready_to_pay()); 429 EXPECT_TRUE(state()->is_ready_to_pay());
430 state()->GeneratePaymentResponse(); 430 state()->GeneratePaymentResponse();
431 431
432 // Check that the name was set, but not the other values. 432 // Check that the name was set, but not the other values.
433 EXPECT_EQ("John H. Doe", response()->payer_name.value()); 433 EXPECT_EQ("John H. Doe", response()->payer_name.value());
434 EXPECT_FALSE(response()->payer_phone.has_value()); 434 EXPECT_FALSE(response()->payer_phone.has_value());
435 EXPECT_FALSE(response()->payer_email.has_value()); 435 EXPECT_FALSE(response()->payer_email.has_value());
436 } 436 }
437 437
438 } // namespace payments 438 } // namespace payments
OLDNEW
« no previous file with comments | « components/payments/content/payment_request_state.cc ('k') | components/payments/core/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698