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

Unified 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: Initial 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/payments/cells/accepted_payment_methods_item_unittest.mm
diff --git a/ios/chrome/browser/payments/cells/accepted_payment_methods_item_unittest.mm b/ios/chrome/browser/payments/cells/accepted_payment_methods_item_unittest.mm
new file mode 100644
index 0000000000000000000000000000000000000000..1a1b3b5cb883613a23a807f3a74ab6d9cf7d50cc
--- /dev/null
+++ b/ios/chrome/browser/payments/cells/accepted_payment_methods_item_unittest.mm
@@ -0,0 +1,48 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "ios/chrome/browser/payments/cells/accepted_payment_methods_item.h"
+
+#import "ios/chrome/browser/ui/collection_view/cells/test_utils.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/gtest_mac.h"
+
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
+namespace {
+
+// Tests that the label and the images are set properly after a call to
+// |configureCell:|.
+TEST(AccepedPaymentMethodsItemTest, TextLabelsAndImages) {
lpromero 2017/04/20 16:59:52 *Accepted
Moe 2017/04/21 14:14:14 Done.
+ AcceptedPaymentMethodsItem* item =
+ [[AcceptedPaymentMethodsItem alloc] initWithType:0];
lpromero 2017/04/20 16:59:52 Nit: alloc] init] :p
Moe 2017/04/21 14:14:14 good riddance! :D as you can see this CL has been
+
+ NSString* message = @"Lorem ipsum dolor sit amet";
+ NSArray* methodTypeIcons = @[
+ ios_internal::CollectionViewTestImage(),
+ ios_internal::CollectionViewTestImage()
+ ];
+
+ item.message = message;
+ item.methodTypeIcons = methodTypeIcons;
+
+ id cell = [[[item cellClass] alloc] init];
+ ASSERT_TRUE([cell isMemberOfClass:[AcceptedPaymentMethodsCell class]]);
+
+ AcceptedPaymentMethodsCell* acceptedPaymentMethodsCell = cell;
+ EXPECT_FALSE(acceptedPaymentMethodsCell.messageLabel.text);
+ EXPECT_EQ(nil, acceptedPaymentMethodsCell.methodTypeIconViews);
+
+ [item configureCell:acceptedPaymentMethodsCell];
+ EXPECT_NSEQ(message, acceptedPaymentMethodsCell.messageLabel.text);
+ ASSERT_EQ(2UL, acceptedPaymentMethodsCell.methodTypeIconViews.count);
+ EXPECT_NSEQ(methodTypeIcons[0],
+ acceptedPaymentMethodsCell.methodTypeIconViews[0].image);
+ EXPECT_NSEQ(methodTypeIcons[1],
+ acceptedPaymentMethodsCell.methodTypeIconViews[1].image);
+}
+
+} // namespace

Powered by Google App Engine
This is Rietveld 408576698