| 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);
|
| }
|
|
|