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

Unified Diff: sync/engine/download_unittest.cc

Issue 146113003: sync: GU retry with less explicit TimeTicks logic (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update NudgeTracker before normal mode transition cycle Created 6 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 | « sync/engine/download.cc ('k') | sync/engine/sync_scheduler_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/engine/download_unittest.cc
diff --git a/sync/engine/download_unittest.cc b/sync/engine/download_unittest.cc
index 14c9305dd902f5aecea6eb8107b47516a0c59579..c0462bc6fbf75386afd24ef678f671f7661b9972 100644
--- a/sync/engine/download_unittest.cc
+++ b/sync/engine/download_unittest.cc
@@ -25,7 +25,9 @@ using sessions::MockDebugInfoGetter;
// A test fixture for tests exercising download updates functions.
class DownloadUpdatesTest : public ::testing::Test {
protected:
- DownloadUpdatesTest() : update_handler_deleter_(&update_handler_map_) {}
+ DownloadUpdatesTest() :
+ kTestStartTime(base::TimeTicks::Now()),
+ update_handler_deleter_(&update_handler_map_) {}
virtual void SetUp() {
dir_maker_.SetUp();
@@ -64,6 +66,8 @@ class DownloadUpdatesTest : public ::testing::Test {
response->set_changes_remaining(0);
}
+ const base::TimeTicks kTestStartTime;
+
private:
void AddUpdateHandler(ModelType type, ModelSafeGroup group) {
DCHECK(directory());
@@ -244,8 +248,13 @@ TEST_F(DownloadUpdatesTest, RetryTest) {
TEST_F(DownloadUpdatesTest, NudgeWithRetryTest) {
sessions::NudgeTracker nudge_tracker;
nudge_tracker.RecordLocalChange(ModelTypeSet(BOOKMARKS));
- nudge_tracker.set_next_retry_time(
- base::TimeTicks::Now() - base::TimeDelta::FromSeconds(1));
+
+ // Schedule a retry.
+ base::TimeTicks t1 = kTestStartTime;
+ nudge_tracker.SetNextRetryTime(t1);
+
+ // Get the nudge tracker to think the retry is due.
+ nudge_tracker.SetSyncCycleStartTime(t1 + base::TimeDelta::FromSeconds(1));
sync_pb::ClientToServerMessage msg;
download::BuildNormalDownloadUpdatesImpl(proto_request_types(),
« no previous file with comments | « sync/engine/download.cc ('k') | sync/engine/sync_scheduler_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698