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

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

Issue 171813013: sync: Merge GU retry logic into normal GU (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 9 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 | Annotate | Revision Log
« 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 } 74 }
75 75
76 void SimulateConnectionFailure( 76 void SimulateConnectionFailure(
77 ModelTypeSet requested_types, 77 ModelTypeSet requested_types,
78 const sessions::NudgeTracker& nudge_tracker, 78 const sessions::NudgeTracker& nudge_tracker,
79 sessions::SyncSession* session) { 79 sessions::SyncSession* session) {
80 session->mutable_status_controller()->set_last_download_updates_result( 80 session->mutable_status_controller()->set_last_download_updates_result(
81 NETWORK_CONNECTION_UNAVAILABLE); 81 NETWORK_CONNECTION_UNAVAILABLE);
82 } 82 }
83 83
84 void SimulatePollRetrySuccess(ModelTypeSet requested_types, 84 void SimulatePollSuccess(ModelTypeSet requested_types,
85 sessions::SyncSession* session) { 85 sessions::SyncSession* session) {
86 ASSERT_EQ(0U, session->status_controller().num_server_changes_remaining()); 86 ASSERT_EQ(0U, session->status_controller().num_server_changes_remaining());
87 session->mutable_status_controller()->set_last_download_updates_result( 87 session->mutable_status_controller()->set_last_download_updates_result(
88 SYNCER_OK); 88 SYNCER_OK);
89 } 89 }
90 90
91 void SimulatePollRetryFailed(ModelTypeSet requested_types, 91 void SimulatePollFailed(ModelTypeSet requested_types,
92 sessions::SyncSession* session) { 92 sessions::SyncSession* session) {
93 ASSERT_EQ(0U, session->status_controller().num_server_changes_remaining()); 93 ASSERT_EQ(0U, session->status_controller().num_server_changes_remaining());
94 session->mutable_status_controller()->set_last_download_updates_result( 94 session->mutable_status_controller()->set_last_download_updates_result(
95 SERVER_RETURN_TRANSIENT_ERROR); 95 SERVER_RETURN_TRANSIENT_ERROR);
96 } 96 }
97 97
98 void SimulateThrottledImpl( 98 void SimulateThrottledImpl(
99 sessions::SyncSession* session, 99 sessions::SyncSession* session,
100 const base::TimeDelta& delta) { 100 const base::TimeDelta& delta) {
101 session->mutable_status_controller()->set_last_download_updates_result( 101 session->mutable_status_controller()->set_last_download_updates_result(
102 SERVER_RETURN_THROTTLED); 102 SERVER_RETURN_THROTTLED);
103 session->delegate()->OnThrottled(delta); 103 session->delegate()->OnThrottled(delta);
104 } 104 }
105 105
106 void SimulateTypesThrottledImpl( 106 void SimulateTypesThrottledImpl(
107 sessions::SyncSession* session, 107 sessions::SyncSession* session,
108 ModelTypeSet types, 108 ModelTypeSet types,
109 const base::TimeDelta& delta) { 109 const base::TimeDelta& delta) {
110 session->mutable_status_controller()->set_last_download_updates_result( 110 session->mutable_status_controller()->set_last_download_updates_result(
111 SERVER_RETURN_THROTTLED); 111 SERVER_RETURN_THROTTLED);
112 session->delegate()->OnTypesThrottled(types, delta); 112 session->delegate()->OnTypesThrottled(types, delta);
113 } 113 }
114 114
115 void SimulatePollIntervalUpdateImpl( 115 void SimulatePollIntervalUpdateImpl(
116 ModelTypeSet requested_types, 116 ModelTypeSet requested_types,
117 sessions::SyncSession* session, 117 sessions::SyncSession* session,
118 const base::TimeDelta& new_poll) { 118 const base::TimeDelta& new_poll) {
119 SimulatePollRetrySuccess(requested_types, session); 119 SimulatePollSuccess(requested_types, session);
120 session->delegate()->OnReceivedLongPollIntervalUpdate(new_poll); 120 session->delegate()->OnReceivedLongPollIntervalUpdate(new_poll);
121 } 121 }
122 122
123 void SimulateSessionsCommitDelayUpdateImpl( 123 void SimulateSessionsCommitDelayUpdateImpl(
124 ModelTypeSet requested_types, 124 ModelTypeSet requested_types,
125 const sessions::NudgeTracker& nudge_tracker, 125 const sessions::NudgeTracker& nudge_tracker,
126 sessions::SyncSession* session, 126 sessions::SyncSession* session,
127 const base::TimeDelta& new_delay) { 127 const base::TimeDelta& new_delay) {
128 SimulateNormalSuccess(requested_types, nudge_tracker, session); 128 SimulateNormalSuccess(requested_types, nudge_tracker, session);
129 session->delegate()->OnReceivedSessionsCommitDelay(new_delay); 129 session->delegate()->OnReceivedSessionsCommitDelay(new_delay);
130 } 130 }
131 131
132 void SimulateGuRetryDelayCommandImpl(sessions::SyncSession* session, 132 void SimulateGuRetryDelayCommandImpl(sessions::SyncSession* session,
133 base::TimeDelta delay) { 133 base::TimeDelta delay) {
134 session->mutable_status_controller()->set_last_download_updates_result( 134 session->mutable_status_controller()->set_last_download_updates_result(
135 SYNCER_OK); 135 SYNCER_OK);
136 session->delegate()->OnReceivedGuRetryDelay(delay); 136 session->delegate()->OnReceivedGuRetryDelay(delay);
137 } 137 }
138 138
139 } // namespace test_util 139 } // namespace test_util
140 } // namespace sessions 140 } // namespace sessions
141 } // namespace syncer 141 } // 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