Index: components/favicon/core/large_icon_service_unittest.cc |
diff --git a/components/favicon/core/large_icon_service_unittest.cc b/components/favicon/core/large_icon_service_unittest.cc |
index 849a185770faf9f3a497b7da9c5cd053866613be..4cc68bb02afa4a8bd10c375a81f2d41bcf91e9a5 100644 |
--- a/components/favicon/core/large_icon_service_unittest.cc |
+++ b/components/favicon/core/large_icon_service_unittest.cc |
@@ -14,6 +14,7 @@ |
#include "base/message_loop/message_loop.h" |
#include "base/run_loop.h" |
#include "base/task/cancelable_task_tracker.h" |
+#include "base/test/histogram_tester.h" |
#include "base/test/mock_callback.h" |
#include "base/threading/thread_task_runner_handle.h" |
#include "components/favicon/core/favicon_client.h" |
@@ -123,6 +124,7 @@ class LargeIconServiceTest : public testing::Test { |
NiceMock<MockImageFetcher>* mock_image_fetcher_; |
testing::NiceMock<MockFaviconService> mock_favicon_service_; |
LargeIconService large_icon_service_; |
+ base::HistogramTester histogram_tester_; |
private: |
DISALLOW_COPY_AND_ASSIGN(LargeIconServiceTest); |
@@ -152,6 +154,8 @@ TEST_F(LargeIconServiceTest, ShouldGetFromGoogleServer) { |
EXPECT_CALL(callback, Run(true)); |
base::RunLoop().RunUntilIdle(); |
+ histogram_tester_.ExpectUniqueSample( |
+ "Favicons.LargeIconService.DownloadedSize", 64, /*expected_count=*/1); |
} |
TEST_F(LargeIconServiceTest, ShouldTrimQueryParametersForGoogleServer) { |
@@ -191,6 +195,9 @@ TEST_F(LargeIconServiceTest, ShouldNotQueryGoogleServerIfInvalidScheme) { |
EXPECT_CALL(callback, Run(false)); |
base::RunLoop().RunUntilIdle(); |
+ // No download histogram recorded. |
+ histogram_tester_.ExpectUniqueSample( |
+ "Favicons.LargeIconService.DownloadedSize", 0, /*expected_count=*/0); |
} |
TEST_F(LargeIconServiceTest, ShouldReportUnavailableIfFetchFromServerFails) { |
@@ -216,6 +223,8 @@ TEST_F(LargeIconServiceTest, ShouldReportUnavailableIfFetchFromServerFails) { |
EXPECT_CALL(callback, Run(false)); |
base::RunLoop().RunUntilIdle(); |
+ histogram_tester_.ExpectUniqueSample( |
+ "Favicons.LargeIconService.DownloadedSize", 0, /*expected_count=*/1); |
} |
TEST_F(LargeIconServiceTest, ShoutNotGetFromGoogleServerIfUnavailable) { |
@@ -240,6 +249,9 @@ TEST_F(LargeIconServiceTest, ShoutNotGetFromGoogleServerIfUnavailable) { |
EXPECT_CALL(callback, Run(false)); |
base::RunLoop().RunUntilIdle(); |
+ // No download histogram recorded. |
+ histogram_tester_.ExpectUniqueSample( |
+ "Favicons.LargeIconService.DownloadedSize", 0, /*expected_count=*/0); |
} |
class LargeIconServiceGetterTest : public LargeIconServiceTest, |