fling: Remove a bunch of code for configuring fling curves.
[chromium-blink-merge.git] / sync / sessions / test_util.cc
blob1163ea7fcb0316bff7476a1b292507a1f621b4d5
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
3 // found in the LICENSE file.
5 #include "sync/sessions/test_util.h"
7 namespace syncer {
8 namespace sessions {
9 namespace test_util {
11 void SimulateGetEncryptionKeyFailed(
12 ModelTypeSet requsted_types,
13 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source,
14 sessions::SyncSession* session) {
15 session->mutable_status_controller()->set_last_get_key_result(
16 SERVER_RESPONSE_VALIDATION_FAILED);
17 session->mutable_status_controller()->set_last_download_updates_result(
18 SYNCER_OK);
21 void SimulateConfigureSuccess(
22 ModelTypeSet requsted_types,
23 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source,
24 sessions::SyncSession* session) {
25 session->mutable_status_controller()->set_last_get_key_result(SYNCER_OK);
26 session->mutable_status_controller()->set_last_download_updates_result(
27 SYNCER_OK);
30 void SimulateConfigureFailed(
31 ModelTypeSet requsted_types,
32 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source,
33 sessions::SyncSession* session) {
34 session->mutable_status_controller()->set_last_get_key_result(SYNCER_OK);
35 session->mutable_status_controller()->set_last_download_updates_result(
36 SERVER_RETURN_TRANSIENT_ERROR);
39 void SimulateConfigureConnectionFailure(
40 ModelTypeSet requsted_types,
41 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source,
42 sessions::SyncSession* session) {
43 session->mutable_status_controller()->set_last_get_key_result(SYNCER_OK);
44 session->mutable_status_controller()->set_last_download_updates_result(
45 NETWORK_CONNECTION_UNAVAILABLE);
48 void SimulateNormalSuccess(ModelTypeSet requested_types,
49 const sessions::NudgeTracker& nudge_tracker,
50 sessions::SyncSession* session) {
51 session->mutable_status_controller()->set_commit_result(SYNCER_OK);
52 session->mutable_status_controller()->set_last_download_updates_result(
53 SYNCER_OK);
56 void SimulateDownloadUpdatesFailed(
57 ModelTypeSet requested_types,
58 const sessions::NudgeTracker& nudge_tracker,
59 sessions::SyncSession* session) {
60 session->mutable_status_controller()->set_last_download_updates_result(
61 SERVER_RETURN_TRANSIENT_ERROR);
64 void SimulateCommitFailed(ModelTypeSet requested_types,
65 const sessions::NudgeTracker& nudge_tracker,
66 sessions::SyncSession* session) {
67 session->mutable_status_controller()->set_last_get_key_result(SYNCER_OK);
68 session->mutable_status_controller()->set_last_download_updates_result(
69 SYNCER_OK);
70 session->mutable_status_controller()->set_commit_result(
71 SERVER_RETURN_TRANSIENT_ERROR);
74 void SimulateConnectionFailure(
75 ModelTypeSet requested_types,
76 const sessions::NudgeTracker& nudge_tracker,
77 sessions::SyncSession* session) {
78 session->mutable_status_controller()->set_last_download_updates_result(
79 NETWORK_CONNECTION_UNAVAILABLE);
82 void SimulatePollSuccess(ModelTypeSet requested_types,
83 sessions::SyncSession* session) {
84 session->mutable_status_controller()->set_last_download_updates_result(
85 SYNCER_OK);
88 void SimulatePollFailed(ModelTypeSet requested_types,
89 sessions::SyncSession* session) {
90 session->mutable_status_controller()->set_last_download_updates_result(
91 SERVER_RETURN_TRANSIENT_ERROR);
94 void SimulateThrottledImpl(
95 sessions::SyncSession* session,
96 const base::TimeDelta& delta) {
97 session->mutable_status_controller()->set_last_download_updates_result(
98 SERVER_RETURN_THROTTLED);
99 session->delegate()->OnThrottled(delta);
102 void SimulateTypesThrottledImpl(
103 sessions::SyncSession* session,
104 ModelTypeSet types,
105 const base::TimeDelta& delta) {
106 session->mutable_status_controller()->set_last_download_updates_result(
107 SERVER_RETURN_THROTTLED);
108 session->delegate()->OnTypesThrottled(types, delta);
111 void SimulatePollIntervalUpdateImpl(
112 ModelTypeSet requested_types,
113 sessions::SyncSession* session,
114 const base::TimeDelta& new_poll) {
115 SimulatePollSuccess(requested_types, session);
116 session->delegate()->OnReceivedLongPollIntervalUpdate(new_poll);
119 void SimulateSessionsCommitDelayUpdateImpl(
120 ModelTypeSet requested_types,
121 const sessions::NudgeTracker& nudge_tracker,
122 sessions::SyncSession* session,
123 const base::TimeDelta& new_delay) {
124 SimulateNormalSuccess(requested_types, nudge_tracker, session);
125 std::map<ModelType, base::TimeDelta> delay_map;
126 delay_map[SESSIONS] = new_delay;
127 session->delegate()->OnReceivedCustomNudgeDelays(delay_map);
130 void SimulateGuRetryDelayCommandImpl(sessions::SyncSession* session,
131 base::TimeDelta delay) {
132 session->mutable_status_controller()->set_last_download_updates_result(
133 SYNCER_OK);
134 session->delegate()->OnReceivedGuRetryDelay(delay);
137 } // namespace test_util
138 } // namespace sessions
139 } // namespace syncer