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

Side by Side Diff: ios/chrome/browser/payments/cells/accepted_payment_methods_item_unittest.mm

Issue 2825143002: [Payment Request] Accepted credit card type icons in the credit card editor (Closed)
Patch Set: Addressed comments 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #import "ios/chrome/browser/payments/cells/accepted_payment_methods_item.h"
6
7 #import "ios/chrome/browser/ui/collection_view/cells/test_utils.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "testing/gtest_mac.h"
10
11 #if !defined(__has_feature) || !__has_feature(objc_arc)
12 #error "This file requires ARC support."
13 #endif
14
15 namespace {
16
17 // Tests that the label and the images are set properly after a call to
18 // |configureCell:|.
19 TEST(PaymentRequestAcceptedPaymentMethodsItemTest, TextLabelsAndImages) {
20 AcceptedPaymentMethodsItem* item = [[AcceptedPaymentMethodsItem alloc] init];
21
22 NSString* message = @"Lorem ipsum dolor sit amet";
23 NSArray* methodTypeIcons = @[
24 ios_internal::CollectionViewTestImage(),
25 ios_internal::CollectionViewTestImage()
26 ];
27
28 item.message = message;
29 item.methodTypeIcons = methodTypeIcons;
30
31 id cell = [[[item cellClass] alloc] init];
32 ASSERT_TRUE([cell isMemberOfClass:[AcceptedPaymentMethodsCell class]]);
33
34 AcceptedPaymentMethodsCell* acceptedPaymentMethodsCell = cell;
35 EXPECT_FALSE(acceptedPaymentMethodsCell.messageLabel.text);
36 EXPECT_EQ(nil, acceptedPaymentMethodsCell.methodTypeIconViews);
37
38 [item configureCell:acceptedPaymentMethodsCell];
39 EXPECT_NSEQ(message, acceptedPaymentMethodsCell.messageLabel.text);
40 ASSERT_EQ(2UL, acceptedPaymentMethodsCell.methodTypeIconViews.count);
41 EXPECT_NSEQ(methodTypeIcons[0],
42 acceptedPaymentMethodsCell.methodTypeIconViews[0].image);
43 EXPECT_NSEQ(methodTypeIcons[1],
44 acceptedPaymentMethodsCell.methodTypeIconViews[1].image);
45 }
46
47 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698