| Index: components/favicon/core/favicon_handler_unittest.cc
|
| diff --git a/components/favicon/core/favicon_handler_unittest.cc b/components/favicon/core/favicon_handler_unittest.cc
|
| index e855508162435ebd488ad0229dc60db23986d55f..4a997f382474f3ff6783867958eccd253e6ccf70 100644
|
| --- a/components/favicon/core/favicon_handler_unittest.cc
|
| +++ b/components/favicon/core/favicon_handler_unittest.cc
|
| @@ -42,6 +42,7 @@ using testing::IsEmpty;
|
| using testing::Return;
|
| using testing::_;
|
|
|
| +using DownloadOutcome = FaviconHandler::DownloadOutcome;
|
| using IntVector = std::vector<int>;
|
| using URLVector = std::vector<GURL>;
|
| using BitmapVector = std::vector<SkBitmap>;
|
| @@ -1072,6 +1073,10 @@ TEST_F(FaviconHandlerTest, TestRecordSingleFaviconDownloadAttempt) {
|
| EXPECT_THAT(
|
| histogram_tester.GetAllSamples("Favicons.DownloadAttempts.TouchIcons"),
|
| IsEmpty());
|
| + EXPECT_THAT(
|
| + histogram_tester.GetAllSamples("Favicons.DownloadOutcome"),
|
| + ElementsAre(base::Bucket(static_cast<int>(DownloadOutcome::SUCCEEDED),
|
| + /*expected_count=*/1)));
|
| }
|
|
|
| TEST_F(FaviconHandlerTest, TestRecordSingleLargeIconDownloadAttempt) {
|
| @@ -1089,6 +1094,10 @@ TEST_F(FaviconHandlerTest, TestRecordSingleLargeIconDownloadAttempt) {
|
| EXPECT_THAT(
|
| histogram_tester.GetAllSamples("Favicons.DownloadAttempts.TouchIcons"),
|
| IsEmpty());
|
| + EXPECT_THAT(
|
| + histogram_tester.GetAllSamples("Favicons.DownloadOutcome"),
|
| + ElementsAre(base::Bucket(static_cast<int>(DownloadOutcome::SUCCEEDED),
|
| + /*expected_count=*/1)));
|
| }
|
|
|
| TEST_F(FaviconHandlerTest, TestRecordSingleTouchIconDownloadAttempt) {
|
| @@ -1106,6 +1115,10 @@ TEST_F(FaviconHandlerTest, TestRecordSingleTouchIconDownloadAttempt) {
|
| EXPECT_THAT(
|
| histogram_tester.GetAllSamples("Favicons.DownloadAttempts.TouchIcons"),
|
| ElementsAre(base::Bucket(/*sample=*/1, /*expected_count=*/1)));
|
| + EXPECT_THAT(
|
| + histogram_tester.GetAllSamples("Favicons.DownloadOutcome"),
|
| + ElementsAre(base::Bucket(static_cast<int>(DownloadOutcome::SUCCEEDED),
|
| + /*expected_count=*/1)));
|
| }
|
|
|
| TEST_F(FaviconHandlerTest, TestRecordDownloadAttemptsFinishedByCache) {
|
| @@ -1148,5 +1161,36 @@ TEST_F(FaviconHandlerTest, TestRecordSingleDownloadAttemptForRefreshingIcons) {
|
| ElementsAre(base::Bucket(/*sample=*/1, /*expected_count=*/1)));
|
| }
|
|
|
| +TEST_F(FaviconHandlerTest, TestRecordFailingDownloadAttempt) {
|
| + base::HistogramTester histogram_tester;
|
| + const GURL k404IconURL("http://www.google.com/404.png");
|
| +
|
| + delegate_.fake_downloader().AddError(k404IconURL, 404);
|
| +
|
| + EXPECT_CALL(favicon_service_, UnableToDownloadFavicon(k404IconURL));
|
| +
|
| + RunHandlerWithSimpleFaviconCandidates({k404IconURL});
|
| +
|
| + EXPECT_THAT(
|
| + histogram_tester.GetAllSamples("Favicons.DownloadOutcome"),
|
| + ElementsAre(base::Bucket(static_cast<int>(DownloadOutcome::FAILED),
|
| + /*expected_count=*/1)));
|
| +}
|
| +
|
| +TEST_F(FaviconHandlerTest, TestRecordSkippedDownloadForKnownFailingUrl) {
|
| + base::HistogramTester histogram_tester;
|
| + const GURL k404IconURL("http://www.google.com/404.png");
|
| +
|
| + ON_CALL(favicon_service_, WasUnableToDownloadFavicon(k404IconURL))
|
| + .WillByDefault(Return(true));
|
| +
|
| + RunHandlerWithSimpleFaviconCandidates({k404IconURL});
|
| +
|
| + EXPECT_THAT(
|
| + histogram_tester.GetAllSamples("Favicons.DownloadOutcome"),
|
| + ElementsAre(base::Bucket(static_cast<int>(DownloadOutcome::SKIPPED),
|
| + /*expected_count=*/1)));
|
| +}
|
| +
|
| } // namespace
|
| } // namespace favicon
|
|
|