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

Unified Diff: sync/engine/download_unittest.cc

Issue 124083002: Client-side changes to support retry GU. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
Index: sync/engine/download_unittest.cc
diff --git a/sync/engine/download_unittest.cc b/sync/engine/download_unittest.cc
index eae627791abd9fe533efd969607d444ccc3503b0..134f441fe9bba890efdc4221dbea0811ed340ca1 100644
--- a/sync/engine/download_unittest.cc
+++ b/sync/engine/download_unittest.cc
@@ -219,6 +219,43 @@ TEST_F(DownloadUpdatesTest, PollTest) {
EXPECT_TRUE(proto_request_types().Equals(progress_types));
}
+TEST_F(DownloadUpdatesTest, RetryTest) {
+ sync_pb::ClientToServerMessage msg;
+ download::BuildDownloadUpdatesForRetryImpl(
+ proto_request_types(),
+ update_handler_map(),
+ msg.mutable_get_updates());
+
+ const sync_pb::GetUpdatesMessage& gu_msg = msg.get_updates();
+
+ EXPECT_EQ(sync_pb::SyncEnums::RETRY, gu_msg.get_updates_origin());
+ EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::RETRY,
+ gu_msg.caller_info().source());
+ EXPECT_TRUE(gu_msg.is_retry());
+
+ ModelTypeSet progress_types;
+ for (int i = 0; i < gu_msg.from_progress_marker_size(); ++i) {
+ syncer::ModelType type = GetModelTypeFromSpecificsFieldNumber(
+ gu_msg.from_progress_marker(i).data_type_id());
+ progress_types.Put(type);
+ }
+ EXPECT_TRUE(proto_request_types().Equals(progress_types));
+}
+
+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));
+
+ sync_pb::ClientToServerMessage msg;
+ download::BuildNormalDownloadUpdatesImpl(proto_request_types(),
+ update_handler_map(),
+ nudge_tracker,
+ msg.mutable_get_updates());
+ EXPECT_TRUE(msg.get_updates().is_retry());
+}
+
// Verify that a bogus response message is detected.
TEST_F(DownloadUpdatesTest, InvalidResponse) {
sync_pb::GetUpdatesResponse gu_response;

Powered by Google App Engine
This is Rietveld 408576698