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

Unified Diff: sync/sessions/nudge_tracker_unittest.cc

Issue 171813013: sync: Merge GU retry logic into normal GU (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 10 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/sessions/nudge_tracker.cc ('k') | sync/sessions/test_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/sessions/nudge_tracker_unittest.cc
diff --git a/sync/sessions/nudge_tracker_unittest.cc b/sync/sessions/nudge_tracker_unittest.cc
index 6ad9e379aa496c87b5d9a87510cf2214bdaf4486..dc7f5ba7e43899bbb433c7edbc7777a18e55adc7 100644
--- a/sync/sessions/nudge_tracker_unittest.cc
+++ b/sync/sessions/nudge_tracker_unittest.cc
@@ -83,47 +83,55 @@ TEST_F(NudgeTrackerTest, EmptyNudgeTracker) {
EXPECT_FALSE(nudge_tracker_.IsSyncRequired());
EXPECT_FALSE(nudge_tracker_.IsGetUpdatesRequired());
EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::UNKNOWN,
- nudge_tracker_.updates_source());
+ nudge_tracker_.GetLegacySource());
sync_pb::GetUpdateTriggers gu_trigger;
nudge_tracker_.FillProtoMessage(BOOKMARKS, &gu_trigger);
EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::UNKNOWN,
- nudge_tracker_.updates_source());
+ nudge_tracker_.GetLegacySource());
}
// Verify that nudges override each other based on a priority order.
-// LOCAL < DATATYPE_REFRESH < NOTIFICATION
+// RETRY < LOCAL < DATATYPE_REFRESH < NOTIFICATION
TEST_F(NudgeTrackerTest, SourcePriorities) {
+ // Start with a retry request.
+ const base::TimeTicks t0 = base::TimeTicks::FromInternalValue(1234);
+ const base::TimeTicks t1 = t0 + base::TimeDelta::FromSeconds(10);
+ nudge_tracker_.SetNextRetryTime(t0);
+ nudge_tracker_.SetSyncCycleStartTime(t1);
+ EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::RETRY,
+ nudge_tracker_.GetLegacySource());
+
// Track a local nudge.
nudge_tracker_.RecordLocalChange(ModelTypeSet(BOOKMARKS));
EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::LOCAL,
- nudge_tracker_.updates_source());
+ nudge_tracker_.GetLegacySource());
// A refresh request will override it.
nudge_tracker_.RecordLocalRefreshRequest(ModelTypeSet(TYPED_URLS));
EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::DATATYPE_REFRESH,
- nudge_tracker_.updates_source());
+ nudge_tracker_.GetLegacySource());
// Another local nudge will not be enough to change it.
nudge_tracker_.RecordLocalChange(ModelTypeSet(BOOKMARKS));
EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::DATATYPE_REFRESH,
- nudge_tracker_.updates_source());
+ nudge_tracker_.GetLegacySource());
// An invalidation will override the refresh request source.
ObjectIdInvalidationMap invalidation_map =
BuildInvalidationMap(PREFERENCES, 1, "hint");
nudge_tracker_.RecordRemoteInvalidation(invalidation_map);
EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::NOTIFICATION,
- nudge_tracker_.updates_source());
+ nudge_tracker_.GetLegacySource());
// Neither local nudges nor refresh requests will override it.
nudge_tracker_.RecordLocalChange(ModelTypeSet(BOOKMARKS));
EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::NOTIFICATION,
- nudge_tracker_.updates_source());
+ nudge_tracker_.GetLegacySource());
nudge_tracker_.RecordLocalRefreshRequest(ModelTypeSet(TYPED_URLS));
EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::NOTIFICATION,
- nudge_tracker_.updates_source());
+ nudge_tracker_.GetLegacySource());
}
// Verifies the management of invalidation hints and GU trigger fields.
« no previous file with comments | « sync/sessions/nudge_tracker.cc ('k') | sync/sessions/test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698