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

Unified Diff: ios/chrome/browser/ui/payments/payment_request_mediator_unittest.mm

Issue 2956453003: [Payment Request] Makes sure only complete credit cards can be selected (Closed)
Patch Set: Fixed unit test Created 3 years, 6 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
« no previous file with comments | « ios/chrome/browser/ui/payments/payment_request_manager.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/payments/payment_request_mediator_unittest.mm
diff --git a/ios/chrome/browser/ui/payments/payment_request_mediator_unittest.mm b/ios/chrome/browser/ui/payments/payment_request_mediator_unittest.mm
index 18ba0099ed7956b0c5fe820953dea1c8b5473042..e40dee0e12cda429e6fc79fdaf755fb876a05a30 100644
--- a/ios/chrome/browser/ui/payments/payment_request_mediator_unittest.mm
+++ b/ios/chrome/browser/ui/payments/payment_request_mediator_unittest.mm
@@ -53,6 +53,7 @@ class PaymentRequestMediatorTest : public PlatformTest {
credit_card_(autofill::test::GetCreditCard()) {
// Add testing profile and credit card to autofill::TestPersonalDataManager.
personal_data_manager_.AddTestingProfile(&autofill_profile_);
+ credit_card_.set_billing_address_id(autofill_profile_.guid());
personal_data_manager_.AddTestingCreditCard(&credit_card_);
payment_request_ = base::MakeUnique<TestPaymentRequest>(
@@ -82,8 +83,13 @@ class PaymentRequestMediatorTest : public PlatformTest {
// Tests whether payment can be completed when expected.
TEST_F(PaymentRequestMediatorTest, TestCanPay) {
- // Payment cannot be completed if there is no selected credit card.
+ EXPECT_TRUE(payment_request_->selected_credit_card());
+ EXPECT_TRUE(payment_request_->selected_shipping_profile());
+ EXPECT_TRUE(payment_request_->selected_shipping_option());
+ EXPECT_TRUE(payment_request_->selected_contact_profile());
EXPECT_TRUE([GetPaymentRequestMediator() canPay]);
+
+ // Payment cannot be completed if there is no selected credit card.
autofill::CreditCard* selected_credit_card =
payment_request_->selected_credit_card();
payment_request_->set_selected_credit_card(nullptr);
« no previous file with comments | « ios/chrome/browser/ui/payments/payment_request_manager.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698