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

Unified Diff: components/ntp_snippets/remote/ntp_snippets_service_unittest.cc

Issue 2402323002: [NTP Snippets] Persist non-article remote suggestions in the DB (Closed)
Patch Set: review Created 4 years, 2 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/remote/ntp_snippets_service_unittest.cc
diff --git a/components/ntp_snippets/remote/ntp_snippets_service_unittest.cc b/components/ntp_snippets/remote/ntp_snippets_service_unittest.cc
index f18ceacfa67b6b9c87688fc1f8ec65591c1c3c79..b64ac1e92fded7df0295e8d6708d8a8a44fa3c7a 100644
--- a/components/ntp_snippets/remote/ntp_snippets_service_unittest.cc
+++ b/components/ntp_snippets/remote/ntp_snippets_service_unittest.cc
@@ -780,6 +780,23 @@ TEST_F(NTPSnippetsServiceTest, PersistCategoryInfos) {
EXPECT_EQ(info_unknown_before.title(), info_unknown_after.title());
}
+TEST_F(NTPSnippetsServiceTest, PersistSuggestions) {
+ auto service = MakeSnippetsService();
+
+ LoadFromJSONString(service.get(),
+ GetMultiCategoryJson({GetSnippetN(0)}, {GetSnippetN(1)}));
+
+ ASSERT_THAT(service->GetSnippetsForTesting(articles_category()), SizeIs(1));
+ ASSERT_THAT(service->GetSnippetsForTesting(other_category()), SizeIs(1));
+
+ // Recreate the service to simulate a Chrome restart.
+ ResetSnippetsService(&service);
+
+ // The suggestions in both categories should have been restored.
+ EXPECT_THAT(service->GetSnippetsForTesting(articles_category()), SizeIs(1));
+ EXPECT_THAT(service->GetSnippetsForTesting(other_category()), SizeIs(1));
+}
+
TEST_F(NTPSnippetsServiceTest, Clear) {
auto service = MakeSnippetsService();
« no previous file with comments | « components/ntp_snippets/remote/ntp_snippets_service.cc ('k') | components/ntp_snippets/remote/proto/ntp_snippets.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698