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

Unified Diff: components/ntp_snippets/content_suggestions_service_unittest.cc

Issue 2230473002: Refactor and extend SnippetsBridge for multi-section support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@categoryinfo
Patch Set: Michael's comments Created 4 years, 4 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: components/ntp_snippets/content_suggestions_service_unittest.cc
diff --git a/components/ntp_snippets/content_suggestions_service_unittest.cc b/components/ntp_snippets/content_suggestions_service_unittest.cc
index 81a7918254108472dd7ac98a15af17c4add75244..064cd38957ce38f0c90f2373f00c96e920760ba2 100644
--- a/components/ntp_snippets/content_suggestions_service_unittest.cc
+++ b/components/ntp_snippets/content_suggestions_service_unittest.cc
@@ -103,7 +103,7 @@ class MockProvider : public ContentSuggestionsProvider {
class MockServiceObserver : public ContentSuggestionsService::Observer {
public:
- MOCK_METHOD0(OnNewSuggestions, void());
+ MOCK_METHOD1(OnNewSuggestions, void(Category category));
MOCK_METHOD2(OnCategoryStatusChanged,
void(Category changed_category, CategoryStatus new_status));
MOCK_METHOD0(ContentSuggestionsServiceShutdown, void());
@@ -317,27 +317,27 @@ TEST_F(ContentSuggestionsServiceTest, ShouldForwardSuggestions) {
service()->AddObserver(&observer);
// Send suggestions 1 and 2
- EXPECT_CALL(observer, OnNewSuggestions()).Times(1);
+ EXPECT_CALL(observer, OnNewSuggestions(articles_category)).Times(1);
provider1->FireSuggestionsChanged(articles_category, {1, 2});
ExpectThatSuggestionsAre(articles_category, {1, 2});
Mock::VerifyAndClearExpectations(&observer);
// Send them again, make sure they're not reported twice
- EXPECT_CALL(observer, OnNewSuggestions()).Times(1);
+ EXPECT_CALL(observer, OnNewSuggestions(articles_category)).Times(1);
provider1->FireSuggestionsChanged(articles_category, {1, 2});
ExpectThatSuggestionsAre(articles_category, {1, 2});
ExpectThatSuggestionsAre(offline_pages_category, std::vector<int>());
Mock::VerifyAndClearExpectations(&observer);
// Send suggestions 13 and 14
- EXPECT_CALL(observer, OnNewSuggestions()).Times(1);
+ EXPECT_CALL(observer, OnNewSuggestions(offline_pages_category)).Times(1);
provider2->FireSuggestionsChanged(offline_pages_category, {13, 14});
ExpectThatSuggestionsAre(articles_category, {1, 2});
ExpectThatSuggestionsAre(offline_pages_category, {13, 14});
Mock::VerifyAndClearExpectations(&observer);
// Send suggestion 1 only
- EXPECT_CALL(observer, OnNewSuggestions()).Times(1);
+ EXPECT_CALL(observer, OnNewSuggestions(articles_category)).Times(1);
provider1->FireSuggestionsChanged(articles_category, {1});
ExpectThatSuggestionsAre(articles_category, {1});
ExpectThatSuggestionsAre(offline_pages_category, {13, 14});

Powered by Google App Engine
This is Rietveld 408576698