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 |
deleted file mode 100644 |
index f0b506366a59f6eded0717f7f02c5726d3c7540b..0000000000000000000000000000000000000000 |
--- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item_unittest.mm |
+++ /dev/null |
@@ -1,84 +0,0 @@ |
-// 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/ui/content_suggestions/content_suggestions_article_item.h" |
- |
-#include "testing/gtest/include/gtest/gtest.h" |
-#import "third_party/ocmock/OCMock/OCMock.h" |
-#import "third_party/ocmock/gtest_support.h" |
-#include "url/gurl.h" |
- |
-#if !defined(__has_feature) || !__has_feature(objc_arc) |
-#error "This file requires ARC support." |
-#endif |
- |
-namespace { |
- |
-// Tests that configureCell: set all the fields of the cell except the image and |
-// fetches the image through the delegate. |
-TEST(ContentSuggestionsArticleItemTest, CellIsConfiguredWithoutImage) { |
- // Setup. |
- NSString* title = @"testTitle"; |
- NSString* subtitle = @"testSubtitle"; |
- GURL url = GURL("http://chromium.org"); |
- id delegateMock = |
- OCMProtocolMock(@protocol(ContentSuggestionsArticleItemDelegate)); |
- ContentSuggestionsArticleItem* item = |
- [[ContentSuggestionsArticleItem alloc] initWithType:0 |
- title:title |
- subtitle:subtitle |
- delegate:delegateMock |
- url:url]; |
- OCMExpect([delegateMock loadImageForArticleItem:item]); |
- ContentSuggestionsArticleCell* cell = [[[item cellClass] alloc] init]; |
- ASSERT_EQ([ContentSuggestionsArticleCell class], [cell class]); |
- ASSERT_EQ(url, item.articleURL); |
- ASSERT_NE(nil, item.image); |
- |
- // Action. |
- [item configureCell:cell]; |
- |
- // Tests. |
- 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: does not call the delegate if it fetched the image |
-// once. |
-TEST(ContentSuggestionsArticleItemTest, DontFetchImageIsImageIsBeingFetched) { |
- // Setup. |
- NSString* title = @"testTitle"; |
- NSString* subtitle = @"testSubtitle"; |
- GURL url = GURL("http://chromium.org"); |
- id niceDelegateMock = |
- OCMProtocolMock(@protocol(ContentSuggestionsArticleItemDelegate)); |
- ContentSuggestionsArticleItem* item = |
- [[ContentSuggestionsArticleItem alloc] initWithType:0 |
- title:title |
- subtitle:subtitle |
- delegate:niceDelegateMock |
- url:url]; |
- |
- OCMExpect([niceDelegateMock loadImageForArticleItem:item]); |
- ContentSuggestionsArticleCell* cell = [[[item cellClass] alloc] init]; |
- ASSERT_NE(nil, item.image); |
- [item configureCell:cell]; |
- ASSERT_OCMOCK_VERIFY(niceDelegateMock); |
- |
- id strictDelegateMock = |
- OCMStrictProtocolMock(@protocol(ContentSuggestionsArticleItemDelegate)); |
- item.delegate = strictDelegateMock; |
- |
- // Action. |
- [item configureCell:cell]; |
- |
- // Tests. |
- EXPECT_EQ(item.image, cell.imageView.image); |
- EXPECT_EQ(title, cell.titleLabel.text); |
- EXPECT_EQ(subtitle, cell.subtitleLabel.text); |
-} |
- |
-} // namespace |