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

Side by Side Diff: sync/sessions/test_util.cc

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « sync/sessions/test_util.h ('k') | sync/sync.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #include "sync/sessions/test_util.h"
6
7 #include <map>
8
9 namespace syncer {
10 namespace sessions {
11 namespace test_util {
12
13 void SimulateGetEncryptionKeyFailed(
14 ModelTypeSet requsted_types,
15 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source,
16 sessions::SyncSession* session) {
17 session->mutable_status_controller()->set_last_get_key_result(
18 SERVER_RESPONSE_VALIDATION_FAILED);
19 session->mutable_status_controller()->set_last_download_updates_result(
20 SYNCER_OK);
21 }
22
23 void SimulateConfigureSuccess(
24 ModelTypeSet requsted_types,
25 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source,
26 sessions::SyncSession* session) {
27 session->mutable_status_controller()->set_last_get_key_result(SYNCER_OK);
28 session->mutable_status_controller()->set_last_download_updates_result(
29 SYNCER_OK);
30 }
31
32 void SimulateConfigureFailed(
33 ModelTypeSet requsted_types,
34 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source,
35 sessions::SyncSession* session) {
36 session->mutable_status_controller()->set_last_get_key_result(SYNCER_OK);
37 session->mutable_status_controller()->set_last_download_updates_result(
38 SERVER_RETURN_TRANSIENT_ERROR);
39 }
40
41 void SimulateConfigureConnectionFailure(
42 ModelTypeSet requsted_types,
43 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source,
44 sessions::SyncSession* session) {
45 session->mutable_status_controller()->set_last_get_key_result(SYNCER_OK);
46 session->mutable_status_controller()->set_last_download_updates_result(
47 NETWORK_CONNECTION_UNAVAILABLE);
48 }
49
50 void SimulateNormalSuccess(ModelTypeSet requested_types,
51 sessions::NudgeTracker* nudge_tracker,
52 sessions::SyncSession* session) {
53 session->mutable_status_controller()->set_commit_result(SYNCER_OK);
54 session->mutable_status_controller()->set_last_download_updates_result(
55 SYNCER_OK);
56 }
57
58 void SimulateDownloadUpdatesFailed(ModelTypeSet requested_types,
59 sessions::NudgeTracker* nudge_tracker,
60 sessions::SyncSession* session) {
61 session->mutable_status_controller()->set_last_download_updates_result(
62 SERVER_RETURN_TRANSIENT_ERROR);
63 }
64
65 void SimulateCommitFailed(ModelTypeSet requested_types,
66 sessions::NudgeTracker* nudge_tracker,
67 sessions::SyncSession* session) {
68 session->mutable_status_controller()->set_last_get_key_result(SYNCER_OK);
69 session->mutable_status_controller()->set_last_download_updates_result(
70 SYNCER_OK);
71 session->mutable_status_controller()->set_commit_result(
72 SERVER_RETURN_TRANSIENT_ERROR);
73 }
74
75 void SimulateConnectionFailure(ModelTypeSet requested_types,
76 sessions::NudgeTracker* nudge_tracker,
77 sessions::SyncSession* session) {
78 session->mutable_status_controller()->set_last_download_updates_result(
79 NETWORK_CONNECTION_UNAVAILABLE);
80 }
81
82 void SimulatePollSuccess(ModelTypeSet requested_types,
83 sessions::SyncSession* session) {
84 session->mutable_status_controller()->set_last_download_updates_result(
85 SYNCER_OK);
86 }
87
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);
92 }
93
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);
100 }
101
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);
109 }
110
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);
117 }
118
119 void SimulateSessionsCommitDelayUpdateImpl(
120 ModelTypeSet requested_types,
121 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);
128 }
129
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);
135 }
136
137 } // namespace test_util
138 } // namespace sessions
139 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/sessions/test_util.h ('k') | sync/sync.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698