| OLD | NEW |
| 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 Loading... |
| 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( |
| 101 SERVER_RETURN_THROTTLED); | 101 SERVER_RETURN_PARTIAL_FAILURE); |
| 102 cycle->delegate()->OnTypesThrottled(types, delta); | 102 cycle->delegate()->OnTypesThrottled(types, delta); |
| 103 } | 103 } |
| 104 | 104 |
| 105 void SimulatePartialFailureImpl(SyncCycle* cycle, ModelTypeSet types) { |
| 106 cycle->mutable_status_controller()->set_commit_result( |
| 107 SERVER_RETURN_PARTIAL_FAILURE); |
| 108 cycle->delegate()->OnTypesBackedOff(types); |
| 109 } |
| 110 |
| 105 void SimulatePollIntervalUpdateImpl(ModelTypeSet requested_types, | 111 void SimulatePollIntervalUpdateImpl(ModelTypeSet requested_types, |
| 106 SyncCycle* cycle, | 112 SyncCycle* cycle, |
| 107 const base::TimeDelta& new_poll) { | 113 const base::TimeDelta& new_poll) { |
| 108 SimulatePollSuccess(requested_types, cycle); | 114 SimulatePollSuccess(requested_types, cycle); |
| 109 cycle->delegate()->OnReceivedLongPollIntervalUpdate(new_poll); | 115 cycle->delegate()->OnReceivedLongPollIntervalUpdate(new_poll); |
| 110 } | 116 } |
| 111 | 117 |
| 112 void SimulateSessionsCommitDelayUpdateImpl(ModelTypeSet requested_types, | 118 void SimulateSessionsCommitDelayUpdateImpl(ModelTypeSet requested_types, |
| 113 NudgeTracker* nudge_tracker, | 119 NudgeTracker* nudge_tracker, |
| 114 SyncCycle* cycle, | 120 SyncCycle* cycle, |
| 115 const base::TimeDelta& new_delay) { | 121 const base::TimeDelta& new_delay) { |
| 116 SimulateNormalSuccess(requested_types, nudge_tracker, cycle); | 122 SimulateNormalSuccess(requested_types, nudge_tracker, cycle); |
| 117 std::map<ModelType, base::TimeDelta> delay_map; | 123 std::map<ModelType, base::TimeDelta> delay_map; |
| 118 delay_map[SESSIONS] = new_delay; | 124 delay_map[SESSIONS] = new_delay; |
| 119 cycle->delegate()->OnReceivedCustomNudgeDelays(delay_map); | 125 cycle->delegate()->OnReceivedCustomNudgeDelays(delay_map); |
| 120 } | 126 } |
| 121 | 127 |
| 122 void SimulateGuRetryDelayCommandImpl(SyncCycle* cycle, base::TimeDelta delay) { | 128 void SimulateGuRetryDelayCommandImpl(SyncCycle* cycle, base::TimeDelta delay) { |
| 123 cycle->mutable_status_controller()->set_last_download_updates_result( | 129 cycle->mutable_status_controller()->set_last_download_updates_result( |
| 124 SYNCER_OK); | 130 SYNCER_OK); |
| 125 cycle->delegate()->OnReceivedGuRetryDelay(delay); | 131 cycle->delegate()->OnReceivedGuRetryDelay(delay); |
| 126 } | 132 } |
| 127 | 133 |
| 128 } // namespace test_util | 134 } // namespace test_util |
| 129 } // namespace syncer | 135 } // namespace syncer |
| OLD | NEW |