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

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

Issue 2422633002: [NTP Snippets] Properly restore the status of restored sections (Closed)
Patch Set: 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 4696433a5e5d0192fd8a754451fc4fda1adefe78..e79d79ca5cb4aa48b17018157061004d7ca987ea 100644
--- a/components/ntp_snippets/remote/ntp_snippets_service_unittest.cc
+++ b/components/ntp_snippets/remote/ntp_snippets_service_unittest.cc
@@ -753,10 +753,10 @@ TEST_F(NTPSnippetsServiceTest, PersistCategoryInfos) {
GetMultiCategoryJson({GetSnippetN(0)}, {GetSnippetN(1)},
kUnknownRemoteCategoryId));
- ASSERT_NE(observer().StatusForCategory(articles_category()),
- CategoryStatus::NOT_PROVIDED);
- ASSERT_NE(observer().StatusForCategory(unknown_category()),
- CategoryStatus::NOT_PROVIDED);
+ ASSERT_EQ(observer().StatusForCategory(articles_category()),
+ CategoryStatus::AVAILABLE);
+ ASSERT_EQ(observer().StatusForCategory(unknown_category()),
+ CategoryStatus::AVAILABLE);
CategoryInfo info_articles_before =
service->GetCategoryInfo(articles_category());
@@ -772,6 +772,11 @@ TEST_F(NTPSnippetsServiceTest, PersistCategoryInfos) {
ASSERT_NE(observer().StatusForCategory(unknown_category()),
CategoryStatus::NOT_PROVIDED);
+ EXPECT_EQ(observer().StatusForCategory(articles_category()),
+ CategoryStatus::AVAILABLE);
+ EXPECT_EQ(observer().StatusForCategory(unknown_category()),
+ CategoryStatus::AVAILABLE);
+
CategoryInfo info_articles_after =
service->GetCategoryInfo(articles_category());
CategoryInfo info_unknown_after =
@@ -787,15 +792,17 @@ TEST_F(NTPSnippetsServiceTest, PersistSuggestions) {
LoadFromJSONString(service.get(),
GetMultiCategoryJson({GetSnippetN(0)}, {GetSnippetN(1)}));
- ASSERT_THAT(service->GetSnippetsForTesting(articles_category()), SizeIs(1));
- ASSERT_THAT(service->GetSnippetsForTesting(other_category()), SizeIs(1));
+ ASSERT_THAT(observer().SuggestionsForCategory(articles_category()),
+ SizeIs(1));
+ ASSERT_THAT(observer().SuggestionsForCategory(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));
+ EXPECT_THAT(observer().SuggestionsForCategory(articles_category()),
+ SizeIs(1));
+ EXPECT_THAT(observer().SuggestionsForCategory(other_category()), SizeIs(1));
}
TEST_F(NTPSnippetsServiceTest, Clear) {

Powered by Google App Engine
This is Rietveld 408576698