| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_items_display_view_controller.h" | 5 #import "ios/chrome/browser/payments/payment_items_display_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/test_personal_data_manager.h" | 9 #include "components/autofill/core/browser/test_personal_data_manager.h" |
| 10 #import "ios/chrome/browser/payments/cells/price_item.h" | 10 #import "ios/chrome/browser/payments/cells/price_item.h" |
| 11 #include "ios/chrome/browser/payments/payment_request.h" | 11 #include "ios/chrome/browser/payments/payment_request.h" |
| 12 #import "ios/chrome/browser/payments/payment_request_test_util.h" | 12 #import "ios/chrome/browser/payments/payment_request_test_util.h" |
| 13 #import "ios/chrome/browser/ui/collection_view/collection_view_controller_test.h
" | 13 #import "ios/chrome/browser/ui/collection_view/collection_view_controller_test.h
" |
| 14 #include "ios/chrome/grit/ios_strings.h" | 14 #include "ios/chrome/grit/ios_strings.h" |
| 15 #include "ios/web/public/payments/payment_request.h" | 15 #include "ios/web/public/payments/payment_request.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 17 |
| 18 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 19 #error "This file requires ARC support." |
| 20 #endif |
| 21 |
| 18 class PaymentItemsDisplayViewControllerTest | 22 class PaymentItemsDisplayViewControllerTest |
| 19 : public CollectionViewControllerTest { | 23 : public CollectionViewControllerTest { |
| 20 protected: | 24 protected: |
| 21 CollectionViewController* NewController() override NS_RETURNS_RETAINED { | 25 CollectionViewController* NewController() override NS_RETURNS_RETAINED { |
| 22 personal_data_manager_ = | 26 personal_data_manager_ = |
| 23 base::MakeUnique<autofill::TestPersonalDataManager>(); | 27 base::MakeUnique<autofill::TestPersonalDataManager>(); |
| 24 | 28 |
| 25 web::PaymentRequest web_payment_request = | 29 web::PaymentRequest web_payment_request = |
| 26 payment_request_test_util::CreateTestWebPaymentRequest(); | 30 payment_request_test_util::CreateTestWebPaymentRequest(); |
| 27 | 31 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 54 ASSERT_EQ(1, NumberOfSections()); | 58 ASSERT_EQ(1, NumberOfSections()); |
| 55 // There should be one item for the total and another one for sub-total. | 59 // There should be one item for the total and another one for sub-total. |
| 56 ASSERT_EQ(2U, static_cast<unsigned int>(NumberOfItemsInSection(0))); | 60 ASSERT_EQ(2U, static_cast<unsigned int>(NumberOfItemsInSection(0))); |
| 57 | 61 |
| 58 // They both should be of type PriceItem. | 62 // They both should be of type PriceItem. |
| 59 id item = GetCollectionViewItem(0, 0); | 63 id item = GetCollectionViewItem(0, 0); |
| 60 EXPECT_TRUE([item isMemberOfClass:[PriceItem class]]); | 64 EXPECT_TRUE([item isMemberOfClass:[PriceItem class]]); |
| 61 item = GetCollectionViewItem(0, 1); | 65 item = GetCollectionViewItem(0, 1); |
| 62 EXPECT_TRUE([item isMemberOfClass:[PriceItem class]]); | 66 EXPECT_TRUE([item isMemberOfClass:[PriceItem class]]); |
| 63 } | 67 } |
| OLD | NEW |