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 #include "components/strings/grit/components_strings.h" |
11 #import "ios/chrome/browser/payments/cells/price_item.h" | 11 #import "ios/chrome/browser/payments/cells/price_item.h" |
12 #include "ios/chrome/browser/payments/payment_request.h" | 12 #include "ios/chrome/browser/payments/payment_request.h" |
13 #import "ios/chrome/browser/payments/payment_request_test_util.h" | 13 #import "ios/chrome/browser/payments/payment_request_test_util.h" |
14 #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
" |
15 #include "ios/chrome/grit/ios_strings.h" | 15 #include "ios/chrome/grit/ios_strings.h" |
16 #include "ios/web/public/payments/payment_request.h" | 16 #include "ios/web/public/payments/payment_request.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
18 | 18 |
19 #if !defined(__has_feature) || !__has_feature(objc_arc) | 19 #if !defined(__has_feature) || !__has_feature(objc_arc) |
20 #error "This file requires ARC support." | 20 #error "This file requires ARC support." |
21 #endif | 21 #endif |
22 | 22 |
23 class PaymentRequestPaymentItemsDisplayViewControllerTest | 23 class PaymentRequestPaymentItemsDisplayViewControllerTest |
24 : public CollectionViewControllerTest { | 24 : public CollectionViewControllerTest { |
25 protected: | 25 protected: |
26 CollectionViewController* NewController() override NS_RETURNS_RETAINED { | 26 CollectionViewController* InstantiateController() override { |
27 payment_request_ = base::MakeUnique<PaymentRequest>( | 27 payment_request_ = base::MakeUnique<PaymentRequest>( |
28 payment_request_test_util::CreateTestWebPaymentRequest(), | 28 payment_request_test_util::CreateTestWebPaymentRequest(), |
29 &personal_data_manager_); | 29 &personal_data_manager_); |
30 | 30 |
31 return [[PaymentItemsDisplayViewController alloc] | 31 return [[PaymentItemsDisplayViewController alloc] |
32 initWithPaymentRequest:payment_request_.get() | 32 initWithPaymentRequest:payment_request_.get() |
33 payButtonEnabled:YES]; | 33 payButtonEnabled:YES]; |
34 } | 34 } |
35 | 35 |
36 PaymentItemsDisplayViewController* GetPaymentItemsViewController() { | 36 PaymentItemsDisplayViewController* GetPaymentItemsViewController() { |
(...skipping 16 matching lines...) Expand all Loading... |
53 ASSERT_EQ(1, NumberOfSections()); | 53 ASSERT_EQ(1, NumberOfSections()); |
54 // There should be one item for the total and another one for sub-total. | 54 // There should be one item for the total and another one for sub-total. |
55 ASSERT_EQ(2U, static_cast<unsigned int>(NumberOfItemsInSection(0))); | 55 ASSERT_EQ(2U, static_cast<unsigned int>(NumberOfItemsInSection(0))); |
56 | 56 |
57 // They both should be of type PriceItem. | 57 // They both should be of type PriceItem. |
58 id item = GetCollectionViewItem(0, 0); | 58 id item = GetCollectionViewItem(0, 0); |
59 EXPECT_TRUE([item isMemberOfClass:[PriceItem class]]); | 59 EXPECT_TRUE([item isMemberOfClass:[PriceItem class]]); |
60 item = GetCollectionViewItem(0, 1); | 60 item = GetCollectionViewItem(0, 1); |
61 EXPECT_TRUE([item isMemberOfClass:[PriceItem class]]); | 61 EXPECT_TRUE([item isMemberOfClass:[PriceItem class]]); |
62 } | 62 } |
OLD | NEW |