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

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

Issue 891123003: Revert of Sync commit errors should temporarily re-enable trigger pre-commit getupdates (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "sync/sessions/test_util.h" 5 #include "sync/sessions/test_util.h"
6 6
7 namespace syncer { 7 namespace syncer {
8 namespace sessions { 8 namespace sessions {
9 namespace test_util { 9 namespace test_util {
10 10
(...skipping 28 matching lines...) Expand all
39 void SimulateConfigureConnectionFailure( 39 void SimulateConfigureConnectionFailure(
40 ModelTypeSet requsted_types, 40 ModelTypeSet requsted_types,
41 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source, 41 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source,
42 sessions::SyncSession* session) { 42 sessions::SyncSession* session) {
43 session->mutable_status_controller()->set_last_get_key_result(SYNCER_OK); 43 session->mutable_status_controller()->set_last_get_key_result(SYNCER_OK);
44 session->mutable_status_controller()->set_last_download_updates_result( 44 session->mutable_status_controller()->set_last_download_updates_result(
45 NETWORK_CONNECTION_UNAVAILABLE); 45 NETWORK_CONNECTION_UNAVAILABLE);
46 } 46 }
47 47
48 void SimulateNormalSuccess(ModelTypeSet requested_types, 48 void SimulateNormalSuccess(ModelTypeSet requested_types,
49 sessions::NudgeTracker* nudge_tracker, 49 const sessions::NudgeTracker& nudge_tracker,
50 sessions::SyncSession* session) { 50 sessions::SyncSession* session) {
51 session->mutable_status_controller()->set_commit_result(SYNCER_OK); 51 session->mutable_status_controller()->set_commit_result(SYNCER_OK);
52 session->mutable_status_controller()->set_last_download_updates_result( 52 session->mutable_status_controller()->set_last_download_updates_result(
53 SYNCER_OK); 53 SYNCER_OK);
54 } 54 }
55 55
56 void SimulateDownloadUpdatesFailed(ModelTypeSet requested_types, 56 void SimulateDownloadUpdatesFailed(
57 sessions::NudgeTracker* nudge_tracker, 57 ModelTypeSet requested_types,
58 sessions::SyncSession* session) { 58 const sessions::NudgeTracker& nudge_tracker,
59 sessions::SyncSession* session) {
59 session->mutable_status_controller()->set_last_download_updates_result( 60 session->mutable_status_controller()->set_last_download_updates_result(
60 SERVER_RETURN_TRANSIENT_ERROR); 61 SERVER_RETURN_TRANSIENT_ERROR);
61 } 62 }
62 63
63 void SimulateCommitFailed(ModelTypeSet requested_types, 64 void SimulateCommitFailed(ModelTypeSet requested_types,
64 sessions::NudgeTracker* nudge_tracker, 65 const sessions::NudgeTracker& nudge_tracker,
65 sessions::SyncSession* session) { 66 sessions::SyncSession* session) {
66 session->mutable_status_controller()->set_last_get_key_result(SYNCER_OK); 67 session->mutable_status_controller()->set_last_get_key_result(SYNCER_OK);
67 session->mutable_status_controller()->set_last_download_updates_result( 68 session->mutable_status_controller()->set_last_download_updates_result(
68 SYNCER_OK); 69 SYNCER_OK);
69 session->mutable_status_controller()->set_commit_result( 70 session->mutable_status_controller()->set_commit_result(
70 SERVER_RETURN_TRANSIENT_ERROR); 71 SERVER_RETURN_TRANSIENT_ERROR);
71 } 72 }
72 73
73 void SimulateConnectionFailure(ModelTypeSet requested_types, 74 void SimulateConnectionFailure(
74 sessions::NudgeTracker* nudge_tracker, 75 ModelTypeSet requested_types,
75 sessions::SyncSession* session) { 76 const sessions::NudgeTracker& nudge_tracker,
77 sessions::SyncSession* session) {
76 session->mutable_status_controller()->set_last_download_updates_result( 78 session->mutable_status_controller()->set_last_download_updates_result(
77 NETWORK_CONNECTION_UNAVAILABLE); 79 NETWORK_CONNECTION_UNAVAILABLE);
78 } 80 }
79 81
80 void SimulatePollSuccess(ModelTypeSet requested_types, 82 void SimulatePollSuccess(ModelTypeSet requested_types,
81 sessions::SyncSession* session) { 83 sessions::SyncSession* session) {
82 session->mutable_status_controller()->set_last_download_updates_result( 84 session->mutable_status_controller()->set_last_download_updates_result(
83 SYNCER_OK); 85 SYNCER_OK);
84 } 86 }
85 87
(...skipping 23 matching lines...) Expand all
109 void SimulatePollIntervalUpdateImpl( 111 void SimulatePollIntervalUpdateImpl(
110 ModelTypeSet requested_types, 112 ModelTypeSet requested_types,
111 sessions::SyncSession* session, 113 sessions::SyncSession* session,
112 const base::TimeDelta& new_poll) { 114 const base::TimeDelta& new_poll) {
113 SimulatePollSuccess(requested_types, session); 115 SimulatePollSuccess(requested_types, session);
114 session->delegate()->OnReceivedLongPollIntervalUpdate(new_poll); 116 session->delegate()->OnReceivedLongPollIntervalUpdate(new_poll);
115 } 117 }
116 118
117 void SimulateSessionsCommitDelayUpdateImpl( 119 void SimulateSessionsCommitDelayUpdateImpl(
118 ModelTypeSet requested_types, 120 ModelTypeSet requested_types,
119 sessions::NudgeTracker* nudge_tracker, 121 const sessions::NudgeTracker& nudge_tracker,
120 sessions::SyncSession* session, 122 sessions::SyncSession* session,
121 const base::TimeDelta& new_delay) { 123 const base::TimeDelta& new_delay) {
122 SimulateNormalSuccess(requested_types, nudge_tracker, session); 124 SimulateNormalSuccess(requested_types, nudge_tracker, session);
123 std::map<ModelType, base::TimeDelta> delay_map; 125 std::map<ModelType, base::TimeDelta> delay_map;
124 delay_map[SESSIONS] = new_delay; 126 delay_map[SESSIONS] = new_delay;
125 session->delegate()->OnReceivedCustomNudgeDelays(delay_map); 127 session->delegate()->OnReceivedCustomNudgeDelays(delay_map);
126 } 128 }
127 129
128 void SimulateGuRetryDelayCommandImpl(sessions::SyncSession* session, 130 void SimulateGuRetryDelayCommandImpl(sessions::SyncSession* session,
129 base::TimeDelta delay) { 131 base::TimeDelta delay) {
130 session->mutable_status_controller()->set_last_download_updates_result( 132 session->mutable_status_controller()->set_last_download_updates_result(
131 SYNCER_OK); 133 SYNCER_OK);
132 session->delegate()->OnReceivedGuRetryDelay(delay); 134 session->delegate()->OnReceivedGuRetryDelay(delay);
133 } 135 }
134 136
135 } // namespace test_util 137 } // namespace test_util
136 } // namespace sessions 138 } // namespace sessions
137 } // namespace syncer 139 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/sessions/test_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698