Chromium Code Reviews| 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 |