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

Unified Diff: ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item_unittest.mm

Issue 2734763003: Default background for not suggested article images (Closed)
Patch Set: Fix tests Created 3 years, 9 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
« no previous file with comments | « ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item_unittest.mm
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item_unittest.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item_unittest.mm
index b8c00032bd0757d670e09f605a7d379ca9a0be78..f0b506366a59f6eded0717f7f02c5726d3c7540b 100644
--- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item_unittest.mm
+++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item_unittest.mm
@@ -34,47 +34,18 @@ TEST(ContentSuggestionsArticleItemTest, CellIsConfiguredWithoutImage) {
ContentSuggestionsArticleCell* cell = [[[item cellClass] alloc] init];
ASSERT_EQ([ContentSuggestionsArticleCell class], [cell class]);
ASSERT_EQ(url, item.articleURL);
- ASSERT_EQ(nil, item.image);
+ ASSERT_NE(nil, item.image);
// Action.
[item configureCell:cell];
// Tests.
- EXPECT_EQ(nil, cell.imageView.image);
+ EXPECT_EQ(item.image, cell.imageView.image);
EXPECT_EQ(title, cell.titleLabel.text);
EXPECT_EQ(subtitle, cell.subtitleLabel.text);
EXPECT_OCMOCK_VERIFY(delegateMock);
}
-// Tests that configureCell: set all the fields of the cell with an image and
-// does not call the delegate.
-TEST(ContentSuggestionsArticleItemTest, CellIsConfiguredWithImage) {
- // Setup.
- NSString* title = @"testTitle";
- NSString* subtitle = @"testSubtitle";
- UIImage* image = [[UIImage alloc] init];
- GURL url = GURL("http://chromium.org");
- id delegateMock =
- OCMStrictProtocolMock(@protocol(ContentSuggestionsArticleItemDelegate));
- ContentSuggestionsArticleItem* item =
- [[ContentSuggestionsArticleItem alloc] initWithType:0
- title:title
- subtitle:subtitle
- delegate:delegateMock
- url:url];
- item.image = image;
- ContentSuggestionsArticleCell* cell = [[[item cellClass] alloc] init];
-
- // Action.
- [item configureCell:cell];
-
- // Tests.
- EXPECT_EQ(image, cell.imageView.image);
- EXPECT_EQ(title, cell.titleLabel.text);
- EXPECT_EQ(subtitle, cell.subtitleLabel.text);
- EXPECT_EQ(image, cell.imageView.image);
-}
-
// Tests that configureCell: does not call the delegate if it fetched the image
// once.
TEST(ContentSuggestionsArticleItemTest, DontFetchImageIsImageIsBeingFetched) {
@@ -93,7 +64,7 @@ TEST(ContentSuggestionsArticleItemTest, DontFetchImageIsImageIsBeingFetched) {
OCMExpect([niceDelegateMock loadImageForArticleItem:item]);
ContentSuggestionsArticleCell* cell = [[[item cellClass] alloc] init];
- ASSERT_EQ(nil, item.image);
+ ASSERT_NE(nil, item.image);
[item configureCell:cell];
ASSERT_OCMOCK_VERIFY(niceDelegateMock);
@@ -105,7 +76,7 @@ TEST(ContentSuggestionsArticleItemTest, DontFetchImageIsImageIsBeingFetched) {
[item configureCell:cell];
// Tests.
- EXPECT_EQ(nil, cell.imageView.image);
+ EXPECT_EQ(item.image, cell.imageView.image);
EXPECT_EQ(title, cell.titleLabel.text);
EXPECT_EQ(subtitle, cell.subtitleLabel.text);
}
« no previous file with comments | « ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698