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

Unified Diff: ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater_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/content_suggestions_collection_updater_unittest.mm
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater_unittest.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater_unittest.mm
index 71956f28b73cc4463d64d9facb3f242418c06f8d..edfdf4f5d21e5ca75eb54331d2f787f672980adc 100644
--- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater_unittest.mm
+++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater_unittest.mm
@@ -5,7 +5,8 @@
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.h"
#import "ios/chrome/browser/ui/collection_view/collection_view_model.h"
-#import "ios/chrome/browser/ui/content_suggestions/content_suggestion.h"
+#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_text_item.h"
+#import "ios/chrome/browser/ui/content_suggestions/cells/suggested_content.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.h"
#import "ios/chrome/browser/ui/content_suggestions/identifier/content_suggestion_identifier.h"
#import "ios/chrome/browser/ui/content_suggestions/identifier/content_suggestions_section_information.h"
@@ -28,13 +29,16 @@ TEST(ContentSuggestionsCollectionUpdaterTest, addEmptyItemToEmptySection) {
OCMStub([mockCollection collectionViewModel]).andReturn(model);
updater.collectionViewController = mockCollection;
- ContentSuggestion* suggestion = [[ContentSuggestion alloc] init];
+ CollectionViewItem<SuggestedContent>* suggestion =
+ [[ContentSuggestionsTextItem alloc] initWithType:kItemTypeEnumZero];
suggestion.suggestionIdentifier = [[ContentSuggestionIdentifier alloc] init];
suggestion.suggestionIdentifier.sectionInfo =
[[ContentSuggestionsSectionInformation alloc]
initWithSectionID:ContentSuggestionsSectionArticles];
suggestion.suggestionIdentifier.sectionInfo.showIfEmpty = YES;
- [updater addSectionsForSuggestionsToModel:@[ suggestion ]];
+ [updater addSectionsForSectionInfoToModel:@[
+ suggestion.suggestionIdentifier.sectionInfo
+ ]];
ASSERT_EQ(0, [model numberOfItemsInSection:0]);
// Action.
@@ -54,14 +58,18 @@ TEST(ContentSuggestionsCollectionUpdaterTest, addEmptyItemToSection) {
OCMStub([mockCollection collectionViewModel]).andReturn(model);
updater.collectionViewController = mockCollection;
- ContentSuggestion* suggestion = [[ContentSuggestion alloc] init];
+ CollectionViewItem<SuggestedContent>* suggestion =
+ [[ContentSuggestionsTextItem alloc] initWithType:kItemTypeEnumZero];
suggestion.suggestionIdentifier = [[ContentSuggestionIdentifier alloc] init];
suggestion.suggestionIdentifier.sectionInfo =
[[ContentSuggestionsSectionInformation alloc]
initWithSectionID:ContentSuggestionsSectionArticles];
suggestion.suggestionIdentifier.sectionInfo.showIfEmpty = YES;
- [updater addSectionsForSuggestionsToModel:@[ suggestion ]];
- [updater addSuggestionsToModel:@[ suggestion ]];
+ [updater addSectionsForSectionInfoToModel:@[
+ suggestion.suggestionIdentifier.sectionInfo
+ ]];
+ [updater addSuggestionsToModel:@[ suggestion ]
+ withSectionInfo:suggestion.suggestionIdentifier.sectionInfo];
ASSERT_EQ(1, [model numberOfItemsInSection:0]);
// Action.

Powered by Google App Engine
This is Rietveld 408576698