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

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

Issue 2712053003: [Payment Request] Displays Contact Info in the payment summary view (Closed)
Patch Set: Addressed comments Created 3 years, 10 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/autofill_profile_item_unittest.mm
diff --git a/ios/chrome/browser/payments/cells/autofill_profile_item_unittest.mm b/ios/chrome/browser/payments/cells/autofill_profile_item_unittest.mm
new file mode 100644
index 0000000000000000000000000000000000000000..abc516694008fb198a8af374d8f58578ff9ba62a
--- /dev/null
+++ b/ios/chrome/browser/payments/cells/autofill_profile_item_unittest.mm
@@ -0,0 +1,51 @@
+// 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/autofill_profile_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 are set properly after a call to |configureCell:|.
+TEST(AutofillProfileItemTest, TextLabels) {
+ AutofillProfileItem* item = [[AutofillProfileItem alloc] initWithType:0];
+
+ NSString* name = @"Jon Doe";
+ NSString* address = @"123 Main St, Anytown, USA";
+ NSString* phoneNumber = @"1234567890";
+ NSString* email = @"123-456-7890";
+ NSString* notification = @"More information is required";
+
+ item.name = name;
+ item.address = address;
+ item.phoneNumber = phoneNumber;
+ item.email = email;
+ item.notification = notification;
+
+ id cell = [[[item cellClass] alloc] init];
+ ASSERT_TRUE([cell isMemberOfClass:[AutofillProfileCell class]]);
+
+ AutofillProfileCell* autofillProfileCell = cell;
+ EXPECT_FALSE(autofillProfileCell.nameLabel.text);
+ EXPECT_FALSE(autofillProfileCell.addressLabel.text);
+ EXPECT_FALSE(autofillProfileCell.phoneNumberLabel.text);
+ EXPECT_FALSE(autofillProfileCell.emailLabel.text);
+ EXPECT_FALSE(autofillProfileCell.notificationLabel.text);
+
+ [item configureCell:autofillProfileCell];
+ EXPECT_NSEQ(name, autofillProfileCell.nameLabel.text);
+ EXPECT_NSEQ(address, autofillProfileCell.addressLabel.text);
+ EXPECT_NSEQ(phoneNumber, autofillProfileCell.phoneNumberLabel.text);
+ EXPECT_NSEQ(email, autofillProfileCell.emailLabel.text);
+ EXPECT_NSEQ(notification, autofillProfileCell.notificationLabel.text);
+}
+
+} // namespace

Powered by Google App Engine
This is Rietveld 408576698