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

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

Issue 905853002: 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 const sessions::NudgeTracker& nudge_tracker, 49 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( 56 void SimulateDownloadUpdatesFailed(ModelTypeSet requested_types,
57 ModelTypeSet requested_types, 57 sessions::NudgeTracker* nudge_tracker,
58 const sessions::NudgeTracker& nudge_tracker, 58 sessions::SyncSession* session) {
59 sessions::SyncSession* session) {
60 session->mutable_status_controller()->set_last_download_updates_result( 59 session->mutable_status_controller()->set_last_download_updates_result(
61 SERVER_RETURN_TRANSIENT_ERROR); 60 SERVER_RETURN_TRANSIENT_ERROR);
62 } 61 }
63 62
64 void SimulateCommitFailed(ModelTypeSet requested_types, 63 void SimulateCommitFailed(ModelTypeSet requested_types,
65 const sessions::NudgeTracker& nudge_tracker, 64 sessions::NudgeTracker* nudge_tracker,
66 sessions::SyncSession* session) { 65 sessions::SyncSession* session) {
67 session->mutable_status_controller()->set_last_get_key_result(SYNCER_OK); 66 session->mutable_status_controller()->set_last_get_key_result(SYNCER_OK);
68 session->mutable_status_controller()->set_last_download_updates_result( 67 session->mutable_status_controller()->set_last_download_updates_result(
69 SYNCER_OK); 68 SYNCER_OK);
70 session->mutable_status_controller()->set_commit_result( 69 session->mutable_status_controller()->set_commit_result(
71 SERVER_RETURN_TRANSIENT_ERROR); 70 SERVER_RETURN_TRANSIENT_ERROR);
72 } 71 }
73 72
74 void SimulateConnectionFailure( 73 void SimulateConnectionFailure(ModelTypeSet requested_types,
75 ModelTypeSet requested_types, 74 sessions::NudgeTracker* nudge_tracker,
76 const sessions::NudgeTracker& nudge_tracker, 75 sessions::SyncSession* session) {
77 sessions::SyncSession* session) {
78 session->mutable_status_controller()->set_last_download_updates_result( 76 session->mutable_status_controller()->set_last_download_updates_result(
79 NETWORK_CONNECTION_UNAVAILABLE); 77 NETWORK_CONNECTION_UNAVAILABLE);
80 } 78 }
81 79
82 void SimulatePollSuccess(ModelTypeSet requested_types, 80 void SimulatePollSuccess(ModelTypeSet requested_types,
83 sessions::SyncSession* session) { 81 sessions::SyncSession* session) {
84 session->mutable_status_controller()->set_last_download_updates_result( 82 session->mutable_status_controller()->set_last_download_updates_result(
85 SYNCER_OK); 83 SYNCER_OK);
86 } 84 }
87 85
(...skipping 23 matching lines...) Expand all
111 void SimulatePollIntervalUpdateImpl( 109 void SimulatePollIntervalUpdateImpl(
112 ModelTypeSet requested_types, 110 ModelTypeSet requested_types,
113 sessions::SyncSession* session, 111 sessions::SyncSession* session,
114 const base::TimeDelta& new_poll) { 112 const base::TimeDelta& new_poll) {
115 SimulatePollSuccess(requested_types, session); 113 SimulatePollSuccess(requested_types, session);
116 session->delegate()->OnReceivedLongPollIntervalUpdate(new_poll); 114 session->delegate()->OnReceivedLongPollIntervalUpdate(new_poll);
117 } 115 }
118 116
119 void SimulateSessionsCommitDelayUpdateImpl( 117 void SimulateSessionsCommitDelayUpdateImpl(
120 ModelTypeSet requested_types, 118 ModelTypeSet requested_types,
121 const sessions::NudgeTracker& nudge_tracker, 119 sessions::NudgeTracker* nudge_tracker,
122 sessions::SyncSession* session, 120 sessions::SyncSession* session,
123 const base::TimeDelta& new_delay) { 121 const base::TimeDelta& new_delay) {
124 SimulateNormalSuccess(requested_types, nudge_tracker, session); 122 SimulateNormalSuccess(requested_types, nudge_tracker, session);
125 std::map<ModelType, base::TimeDelta> delay_map; 123 std::map<ModelType, base::TimeDelta> delay_map;
126 delay_map[SESSIONS] = new_delay; 124 delay_map[SESSIONS] = new_delay;
127 session->delegate()->OnReceivedCustomNudgeDelays(delay_map); 125 session->delegate()->OnReceivedCustomNudgeDelays(delay_map);
128 } 126 }
129 127
130 void SimulateGuRetryDelayCommandImpl(sessions::SyncSession* session, 128 void SimulateGuRetryDelayCommandImpl(sessions::SyncSession* session,
131 base::TimeDelta delay) { 129 base::TimeDelta delay) {
132 session->mutable_status_controller()->set_last_download_updates_result( 130 session->mutable_status_controller()->set_last_download_updates_result(
133 SYNCER_OK); 131 SYNCER_OK);
134 session->delegate()->OnReceivedGuRetryDelay(delay); 132 session->delegate()->OnReceivedGuRetryDelay(delay);
135 } 133 }
136 134
137 } // namespace test_util 135 } // namespace test_util
138 } // namespace sessions 136 } // namespace sessions
139 } // namespace syncer 137 } // 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