Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(654)

Unified Diff: components/doodle/doodle_service_unittest.cc

Issue 2838833005: Move NewTabPage.LogoShownTime metrics recording into LogoBridge (Closed)
Patch Set: Remove state from LoadTimeMetricsRecorder Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/doodle/doodle_service.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « components/doodle/doodle_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698