| 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_request_view_controller.h" | 5 #import "ios/chrome/browser/payments/payment_request_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_profile.h" | 9 #include "components/autofill/core/browser/autofill_profile.h" |
| 10 #include "components/autofill/core/browser/autofill_test_utils.h" | 10 #include "components/autofill/core/browser/autofill_test_utils.h" |
| 11 #include "components/autofill/core/browser/credit_card.h" | 11 #include "components/autofill/core/browser/credit_card.h" |
| 12 #include "components/autofill/core/browser/test_personal_data_manager.h" | 12 #include "components/autofill/core/browser/test_personal_data_manager.h" |
| 13 #import "ios/chrome/browser/payments/cells/page_info_item.h" | 13 #import "ios/chrome/browser/payments/cells/page_info_item.h" |
| 14 #import "ios/chrome/browser/payments/cells/payment_method_item.h" | 14 #import "ios/chrome/browser/payments/cells/payment_method_item.h" |
| 15 #import "ios/chrome/browser/payments/cells/price_item.h" | 15 #import "ios/chrome/browser/payments/cells/price_item.h" |
| 16 #import "ios/chrome/browser/payments/cells/shipping_address_item.h" | 16 #import "ios/chrome/browser/payments/cells/shipping_address_item.h" |
| 17 #include "ios/chrome/browser/payments/payment_request.h" | 17 #include "ios/chrome/browser/payments/payment_request.h" |
| 18 #include "ios/chrome/browser/payments/payment_request_test_util.h" | 18 #include "ios/chrome/browser/payments/payment_request_test_util.h" |
| 19 #import "ios/chrome/browser/ui/autofill/cells/status_item.h" | 19 #import "ios/chrome/browser/ui/autofill/cells/status_item.h" |
| 20 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_detail_item
.h" | 20 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_detail_item
.h" |
| 21 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h
" | 21 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h
" |
| 22 #import "ios/chrome/browser/ui/collection_view/collection_view_controller_test.h
" | 22 #import "ios/chrome/browser/ui/collection_view/collection_view_controller_test.h
" |
| 23 #include "ios/chrome/grit/ios_strings.h" | 23 #include "ios/chrome/grit/ios_strings.h" |
| 24 #include "ios/web/public/payments/payment_request.h" | 24 #include "ios/web/public/payments/payment_request.h" |
| 25 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
| 26 | 26 |
| 27 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 28 #error "This file requires ARC support." |
| 29 #endif |
| 30 |
| 27 class PaymentRequestViewControllerTest : public CollectionViewControllerTest { | 31 class PaymentRequestViewControllerTest : public CollectionViewControllerTest { |
| 28 protected: | 32 protected: |
| 29 CollectionViewController* NewController() override NS_RETURNS_RETAINED { | 33 CollectionViewController* NewController() override NS_RETURNS_RETAINED { |
| 30 personal_data_manager_ = | 34 personal_data_manager_ = |
| 31 base::MakeUnique<autofill::TestPersonalDataManager>(); | 35 base::MakeUnique<autofill::TestPersonalDataManager>(); |
| 32 // Add testing profile. autofill::TestPersonalDataManager does not take | 36 // Add testing profile. autofill::TestPersonalDataManager does not take |
| 33 // ownership of the profile. | 37 // ownership of the profile. |
| 34 profile_ = payment_request_test_util::CreateTestAutofillProfile(); | 38 profile_ = payment_request_test_util::CreateTestAutofillProfile(); |
| 35 personal_data_manager_->AddTestingProfile(profile_.get()); | 39 personal_data_manager_->AddTestingProfile(profile_.get()); |
| 36 // Add testing credit card. autofill::TestPersonalDataManager does not take | 40 // Add testing credit card. autofill::TestPersonalDataManager does not take |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 [GetPaymentRequestViewController() loadModel]; | 174 [GetPaymentRequestViewController() loadModel]; |
| 171 | 175 |
| 172 // The only item in the Payment section should be of type | 176 // The only item in the Payment section should be of type |
| 173 // CollectionViewDetailItem. | 177 // CollectionViewDetailItem. |
| 174 ASSERT_EQ(1U, static_cast<unsigned int>(NumberOfItemsInSection(2))); | 178 ASSERT_EQ(1U, static_cast<unsigned int>(NumberOfItemsInSection(2))); |
| 175 id item = GetCollectionViewItem(2, 0); | 179 id item = GetCollectionViewItem(2, 0); |
| 176 EXPECT_TRUE([item isMemberOfClass:[CollectionViewDetailItem class]]); | 180 EXPECT_TRUE([item isMemberOfClass:[CollectionViewDetailItem class]]); |
| 177 CollectionViewDetailItem* detail_item = item; | 181 CollectionViewDetailItem* detail_item = item; |
| 178 EXPECT_EQ(MDCCollectionViewCellAccessoryNone, detail_item.accessoryType); | 182 EXPECT_EQ(MDCCollectionViewCellAccessoryNone, detail_item.accessoryType); |
| 179 } | 183 } |
| OLD | NEW |