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 3317882003f716b97b4ed2cc2527e7cd505cc7ee..160a9677dad37fb43fae4e4bfd9da9350ed6f800 100644 |
--- a/components/ntp_snippets/ntp_snippets_service_unittest.cc |
+++ b/components/ntp_snippets/ntp_snippets_service_unittest.cc |
@@ -491,7 +491,7 @@ TEST_F(NTPSnippetsServiceTest, LoadIncompleteJsonWithExistingSnippets) { |
EXPECT_THAT(service()->snippets(), SizeIs(1)); |
} |
-TEST_F(NTPSnippetsServiceTest, Discard) { |
+TEST_F(NTPSnippetsServiceTest, Dismiss) { |
std::vector<std::string> source_urls, publishers, amp_urls; |
source_urls.push_back(std::string("http://site.com")); |
publishers.push_back(std::string("Source 1")); |
@@ -503,44 +503,44 @@ TEST_F(NTPSnippetsServiceTest, Discard) { |
ASSERT_THAT(service()->snippets(), SizeIs(1)); |
- // Discarding a non-existent snippet shouldn't do anything. |
- service()->DiscardSuggestion(MakeUniqueID("http://othersite.com")); |
+ // Dismissing a non-existent snippet shouldn't do anything. |
+ service()->DismissSuggestion(MakeUniqueID("http://othersite.com")); |
EXPECT_THAT(service()->snippets(), SizeIs(1)); |
- // Discard the snippet. |
- service()->DiscardSuggestion(MakeUniqueID(kSnippetUrl)); |
+ // Dismiss the snippet. |
+ service()->DismissSuggestion(MakeUniqueID(kSnippetUrl)); |
EXPECT_THAT(service()->snippets(), IsEmpty()); |
// Make sure that fetching the same snippet again does not re-add it. |
LoadFromJSONString(json_str); |
EXPECT_THAT(service()->snippets(), IsEmpty()); |
- // The snippet should stay discarded even after re-creating the service. |
+ // The snippet should stay dismissed even after re-creating the service. |
EXPECT_CALL(mock_scheduler(), Schedule(_, _, _, _)).Times(1); |
CreateSnippetsService(/*enabled=*/true); |
LoadFromJSONString(json_str); |
EXPECT_THAT(service()->snippets(), IsEmpty()); |
- // The snippet can be added again after clearing discarded snippets. |
- service()->ClearDiscardedSuggestionsForDebugging(); |
+ // The snippet can be added again after clearing dismissed snippets. |
+ service()->ClearDismissedSuggestionsForDebugging(); |
EXPECT_THAT(service()->snippets(), IsEmpty()); |
LoadFromJSONString(json_str); |
EXPECT_THAT(service()->snippets(), SizeIs(1)); |
} |
-TEST_F(NTPSnippetsServiceTest, GetDiscarded) { |
+TEST_F(NTPSnippetsServiceTest, GetDismissed) { |
LoadFromJSONString(GetTestJson({GetSnippet()})); |
- service()->DiscardSuggestion(MakeUniqueID(kSnippetUrl)); |
- const NTPSnippet::PtrVector& snippets = service()->discarded_snippets(); |
+ service()->DismissSuggestion(MakeUniqueID(kSnippetUrl)); |
+ const NTPSnippet::PtrVector& snippets = service()->dismissed_snippets(); |
EXPECT_EQ(1u, snippets.size()); |
for (auto& snippet : snippets) { |
EXPECT_EQ(kSnippetUrl, snippet->id()); |
} |
- // There should be no discarded snippet after clearing the list. |
- service()->ClearDiscardedSuggestionsForDebugging(); |
- EXPECT_EQ(0u, service()->discarded_snippets().size()); |
+ // There should be no dismissed snippet after clearing the list. |
+ service()->ClearDismissedSuggestionsForDebugging(); |
+ EXPECT_EQ(0u, service()->dismissed_snippets().size()); |
} |
TEST_F(NTPSnippetsServiceTest, CreationTimestampParseFail) { |
@@ -815,14 +815,14 @@ TEST_F(NTPSnippetsServiceTest, LogNumArticlesHistogram) { |
EXPECT_THAT( |
tester.GetAllSamples("NewTabPage.Snippets.NumArticlesZeroDueToDiscarded"), |
IsEmpty()); |
- // Discarding a snippet should decrease the list size. This will only be |
+ // Dismissing a snippet should decrease the list size. This will only be |
// logged after the next fetch. |
- service()->DiscardSuggestion(MakeUniqueID(kSnippetUrl)); |
+ service()->DismissSuggestion(MakeUniqueID(kSnippetUrl)); |
LoadFromJSONString(GetTestJson({GetSnippet()})); |
EXPECT_THAT(tester.GetAllSamples("NewTabPage.Snippets.NumArticles"), |
ElementsAre(base::Bucket(/*min=*/0, /*count=*/3), |
base::Bucket(/*min=*/1, /*count=*/2))); |
- // Discarded snippets shouldn't influence NumArticlesFetched. |
+ // Dismissed snippets shouldn't influence NumArticlesFetched. |
EXPECT_THAT(tester.GetAllSamples("NewTabPage.Snippets.NumArticlesFetched"), |
ElementsAre(base::Bucket(/*min=*/0, /*count=*/1), |
base::Bucket(/*min=*/1, /*count=*/3))); |
@@ -836,7 +836,7 @@ TEST_F(NTPSnippetsServiceTest, LogNumArticlesHistogram) { |
tester.ExpectTotalCount("NewTabPage.Snippets.NumArticlesFetched", 4); |
} |
-TEST_F(NTPSnippetsServiceTest, DiscardShouldRespectAllKnownUrls) { |
+TEST_F(NTPSnippetsServiceTest, DismissShouldRespectAllKnownUrls) { |
const std::string creation = |
NTPSnippet::TimeToJsonString(GetDefaultCreationTime()); |
const std::string expiry = |
@@ -855,11 +855,11 @@ TEST_F(NTPSnippetsServiceTest, DiscardShouldRespectAllKnownUrls) { |
LoadFromJSONString(GetTestJson({GetSnippetWithUrlAndTimesAndSources( |
source_urls[0], creation, expiry, source_urls, publishers, amp_urls)})); |
ASSERT_THAT(service()->snippets(), SizeIs(1)); |
- // Discard the snippet via the mashable source corpus ID. |
- service()->DiscardSuggestion(MakeUniqueID(source_urls[0])); |
+ // Dismiss the snippet via the mashable source corpus ID. |
+ service()->DismissSuggestion(MakeUniqueID(source_urls[0])); |
EXPECT_THAT(service()->snippets(), IsEmpty()); |
- // The same article from the AOL domain should now be detected as discarded. |
+ // The same article from the AOL domain should now be detected as dismissed. |
LoadFromJSONString(GetTestJson({GetSnippetWithUrlAndTimesAndSources( |
source_urls[1], creation, expiry, source_urls, publishers, amp_urls)})); |
ASSERT_THAT(service()->snippets(), IsEmpty()); |