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" |
11 #include "components/autofill/core/browser/test_personal_data_manager.h" | 11 #include "components/autofill/core/browser/test_personal_data_manager.h" |
12 #import "ios/chrome/browser/payments/cells/payment_method_item.h" | 12 #import "ios/chrome/browser/payments/cells/payment_method_item.h" |
13 #import "ios/chrome/browser/payments/cells/payments_text_item.h" | 13 #import "ios/chrome/browser/payments/cells/payments_text_item.h" |
14 #include "ios/chrome/browser/payments/payment_request.h" | 14 #include "ios/chrome/browser/payments/payment_request.h" |
15 #import "ios/chrome/browser/payments/payment_request_test_util.h" | 15 #import "ios/chrome/browser/payments/payment_request_test_util.h" |
16 #import "ios/chrome/browser/ui/collection_view/collection_view_controller_test.h
" | 16 #import "ios/chrome/browser/ui/collection_view/collection_view_controller_test.h
" |
17 #include "ios/chrome/grit/ios_strings.h" | 17 #include "ios/chrome/grit/ios_strings.h" |
18 #include "ios/web/public/payments/payment_request.h" | 18 #include "ios/web/public/payments/payment_request.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
20 | 20 |
| 21 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 22 #error "This file requires ARC support." |
| 23 #endif |
| 24 |
21 class PaymentMethodSelectionViewControllerTest | 25 class PaymentMethodSelectionViewControllerTest |
22 : public CollectionViewControllerTest { | 26 : public CollectionViewControllerTest { |
23 protected: | 27 protected: |
24 CollectionViewController* NewController() override NS_RETURNS_RETAINED { | 28 CollectionViewController* NewController() override NS_RETURNS_RETAINED { |
25 personal_data_manager_ = | 29 personal_data_manager_ = |
26 base::MakeUnique<autofill::TestPersonalDataManager>(); | 30 base::MakeUnique<autofill::TestPersonalDataManager>(); |
27 // Add testing credit cards. autofill::TestPersonalDataManager does not take | 31 // Add testing credit cards. autofill::TestPersonalDataManager does not take |
28 // ownership of the cards. | 32 // ownership of the cards. |
29 credit_card1_ = payment_request_test_util::CreateTestCreditCard(); | 33 credit_card1_ = payment_request_test_util::CreateTestCreditCard(); |
30 personal_data_manager_->AddTestingCreditCard(credit_card1_.get()); | 34 personal_data_manager_->AddTestingCreditCard(credit_card1_.get()); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 item = GetCollectionViewItem(0, 1); | 82 item = GetCollectionViewItem(0, 1); |
79 EXPECT_TRUE([item isMemberOfClass:[PaymentMethodItem class]]); | 83 EXPECT_TRUE([item isMemberOfClass:[PaymentMethodItem class]]); |
80 payment_method_item = item; | 84 payment_method_item = item; |
81 EXPECT_EQ(MDCCollectionViewCellAccessoryNone, | 85 EXPECT_EQ(MDCCollectionViewCellAccessoryNone, |
82 payment_method_item.accessoryType); | 86 payment_method_item.accessoryType); |
83 | 87 |
84 // The last item should be of type TextAndMessageItem. | 88 // The last item should be of type TextAndMessageItem. |
85 item = GetCollectionViewItem(0, 2); | 89 item = GetCollectionViewItem(0, 2); |
86 EXPECT_TRUE([item isMemberOfClass:[PaymentsTextItem class]]); | 90 EXPECT_TRUE([item isMemberOfClass:[PaymentsTextItem class]]); |
87 } | 91 } |
OLD | NEW |