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

Side by Side Diff: components/sync/engine_impl/cycle/test_util.cc

Issue 2475043002: [Sync] Sync client should to exponential backoff when receive partial failure (Closed)
Patch Set: rebase Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/sync/engine_impl/cycle/test_util.h" 5 #include "components/sync/engine_impl/cycle/test_util.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 namespace syncer { 9 namespace syncer {
10 namespace test_util { 10 namespace test_util {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 90
91 void SimulateThrottledImpl(SyncCycle* cycle, const base::TimeDelta& delta) { 91 void SimulateThrottledImpl(SyncCycle* cycle, const base::TimeDelta& delta) {
92 cycle->mutable_status_controller()->set_last_download_updates_result( 92 cycle->mutable_status_controller()->set_last_download_updates_result(
93 SERVER_RETURN_THROTTLED); 93 SERVER_RETURN_THROTTLED);
94 cycle->delegate()->OnThrottled(delta); 94 cycle->delegate()->OnThrottled(delta);
95 } 95 }
96 96
97 void SimulateTypesThrottledImpl(SyncCycle* cycle, 97 void SimulateTypesThrottledImpl(SyncCycle* cycle,
98 ModelTypeSet types, 98 ModelTypeSet types,
99 const base::TimeDelta& delta) { 99 const base::TimeDelta& delta) {
100 cycle->mutable_status_controller()->set_last_download_updates_result( 100 cycle->mutable_status_controller()->set_commit_result(SYNCER_OK);
101 SERVER_RETURN_THROTTLED);
102 cycle->delegate()->OnTypesThrottled(types, delta); 101 cycle->delegate()->OnTypesThrottled(types, delta);
103 } 102 }
104 103
104 void SimulatePartialFailureImpl(SyncCycle* cycle, ModelTypeSet types) {
105 cycle->mutable_status_controller()->set_commit_result(SYNCER_OK);
106 cycle->delegate()->OnTypesBackedOff(types);
107 }
108
105 void SimulatePollIntervalUpdateImpl(ModelTypeSet requested_types, 109 void SimulatePollIntervalUpdateImpl(ModelTypeSet requested_types,
106 SyncCycle* cycle, 110 SyncCycle* cycle,
107 const base::TimeDelta& new_poll) { 111 const base::TimeDelta& new_poll) {
108 SimulatePollSuccess(requested_types, cycle); 112 SimulatePollSuccess(requested_types, cycle);
109 cycle->delegate()->OnReceivedLongPollIntervalUpdate(new_poll); 113 cycle->delegate()->OnReceivedLongPollIntervalUpdate(new_poll);
110 } 114 }
111 115
112 void SimulateSessionsCommitDelayUpdateImpl(ModelTypeSet requested_types, 116 void SimulateSessionsCommitDelayUpdateImpl(ModelTypeSet requested_types,
113 NudgeTracker* nudge_tracker, 117 NudgeTracker* nudge_tracker,
114 SyncCycle* cycle, 118 SyncCycle* cycle,
115 const base::TimeDelta& new_delay) { 119 const base::TimeDelta& new_delay) {
116 SimulateNormalSuccess(requested_types, nudge_tracker, cycle); 120 SimulateNormalSuccess(requested_types, nudge_tracker, cycle);
117 std::map<ModelType, base::TimeDelta> delay_map; 121 std::map<ModelType, base::TimeDelta> delay_map;
118 delay_map[SESSIONS] = new_delay; 122 delay_map[SESSIONS] = new_delay;
119 cycle->delegate()->OnReceivedCustomNudgeDelays(delay_map); 123 cycle->delegate()->OnReceivedCustomNudgeDelays(delay_map);
120 } 124 }
121 125
122 void SimulateGuRetryDelayCommandImpl(SyncCycle* cycle, base::TimeDelta delay) { 126 void SimulateGuRetryDelayCommandImpl(SyncCycle* cycle, base::TimeDelta delay) {
123 cycle->mutable_status_controller()->set_last_download_updates_result( 127 cycle->mutable_status_controller()->set_last_download_updates_result(
124 SYNCER_OK); 128 SYNCER_OK);
125 cycle->delegate()->OnReceivedGuRetryDelay(delay); 129 cycle->delegate()->OnReceivedGuRetryDelay(delay);
126 } 130 }
127 131
128 } // namespace test_util 132 } // namespace test_util
129 } // namespace syncer 133 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/engine_impl/cycle/test_util.h ('k') | components/sync/engine_impl/get_updates_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698