Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(310)

Side by Side Diff: ios/chrome/browser/payments/payment_request_view_controller_unittest.mm

Issue 2821043002: [Payment Request] Adds a secondary text label to PaymentsTextCell (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "components/strings/grit/components_strings.h" 13 #include "components/strings/grit/components_strings.h"
14 #import "ios/chrome/browser/payments/cells/autofill_profile_item.h" 14 #import "ios/chrome/browser/payments/cells/autofill_profile_item.h"
15 #import "ios/chrome/browser/payments/cells/page_info_item.h" 15 #import "ios/chrome/browser/payments/cells/page_info_item.h"
16 #import "ios/chrome/browser/payments/cells/payment_method_item.h" 16 #import "ios/chrome/browser/payments/cells/payment_method_item.h"
17 #import "ios/chrome/browser/payments/cells/payments_text_item.h"
17 #import "ios/chrome/browser/payments/cells/price_item.h" 18 #import "ios/chrome/browser/payments/cells/price_item.h"
18 #include "ios/chrome/browser/payments/payment_request.h" 19 #include "ios/chrome/browser/payments/payment_request.h"
19 #include "ios/chrome/browser/payments/payment_request_test_util.h" 20 #include "ios/chrome/browser/payments/payment_request_test_util.h"
20 #import "ios/chrome/browser/ui/autofill/cells/status_item.h" 21 #import "ios/chrome/browser/ui/autofill/cells/status_item.h"
21 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_detail_item .h" 22 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_detail_item .h"
22 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h "
23 #import "ios/chrome/browser/ui/collection_view/collection_view_controller_test.h " 23 #import "ios/chrome/browser/ui/collection_view/collection_view_controller_test.h "
24 #include "ios/chrome/grit/ios_strings.h" 24 #include "ios/chrome/grit/ios_strings.h"
25 #include "ios/web/public/payments/payment_request.h" 25 #include "ios/web/public/payments/payment_request.h"
26 #include "testing/gtest/include/gtest/gtest.h" 26 #include "testing/gtest/include/gtest/gtest.h"
27 27
28 #if !defined(__has_feature) || !__has_feature(objc_arc) 28 #if !defined(__has_feature) || !__has_feature(objc_arc)
29 #error "This file requires ARC support." 29 #error "This file requires ARC support."
30 #endif 30 #endif
31 31
32 class PaymentRequestViewControllerTest : public CollectionViewControllerTest { 32 class PaymentRequestViewControllerTest : public CollectionViewControllerTest {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // There should be two items in the Shipping section. 82 // There should be two items in the Shipping section.
83 ASSERT_EQ(2U, static_cast<unsigned int>(NumberOfItemsInSection(1))); 83 ASSERT_EQ(2U, static_cast<unsigned int>(NumberOfItemsInSection(1)));
84 84
85 // The first one should be of type AutofillProfileItem. 85 // The first one should be of type AutofillProfileItem.
86 item = GetCollectionViewItem(1, 0); 86 item = GetCollectionViewItem(1, 0);
87 EXPECT_TRUE([item isMemberOfClass:[AutofillProfileItem class]]); 87 EXPECT_TRUE([item isMemberOfClass:[AutofillProfileItem class]]);
88 AutofillProfileItem* shipping_address_item = item; 88 AutofillProfileItem* shipping_address_item = item;
89 EXPECT_EQ(MDCCollectionViewCellAccessoryDisclosureIndicator, 89 EXPECT_EQ(MDCCollectionViewCellAccessoryDisclosureIndicator,
90 shipping_address_item.accessoryType); 90 shipping_address_item.accessoryType);
91 91
92 // The next item should be of type CollectionViewTextItem. 92 // The next item should be of type PaymentsTextItem.
93 item = GetCollectionViewItem(1, 1); 93 item = GetCollectionViewItem(1, 1);
94 EXPECT_TRUE([item isMemberOfClass:[CollectionViewTextItem class]]); 94 EXPECT_TRUE([item isMemberOfClass:[PaymentsTextItem class]]);
95 CollectionViewTextItem* shipping_option_item = item; 95 PaymentsTextItem* shipping_option_item = item;
96 EXPECT_EQ(MDCCollectionViewCellAccessoryDisclosureIndicator, 96 EXPECT_EQ(MDCCollectionViewCellAccessoryDisclosureIndicator,
97 shipping_option_item.accessoryType); 97 shipping_option_item.accessoryType);
98 98
99 // The only item in the Payment section should be of type PaymentMethodItem. 99 // The only item in the Payment section should be of type PaymentMethodItem.
100 ASSERT_EQ(1U, static_cast<unsigned int>(NumberOfItemsInSection(2))); 100 ASSERT_EQ(1U, static_cast<unsigned int>(NumberOfItemsInSection(2)));
101 item = GetCollectionViewItem(2, 0); 101 item = GetCollectionViewItem(2, 0);
102 EXPECT_TRUE([item isMemberOfClass:[PaymentMethodItem class]]); 102 EXPECT_TRUE([item isMemberOfClass:[PaymentMethodItem class]]);
103 103
104 // The only item in the Contact info section should be of type 104 // The only item in the Contact info section should be of type
105 // AutofillProfileItem. 105 // AutofillProfileItem.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 [GetPaymentRequestViewController() loadModel]; 194 [GetPaymentRequestViewController() loadModel];
195 195
196 ASSERT_EQ(1, NumberOfSections()); 196 ASSERT_EQ(1, NumberOfSections());
197 // There should be only one item. 197 // There should be only one item.
198 ASSERT_EQ(1U, static_cast<unsigned int>(NumberOfItemsInSection(0))); 198 ASSERT_EQ(1U, static_cast<unsigned int>(NumberOfItemsInSection(0)));
199 199
200 // The item should be of type StatusItem. 200 // The item should be of type StatusItem.
201 id item = GetCollectionViewItem(0, 0); 201 id item = GetCollectionViewItem(0, 0);
202 EXPECT_TRUE([item isMemberOfClass:[StatusItem class]]); 202 EXPECT_TRUE([item isMemberOfClass:[StatusItem class]]);
203 } 203 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698