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

Side by Side Diff: chrome/browser/sync/profile_sync_service_harness.h

Issue 7655055: [Sync] Make BackendMigrator not wait for full sync cycles (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup Created 9 years, 3 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_HARNESS_H_ 5 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_HARNESS_H_
6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_HARNESS_H_ 6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_HARNESS_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 // Blocks the caller until the datatype manager is configured and sync has 67 // Blocks the caller until the datatype manager is configured and sync has
68 // been initialized (for example, after a browser restart). Returns true if 68 // been initialized (for example, after a browser restart). Returns true if
69 // the wait was successful. 69 // the wait was successful.
70 bool AwaitSyncRestart(); 70 bool AwaitSyncRestart();
71 71
72 // Blocks the caller until this harness has completed a single sync cycle 72 // Blocks the caller until this harness has completed a single sync cycle
73 // since the previous one. Returns true if a sync cycle has completed. 73 // since the previous one. Returns true if a sync cycle has completed.
74 bool AwaitSyncCycleCompletion(const std::string& reason); 74 bool AwaitSyncCycleCompletion(const std::string& reason);
75 75
76 // Blocks the caller until this harness has completed a single sync
77 // cycle, even if we're already synced. Returns true if a sync
78 // cycle has completed.
79 //
80 // TODO(akalin): This is only used by some migration tests, pending
81 // the fix for http://crbug.com/92928. Remove this once that is
82 // fixed.
83 bool AwaitNextSyncCycleCompletion(const std::string& reason);
84
85 // Blocks the caller until the sync has been disabled for this client. Returns 76 // Blocks the caller until the sync has been disabled for this client. Returns
86 // true if sync is disabled. 77 // true if sync is disabled.
87 bool AwaitSyncDisabled(const std::string& reason); 78 bool AwaitSyncDisabled(const std::string& reason);
88 79
89 // Blocks the caller until exponential backoff has been verified to happen. 80 // Blocks the caller until exponential backoff has been verified to happen.
90 bool AwaitExponentialBackoffVerification(); 81 bool AwaitExponentialBackoffVerification();
91 82
83 // Blocks until the given set of data types are migrated.
84 bool AwaitMigration(const syncable::ModelTypeSet& expected_migrated_types);
85
92 // Blocks the caller until this harness has observed that the sync engine 86 // Blocks the caller until this harness has observed that the sync engine
93 // has downloaded all the changes seen by the |partner| harness's client. 87 // has downloaded all the changes seen by the |partner| harness's client.
94 bool WaitUntilTimestampMatches( 88 bool WaitUntilTimestampMatches(
95 ProfileSyncServiceHarness* partner, const std::string& reason); 89 ProfileSyncServiceHarness* partner, const std::string& reason);
96 90
97 // Calling this acts as a barrier and blocks the caller until |this| and 91 // Calling this acts as a barrier and blocks the caller until |this| and
98 // |partner| have both completed a sync cycle. When calling this method, 92 // |partner| have both completed a sync cycle. When calling this method,
99 // the |partner| should be the passive responder who responds to the actions 93 // the |partner| should be the passive responder who responds to the actions
100 // of |this|. This method relies upon the synchronization of callbacks 94 // of |this|. This method relies upon the synchronization of callbacks
101 // from the message queue. Returns true if two sync cycles have completed. 95 // from the message queue. Returns true if two sync cycles have completed.
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 // full sync cycle is not expected to occur. 200 // full sync cycle is not expected to occur.
207 WAITING_FOR_SYNC_CONFIGURATION, 201 WAITING_FOR_SYNC_CONFIGURATION,
208 202
209 // The sync client is waiting for the sync to be disabled for this client. 203 // The sync client is waiting for the sync to be disabled for this client.
210 WAITING_FOR_SYNC_DISABLED, 204 WAITING_FOR_SYNC_DISABLED,
211 205
212 // The sync client is in the exponential backoff mode. Verify that 206 // The sync client is in the exponential backoff mode. Verify that
213 // backoffs are triggered correctly. 207 // backoffs are triggered correctly.
214 WAITING_FOR_EXPONENTIAL_BACKOFF_VERIFICATION, 208 WAITING_FOR_EXPONENTIAL_BACKOFF_VERIFICATION,
215 209
210 // The sync client is waiting for migration to start.
211 WAITING_FOR_MIGRATION_TO_START,
212
213 // The sync client is waiting for migration to finish.
214 WAITING_FOR_MIGRATION_TO_FINISH,
215
216 // The client verification is complete. We don't care about the state of 216 // The client verification is complete. We don't care about the state of
217 // the syncer any more. 217 // the syncer any more.
218 WAITING_FOR_NOTHING, 218 WAITING_FOR_NOTHING,
219 219
220 // The sync client needs a passphrase in order to decrypt data. 220 // The sync client needs a passphrase in order to decrypt data.
221 SET_PASSPHRASE_FAILED, 221 SET_PASSPHRASE_FAILED,
222 222
223 // The sync client cannot reach the server. 223 // The sync client cannot reach the server.
224 SERVER_UNREACHABLE, 224 SERVER_UNREACHABLE,
225 225
226 // The sync client is fully synced and there are no pending updates. 226 // The sync client is fully synced and there are no pending updates.
227 FULLY_SYNCED, 227 FULLY_SYNCED,
228 228
229 // Syncing is disabled for the client. 229 // Syncing is disabled for the client.
230 SYNC_DISABLED, 230 SYNC_DISABLED,
231 231
232 NUMBER_OF_STATES, 232 NUMBER_OF_STATES,
233 }; 233 };
234 234
235 // Called from the observer when the current wait state has been completed. 235 // Called from the observer when the current wait state has been completed.
236 void SignalStateCompleteWithNextState(WaitState next_state); 236 void SignalStateCompleteWithNextState(WaitState next_state);
237 237
238 // Indicates that the operation being waited on is complete. 238 // Indicates that the operation being waited on is complete.
239 void SignalStateComplete(); 239 void SignalStateComplete();
240 240
241 // Updates the migration state we're interested in.
242 void UpdateMigrationState();
243
241 // Finite state machine for controlling state. Returns true only if a state 244 // Finite state machine for controlling state. Returns true only if a state
242 // change has taken place. 245 // change has taken place.
243 bool RunStateChangeMachine(); 246 bool RunStateChangeMachine();
244 247
245 // Returns true if a status change took place, false on timeout. 248 // Returns true if a status change took place, false on timeout.
246 bool AwaitStatusChangeWithTimeout(int timeout_milliseconds, 249 bool AwaitStatusChangeWithTimeout(int timeout_milliseconds,
247 const std::string& reason); 250 const std::string& reason);
248 251
249 // Used by AwaitSyncCycleCompletion() and
250 // AwaitNextSyncCycleCompletion().
251 bool AwaitSyncCycleCompletionHelper(const std::string& reason);
252
253 // Returns true if the sync client has no unsynced items. 252 // Returns true if the sync client has no unsynced items.
254 bool IsSynced(); 253 bool IsSynced();
255 254
256 // Returns true if this client has downloaded all the items that the 255 // Returns true if this client has downloaded all the items that the
257 // other client has. 256 // other client has.
258 bool MatchesOtherClient(ProfileSyncServiceHarness* partner); 257 bool MatchesOtherClient(ProfileSyncServiceHarness* partner);
259 258
260 // Returns a string with relevant info about client's sync state (if 259 // Returns a string with relevant info about client's sync state (if
261 // available), annotated with |message|. Useful for logging. 260 // available), annotated with |message|. Useful for logging.
262 std::string GetClientInfoString(const std::string& message); 261 std::string GetClientInfoString(const std::string& message);
(...skipping 20 matching lines...) Expand all
283 ProfileSyncService* service_; 282 ProfileSyncService* service_;
284 283
285 // The harness of the client whose update progress marker we're expecting 284 // The harness of the client whose update progress marker we're expecting
286 // eventually match. 285 // eventually match.
287 ProfileSyncServiceHarness* timestamp_match_partner_; 286 ProfileSyncServiceHarness* timestamp_match_partner_;
288 287
289 // Credentials used for GAIA authentication. 288 // Credentials used for GAIA authentication.
290 std::string username_; 289 std::string username_;
291 std::string password_; 290 std::string password_;
292 291
292 // The current set of data types pending migration. Used by
293 // AwaitMigration().
294 syncable::ModelTypeSet pending_migration_types_;
295
296 // The set of data types that have undergone migration. Used by
297 // AwaitMigration().
298 syncable::ModelTypeSet migrated_types_;
299
293 // Used for logging. 300 // Used for logging.
294 const std::string profile_debug_name_; 301 const std::string profile_debug_name_;
295 302
296 // Keeps track of the number of attempts at exponential backoff and its 303 // Keeps track of the number of attempts at exponential backoff and its
297 // related bookkeeping information for verification. 304 // related bookkeeping information for verification.
298 browser_sync::RetryVerifier retry_verifier_; 305 browser_sync::RetryVerifier retry_verifier_;
299 306
300 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceHarness); 307 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceHarness);
301 }; 308 };
302 309
303 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_HARNESS_H_ 310 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_HARNESS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698