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

Unified Diff: ios/chrome/browser/payments/cells/page_info_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/page_info_item_unittest.mm
diff --git a/ios/chrome/browser/payments/cells/page_info_item_unittest.mm b/ios/chrome/browser/payments/cells/page_info_item_unittest.mm
new file mode 100644
index 0000000000000000000000000000000000000000..705da4827ecb3d5351e83a60b3ad1f2af64dc64c
--- /dev/null
+++ b/ios/chrome/browser/payments/cells/page_info_item_unittest.mm
@@ -0,0 +1,44 @@
+// 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/page_info_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(PageInfoItemTest, TextLabels) {
+ PageInfoItem* item = [[PageInfoItem alloc] initWithType:0];
+
+ UIImage* pageFavicon = ios_internal::CollectionViewTestImage();
+ NSString* pageTitle = @"The Greatest Website Ever";
+ NSString* pageHost = @"www.greatest.example.com";
+
+ item.pageFavicon = pageFavicon;
+ item.pageTitle = pageTitle;
+ item.pageHost = pageHost;
+
+ id cell = [[[item cellClass] alloc] init];
+ ASSERT_TRUE([cell isMemberOfClass:[PageInfoCell class]]);
+
+ PageInfoCell* pageInfoCell = cell;
+ EXPECT_FALSE(pageInfoCell.pageTitleLabel.text);
+ EXPECT_FALSE(pageInfoCell.pageHostLabel.text);
+ EXPECT_FALSE(pageInfoCell.pageFaviconView.image);
+
+ [item configureCell:pageInfoCell];
+ EXPECT_NSEQ(pageTitle, pageInfoCell.pageTitleLabel.text);
+ EXPECT_NSEQ(pageHost, pageInfoCell.pageHostLabel.text);
+ EXPECT_NSEQ(pageFavicon, pageInfoCell.pageFaviconView.image);
+}
+
+} // namespace
« no previous file with comments | « ios/chrome/browser/payments/cells/page_info_item.mm ('k') | ios/chrome/browser/payments/cells/payment_method_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698