| Index: components/ntp_snippets/ntp_snippets_fetcher_unittest.cc
|
| diff --git a/components/ntp_snippets/ntp_snippets_fetcher_unittest.cc b/components/ntp_snippets/ntp_snippets_fetcher_unittest.cc
|
| index de2e1ccd3bf94f7e2f2fecab6c5213ee85228574..277f5391edccb561be4199fa1611a817c8573616 100644
|
| --- a/components/ntp_snippets/ntp_snippets_fetcher_unittest.cc
|
| +++ b/components/ntp_snippets/ntp_snippets_fetcher_unittest.cc
|
| @@ -426,6 +426,29 @@ TEST_F(NTPSnippetsContentSuggestionsFetcherTest, ShouldFetchSuccessfully) {
|
| /*count=*/1)));
|
| }
|
|
|
| +TEST_F(NTPSnippetsContentSuggestionsFetcherTest, EmptyCategoryIsOK) {
|
| + const std::string kJsonStr =
|
| + "{\"categories\" : [{"
|
| + " \"id\": 1,"
|
| + " \"localizedTitle\": \"Articles for You\""
|
| + "}]}";
|
| + SetFakeResponse(/*data=*/kJsonStr, net::HTTP_OK,
|
| + net::URLRequestStatus::SUCCESS);
|
| + EXPECT_CALL(mock_callback(), Run(IsEmptyArticleList()));
|
| + snippets_fetcher().FetchSnippetsFromHosts(test_hosts(), test_lang(),
|
| + /*count=*/1,
|
| + /*interactive_request=*/true);
|
| + FastForwardUntilNoTasksRemain();
|
| + EXPECT_THAT(snippets_fetcher().last_status(), Eq("OK"));
|
| + EXPECT_THAT(snippets_fetcher().last_json(), Eq(kJsonStr));
|
| + EXPECT_THAT(histogram_tester().GetAllSamples(
|
| + "NewTabPage.Snippets.FetchHttpResponseOrErrorCode"),
|
| + ElementsAre(base::Bucket(/*min=*/200, /*count=*/1)));
|
| + EXPECT_THAT(histogram_tester().GetAllSamples("NewTabPage.Snippets.FetchTime"),
|
| + ElementsAre(base::Bucket(/*min=*/kTestJsonParsingLatencyMs,
|
| + /*count=*/1)));
|
| +}
|
| +
|
| TEST_F(NTPSnippetsContentSuggestionsFetcherTest, ServerCategories) {
|
| const std::string kJsonStr =
|
| "{\"categories\" : [{"
|
|
|