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

Unified Diff: ios/chrome/browser/payments/cells/payment_method_item_unittest.mm

Issue 2585233003: Upstream Chrome on iOS source code [2/11]. (Closed)
Patch Set: Created 4 years 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/payment_method_item_unittest.mm
diff --git a/ios/chrome/browser/payments/cells/payment_method_item_unittest.mm b/ios/chrome/browser/payments/cells/payment_method_item_unittest.mm
new file mode 100644
index 0000000000000000000000000000000000000000..6a5e4be92989ae124f5d47e5a334d6e96c64aa65
--- /dev/null
+++ b/ios/chrome/browser/payments/cells/payment_method_item_unittest.mm
@@ -0,0 +1,51 @@
+// Copyright 2016 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/payment_method_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 labels and image are set properly after a call to
+// |configureCell:|.
+TEST(PaymentMethodItemTest, TextLabels) {
+ PaymentMethodItem* item = [[PaymentMethodItem alloc] initWithType:0];
+
+ NSString* methodID = @"BobPay - ****-6789";
+ NSString* methodDetail = @"Bobs Your Uncle III, esq.";
+ UIImage* methodTypeIcon = ios_internal::CollectionViewTestImage();
+ MDCCollectionViewCellAccessoryType accessoryType =
+ MDCCollectionViewCellAccessoryDisclosureIndicator;
+
+ item.methodID = methodID;
+ item.methodDetail = methodDetail;
+ item.methodTypeIcon = methodTypeIcon;
+ item.accessoryType = accessoryType;
+
+ id cell = [[[item cellClass] alloc] init];
+ ASSERT_TRUE([cell isMemberOfClass:[PaymentMethodCell class]]);
+
+ PaymentMethodCell* paymentMethodCell = cell;
+ EXPECT_FALSE(paymentMethodCell.methodIDLabel.text);
+ EXPECT_FALSE(paymentMethodCell.methodDetailLabel.text);
+ EXPECT_FALSE(paymentMethodCell.methodTypeIconView.image);
+ EXPECT_EQ(paymentMethodCell.accessoryType,
+ MDCCollectionViewCellAccessoryNone);
+
+ [item configureCell:paymentMethodCell];
+ EXPECT_NSEQ(methodID, paymentMethodCell.methodIDLabel.text);
+ EXPECT_NSEQ(methodDetail, paymentMethodCell.methodDetailLabel.text);
+ EXPECT_NSEQ(methodTypeIcon, paymentMethodCell.methodTypeIconView.image);
+ EXPECT_EQ(paymentMethodCell.accessoryType,
+ MDCCollectionViewCellAccessoryDisclosureIndicator);
+}
+
+} // namespace
« no previous file with comments | « ios/chrome/browser/payments/cells/payment_method_item.mm ('k') | ios/chrome/browser/payments/cells/shipping_address_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698