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

Unified Diff: ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_item_unittest.mm

Issue 2877513003: ContentSuggestionsDataSource returns CollectionViewItem (Closed)
Patch Set: Address comments Created 3 years, 7 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/ui/content_suggestions/cells/content_suggestions_item_unittest.mm
diff --git a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_item_unittest.mm b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_item_unittest.mm
index 70b664704f8392f09040df8c5258b5b3776d74c2..807db2fb666b46a26f961477db0093df81d2d33e 100644
--- a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_item_unittest.mm
+++ b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_item_unittest.mm
@@ -25,18 +25,18 @@ TEST(ContentSuggestionsItemTest, CellIsConfiguredWithoutImage) {
GURL url = GURL("http://chromium.org");
NSString* publisher = @"publisherName";
base::Time publishTime = base::Time::Now();
- id delegateMock = OCMProtocolMock(@protocol(ContentSuggestionsItemDelegate));
+ id delegateMock = OCMProtocolMock(@protocol(SuggestedContentDelegate));
ContentSuggestionsItem* item =
[[ContentSuggestionsItem alloc] initWithType:0
title:title
subtitle:subtitle
- delegate:delegateMock
url:url];
+ item.delegate = delegateMock;
item.hasImage = YES;
item.publisher = publisher;
item.publishDate = publishTime;
item.availableOffline = YES;
- OCMExpect([delegateMock loadImageForSuggestionItem:item]);
+ OCMExpect([delegateMock loadImageForSuggestedItem:item]);
ContentSuggestionsCell* cell = [[[item cellClass] alloc] init];
ASSERT_EQ([ContentSuggestionsCell class], [cell class]);
ASSERT_EQ(url, item.URL);
@@ -64,25 +64,24 @@ TEST(ContentSuggestionsItemTest, DontFetchImageIsImageIsBeingFetched) {
NSString* title = @"testTitle";
NSString* subtitle = @"testSubtitle";
GURL url = GURL("http://chromium.org");
- id niceDelegateMock =
- OCMProtocolMock(@protocol(ContentSuggestionsItemDelegate));
+ id niceDelegateMock = OCMProtocolMock(@protocol(SuggestedContentDelegate));
ContentSuggestionsItem* item =
[[ContentSuggestionsItem alloc] initWithType:0
title:title
subtitle:subtitle
- delegate:niceDelegateMock
url:url];
+ item.delegate = niceDelegateMock;
item.hasImage = YES;
item.image = [[UIImage alloc] init];
- OCMExpect([niceDelegateMock loadImageForSuggestionItem:item]);
+ OCMExpect([niceDelegateMock loadImageForSuggestedItem:item]);
ContentSuggestionsCell* cell = [[[item cellClass] alloc] init];
ASSERT_NE(nil, item.image);
[item configureCell:cell];
ASSERT_OCMOCK_VERIFY(niceDelegateMock);
id strictDelegateMock =
- OCMStrictProtocolMock(@protocol(ContentSuggestionsItemDelegate));
+ OCMStrictProtocolMock(@protocol(SuggestedContentDelegate));
item.delegate = strictDelegateMock;
id cellMock = OCMPartialMock(cell);
OCMExpect([cellMock setContentImage:item.image]);
@@ -103,14 +102,13 @@ TEST(ContentSuggestionsItemTest, NoDelegateCallWhenHasNotImage) {
NSString* subtitle = @"testSubtitle";
GURL url = GURL("http://chromium.org");
// Strict mock. Raise exception if the load method is called.
- id delegateMock =
- OCMStrictProtocolMock(@protocol(ContentSuggestionsItemDelegate));
+ id delegateMock = OCMStrictProtocolMock(@protocol(SuggestedContentDelegate));
ContentSuggestionsItem* item =
[[ContentSuggestionsItem alloc] initWithType:0
title:title
subtitle:subtitle
- delegate:delegateMock
url:url];
+ item.delegate = delegateMock;
item.hasImage = NO;
ContentSuggestionsCell* cell = [[[item cellClass] alloc] init];

Powered by Google App Engine
This is Rietveld 408576698