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

Unified Diff: chrome/browser/services/gcm/gcm_account_tracker_unittest.cc

Issue 885753002: Fixing the super-long delay when GCMAccountTracker posts a task (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding dependnecy on GCM Driver being connected Created 5 years, 11 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 | « chrome/browser/services/gcm/gcm_account_tracker.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/services/gcm/gcm_account_tracker_unittest.cc
diff --git a/chrome/browser/services/gcm/gcm_account_tracker_unittest.cc b/chrome/browser/services/gcm/gcm_account_tracker_unittest.cc
index 2093f6b313baff58dba47c07e344c64e922f3c2d..a8131eb993fcf7d9b9c186f1aadf95c44aad43e1 100644
--- a/chrome/browser/services/gcm/gcm_account_tracker_unittest.cc
+++ b/chrome/browser/services/gcm/gcm_account_tracker_unittest.cc
@@ -476,9 +476,22 @@ TEST_F(GCMAccountTrackerTest, GetTimeToNextTokenReporting) {
// At this point the last token fetch time is never.
EXPECT_EQ(base::TimeDelta(), GetTimeToNextTokenReporting());
+ // Regular case. The tokens have been just reported.
driver()->SetLastTokenFetchTime(base::Time::Now());
EXPECT_TRUE(GetTimeToNextTokenReporting() <=
base::TimeDelta::FromSeconds(12 * 60 * 60));
+
+ // A case when gcm driver is not yet initialized.
+ driver()->SetLastTokenFetchTime(base::Time::Max());
+ EXPECT_EQ(base::TimeDelta::FromSeconds(12 * 60 * 60),
+ GetTimeToNextTokenReporting());
+
+ // A case when token reporting calculation is expected to result in more than
+ // 12 hours, in which case we expect exactly 12 hours.
+ driver()->SetLastTokenFetchTime(base::Time::Now() +
+ base::TimeDelta::FromDays(2));
+ EXPECT_EQ(base::TimeDelta::FromSeconds(12 * 60 * 60),
+ GetTimeToNextTokenReporting());
}
// Tests conditions when token reporting is required.
« no previous file with comments | « chrome/browser/services/gcm/gcm_account_tracker.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698