Index: components/doodle/doodle_service_unittest.cc |
diff --git a/components/doodle/doodle_service_unittest.cc b/components/doodle/doodle_service_unittest.cc |
index 8f6fc7e1011d70d07632e7a9e00e68b94adf3ffc..856faff6d0a3031b5830db30488c95c6549a8594 100644 |
--- a/components/doodle/doodle_service_unittest.cc |
+++ b/components/doodle/doodle_service_unittest.cc |
@@ -490,6 +490,22 @@ TEST_F(DoodleServiceTest, RecordsMetricsForEarlyRefreshRequest) { |
histograms.ExpectTotalCount("Doodle.ConfigDownloadTime", 0); |
} |
+TEST_F(DoodleServiceTest, RefreshReturnsFalseOnlyForSkippedRefreshAttempts) { |
+ // Create a service with some refresh interval. |
+ RecreateService(/*min_refresh_interval=*/base::TimeDelta::FromMinutes(10)); |
+ |
+ // Trigger a refresh resulting in a fetch that receives information about no |
+ // newer doodle being available. |
+ EXPECT_TRUE(service()->Refresh()); |
+ fetcher()->ServeAllCallbacks(DoodleState::NO_DOODLE, base::TimeDelta(), |
+ base::nullopt); |
+ |
+ // Request a refresh before the min refresh interval has passed which should |
+ // not have resulted in a request. |
+ EXPECT_FALSE(service()->Refresh()); |
+ EXPECT_THAT(fetcher()->num_pending_callbacks(), Eq(0u)); |
+} |
+ |
TEST_F(DoodleServiceTest, DoesNotRecordMetricsAtStartup) { |
// Creating the service should not emit any histogram samples. |
base::HistogramTester histograms; |