| 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 #include "components/strings/grit/components_strings.h" |
| 10 #import "ios/chrome/browser/payments/cells/price_item.h" | 11 #import "ios/chrome/browser/payments/cells/price_item.h" |
| 11 #include "ios/chrome/browser/payments/payment_request.h" | 12 #include "ios/chrome/browser/payments/payment_request.h" |
| 12 #import "ios/chrome/browser/payments/payment_request_test_util.h" | 13 #import "ios/chrome/browser/payments/payment_request_test_util.h" |
| 13 #import "ios/chrome/browser/ui/collection_view/collection_view_controller_test.h
" | 14 #import "ios/chrome/browser/ui/collection_view/collection_view_controller_test.h
" |
| 14 #include "ios/chrome/grit/ios_strings.h" | 15 #include "ios/chrome/grit/ios_strings.h" |
| 15 #include "ios/web/public/payments/payment_request.h" | 16 #include "ios/web/public/payments/payment_request.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 18 |
| 18 #if !defined(__has_feature) || !__has_feature(objc_arc) | 19 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 19 #error "This file requires ARC support." | 20 #error "This file requires ARC support." |
| (...skipping 24 matching lines...) Expand all Loading... |
| 44 } | 45 } |
| 45 | 46 |
| 46 std::unique_ptr<autofill::TestPersonalDataManager> personal_data_manager_; | 47 std::unique_ptr<autofill::TestPersonalDataManager> personal_data_manager_; |
| 47 std::unique_ptr<PaymentRequest> payment_request_; | 48 std::unique_ptr<PaymentRequest> payment_request_; |
| 48 }; | 49 }; |
| 49 | 50 |
| 50 // Tests that the correct number of items are displayed after loading the model. | 51 // Tests that the correct number of items are displayed after loading the model. |
| 51 TEST_F(PaymentItemsDisplayViewControllerTest, TestModel) { | 52 TEST_F(PaymentItemsDisplayViewControllerTest, TestModel) { |
| 52 CreateController(); | 53 CreateController(); |
| 53 CheckController(); | 54 CheckController(); |
| 54 CheckTitleWithId(IDS_IOS_PAYMENT_REQUEST_PAYMENT_ITEMS_TITLE); | 55 CheckTitleWithId(IDS_PAYMENTS_ORDER_SUMMARY_LABEL); |
| 55 | 56 |
| 56 [GetPaymentItemsViewController() loadModel]; | 57 [GetPaymentItemsViewController() loadModel]; |
| 57 | 58 |
| 58 ASSERT_EQ(1, NumberOfSections()); | 59 ASSERT_EQ(1, NumberOfSections()); |
| 59 // There should be one item for the total and another one for sub-total. | 60 // There should be one item for the total and another one for sub-total. |
| 60 ASSERT_EQ(2U, static_cast<unsigned int>(NumberOfItemsInSection(0))); | 61 ASSERT_EQ(2U, static_cast<unsigned int>(NumberOfItemsInSection(0))); |
| 61 | 62 |
| 62 // They both should be of type PriceItem. | 63 // They both should be of type PriceItem. |
| 63 id item = GetCollectionViewItem(0, 0); | 64 id item = GetCollectionViewItem(0, 0); |
| 64 EXPECT_TRUE([item isMemberOfClass:[PriceItem class]]); | 65 EXPECT_TRUE([item isMemberOfClass:[PriceItem class]]); |
| 65 item = GetCollectionViewItem(0, 1); | 66 item = GetCollectionViewItem(0, 1); |
| 66 EXPECT_TRUE([item isMemberOfClass:[PriceItem class]]); | 67 EXPECT_TRUE([item isMemberOfClass:[PriceItem class]]); |
| 67 } | 68 } |
| OLD | NEW |