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

Unified Diff: components/ntp_snippets/ntp_snippets_service_unittest.cc

Issue 2303713002: Implement ClearHistory for all ntp_snippets providers (Closed)
Patch Set: Created 4 years, 3 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/ntp_snippets_service_unittest.cc
diff --git a/components/ntp_snippets/ntp_snippets_service_unittest.cc b/components/ntp_snippets/ntp_snippets_service_unittest.cc
index 974f2e8f4550dfe78d0cacc9c6c5cc4552fd64ab..21cec301a289adc1a4cd8e2d4a97633db17d80b6 100644
--- a/components/ntp_snippets/ntp_snippets_service_unittest.cc
+++ b/components/ntp_snippets/ntp_snippets_service_unittest.cc
@@ -864,4 +864,23 @@ TEST_F(NTPSnippetsServiceTest, EmptyImageReturnedForNonExistentId) {
EXPECT_TRUE(image.IsEmpty());
}
+TEST_F(NTPSnippetsServiceTest, NukeAllSnippetsRemovesAllSuggestions) {
+ auto service = MakeSnippetsService();
+
+ std::string first_snippet = GetSnippetWithUrl("http://url1.com");
+ std::string second_snippet = GetSnippetWithUrl("http://url2.com");
+ std::string json_str = GetTestJson({first_snippet, second_snippet});
+ LoadFromJSONString(service.get(), json_str);
+ ASSERT_THAT(service->GetSnippetsForTesting(), SizeIs(2));
+
+ service->DismissSuggestion(MakeUniqueID(*service, "http://url1.com"));
+ ASSERT_THAT(service->GetSnippetsForTesting(), SizeIs(1));
+ ASSERT_THAT(service->dismissed_snippets_, SizeIs(1));
+
+ service->NukeAllSnippets();
Marc Treib 2016/09/01 14:11:20 Call ClearHistory instead, so you call a public AP
vitaliii 2016/09/01 14:45:15 Done.
+
+ EXPECT_THAT(service->GetSnippetsForTesting(), IsEmpty());
+ EXPECT_THAT(service->dismissed_snippets_, IsEmpty());
+}
+
} // namespace ntp_snippets

Powered by Google App Engine
This is Rietveld 408576698