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 #import "ios/chrome/browser/payments/payment_method_selection_view_controller.h" | 5 #import "ios/chrome/browser/payments/payment_method_selection_view_controller.h" |
6 | 6 |
7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "components/autofill/core/browser/autofill_test_utils.h" | 9 #include "components/autofill/core/browser/autofill_test_utils.h" |
10 #include "components/autofill/core/browser/credit_card.h" | 10 #include "components/autofill/core/browser/credit_card.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 credit_card2_(autofill::test::GetCreditCard2()) { | 32 credit_card2_(autofill::test::GetCreditCard2()) { |
33 // Add testing profile and credit cards to | 33 // Add testing profile and credit cards to |
34 // autofill::TestPersonalDataManager. | 34 // autofill::TestPersonalDataManager. |
35 personal_data_manager_.AddTestingProfile(&autofill_profile_); | 35 personal_data_manager_.AddTestingProfile(&autofill_profile_); |
36 credit_card1_.set_billing_address_id(autofill_profile_.guid()); | 36 credit_card1_.set_billing_address_id(autofill_profile_.guid()); |
37 personal_data_manager_.AddTestingCreditCard(&credit_card1_); | 37 personal_data_manager_.AddTestingCreditCard(&credit_card1_); |
38 credit_card2_.set_billing_address_id(autofill_profile_.guid()); | 38 credit_card2_.set_billing_address_id(autofill_profile_.guid()); |
39 personal_data_manager_.AddTestingCreditCard(&credit_card2_); | 39 personal_data_manager_.AddTestingCreditCard(&credit_card2_); |
40 } | 40 } |
41 | 41 |
42 CollectionViewController* NewController() override NS_RETURNS_RETAINED { | 42 CollectionViewController* InstantiateController() override { |
43 payment_request_ = base::MakeUnique<PaymentRequest>( | 43 payment_request_ = base::MakeUnique<PaymentRequest>( |
44 payment_request_test_util::CreateTestWebPaymentRequest(), | 44 payment_request_test_util::CreateTestWebPaymentRequest(), |
45 &personal_data_manager_); | 45 &personal_data_manager_); |
46 | 46 |
47 return [[PaymentMethodSelectionViewController alloc] | 47 return [[PaymentMethodSelectionViewController alloc] |
48 initWithPaymentRequest:payment_request_.get()]; | 48 initWithPaymentRequest:payment_request_.get()]; |
49 } | 49 } |
50 | 50 |
51 PaymentMethodSelectionViewController* | 51 PaymentMethodSelectionViewController* |
52 GetPaymentMethodSelectionViewController() { | 52 GetPaymentMethodSelectionViewController() { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 item = GetCollectionViewItem(0, 1); | 85 item = GetCollectionViewItem(0, 1); |
86 EXPECT_TRUE([item isMemberOfClass:[PaymentMethodItem class]]); | 86 EXPECT_TRUE([item isMemberOfClass:[PaymentMethodItem class]]); |
87 payment_method_item = item; | 87 payment_method_item = item; |
88 EXPECT_EQ(MDCCollectionViewCellAccessoryNone, | 88 EXPECT_EQ(MDCCollectionViewCellAccessoryNone, |
89 payment_method_item.accessoryType); | 89 payment_method_item.accessoryType); |
90 | 90 |
91 // The last item should be of type TextAndMessageItem. | 91 // The last item should be of type TextAndMessageItem. |
92 item = GetCollectionViewItem(0, 2); | 92 item = GetCollectionViewItem(0, 2); |
93 EXPECT_TRUE([item isMemberOfClass:[PaymentsTextItem class]]); | 93 EXPECT_TRUE([item isMemberOfClass:[PaymentsTextItem class]]); |
94 } | 94 } |
OLD | NEW |