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

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

Issue 7861013: Fix the false-positive detection of commit errors (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Another attempt at detecting errors Created 9 years, 2 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 // Blocks the caller until the sync backend host associated with this harness 70 // Blocks the caller until the sync backend host associated with this harness
71 // has been initialized. Returns true if the wait was successful. 71 // has been initialized. Returns true if the wait was successful.
72 bool AwaitBackendInitialized(); 72 bool AwaitBackendInitialized();
73 73
74 // Blocks the caller until the datatype manager is configured and sync has 74 // Blocks the caller until the datatype manager is configured and sync has
75 // been initialized (for example, after a browser restart). Returns true if 75 // been initialized (for example, after a browser restart). Returns true if
76 // the wait was successful. 76 // the wait was successful.
77 bool AwaitSyncRestart(); 77 bool AwaitSyncRestart();
78 78
79 // Blocks the caller until this harness has completed a single sync cycle 79 // Block the caller until this harness has completed a single sync cycle
80 // since the previous one. Returns true if a sync cycle has completed. 80 // since the previous one. Returns true if a sync cycle has completed.
81 bool AwaitSyncCycleCompletion(const std::string& reason); 81 bool AwaitDataSyncCompletion(const std::string& reason);
82
83 // Blocks the caller until this harness has completed as many sync cycles as
84 // are required to ensure its progress marker matches the latest available on
85 // the server.
86 //
87 // Note: When other clients are committing changes this will not be reliable.
88 // Use one of the sync cycle functions to handle those cases.
89 bool AwaitFullSyncCompletion(const std::string& reason);
82 90
83 // Blocks the caller until sync has been disabled for this client. Returns 91 // Blocks the caller until sync has been disabled for this client. Returns
84 // true if sync is disabled. 92 // true if sync is disabled.
85 bool AwaitSyncDisabled(const std::string& reason); 93 bool AwaitSyncDisabled(const std::string& reason);
86 94
87 // Blocks the caller until exponential backoff has been verified to happen. 95 // Blocks the caller until exponential backoff has been verified to happen.
88 bool AwaitExponentialBackoffVerification(); 96 bool AwaitExponentialBackoffVerification();
89 97
90 // Blocks the caller until the syncer receives an actionable error. 98 // Blocks the caller until the syncer receives an actionable error.
91 // Returns true if the sync client received an actionable error. 99 // Returns true if the sync client received an actionable error.
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 enum WaitState { 190 enum WaitState {
183 // The sync client has just been initialized. 191 // The sync client has just been initialized.
184 INITIAL_WAIT_STATE = 0, 192 INITIAL_WAIT_STATE = 0,
185 193
186 // The sync client awaits the OnBackendInitialized() callback. 194 // The sync client awaits the OnBackendInitialized() callback.
187 WAITING_FOR_ON_BACKEND_INITIALIZED, 195 WAITING_FOR_ON_BACKEND_INITIALIZED,
188 196
189 // The sync client is waiting for the first sync cycle to complete. 197 // The sync client is waiting for the first sync cycle to complete.
190 WAITING_FOR_INITIAL_SYNC, 198 WAITING_FOR_INITIAL_SYNC,
191 199
192 // The sync client is waiting for an ongoing sync cycle to complete. 200 // The sync client is waiting for data to be synced.
193 WAITING_FOR_SYNC_TO_FINISH, 201 WAITING_FOR_DATA_SYNC,
202
203 // The sync client is waiting for data and progress markers to be synced.
204 WAITING_FOR_FULL_SYNC,
194 205
195 // The sync client anticipates incoming updates leading to a new sync cycle. 206 // The sync client anticipates incoming updates leading to a new sync cycle.
196 WAITING_FOR_UPDATES, 207 WAITING_FOR_UPDATES,
197 208
198 // The sync client is waiting for a passphrase to be required by the 209 // The sync client is waiting for a passphrase to be required by the
199 // cryptographer. 210 // cryptographer.
200 WAITING_FOR_PASSPHRASE_REQUIRED, 211 WAITING_FOR_PASSPHRASE_REQUIRED,
201 212
202 // The sync client is waiting for its passphrase to be accepted by the 213 // The sync client is waiting for its passphrase to be accepted by the
203 // cryptographer. 214 // cryptographer.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 void SignalStateComplete(); 269 void SignalStateComplete();
259 270
260 // Finite state machine for controlling state. Returns true only if a state 271 // Finite state machine for controlling state. Returns true only if a state
261 // change has taken place. 272 // change has taken place.
262 bool RunStateChangeMachine(); 273 bool RunStateChangeMachine();
263 274
264 // Returns true if a status change took place, false on timeout. 275 // Returns true if a status change took place, false on timeout.
265 bool AwaitStatusChangeWithTimeout(int timeout_milliseconds, 276 bool AwaitStatusChangeWithTimeout(int timeout_milliseconds,
266 const std::string& reason); 277 const std::string& reason);
267 278
279 // A helper for implementing IsDataSynced() and IsFullySynced()
280 bool IsDataSyncedImpl(const browser_sync::sessions::SyncSessionSnapshot*);
281
268 // Returns true if the sync client has no unsynced items. 282 // Returns true if the sync client has no unsynced items.
269 bool IsSynced(); 283 bool IsDataSynced();
284
285 // Returns true if the sync client has no unsynced items and its progress
286 // markers are believed to be up to date.
287 //
288 // Although we can't detect when commits from other clients invalidate our
289 // local progress markers, we do know when our own commits have invalidated
290 // our timestmaps. This check returns true when this client has, to the best
291 // of its knowledge, downloaded the latest progress markers.
292 bool IsFullySynced();
270 293
271 // Returns true if there is a backend migration in progress. 294 // Returns true if there is a backend migration in progress.
272 bool HasPendingBackendMigration(); 295 bool HasPendingBackendMigration();
273 296
274 // Returns true if this client has downloaded all the items that the 297 // Returns true if this client has downloaded all the items that the
275 // other client has. 298 // other client has.
276 bool MatchesOtherClient(ProfileSyncServiceHarness* partner); 299 bool MatchesOtherClient(ProfileSyncServiceHarness* partner);
277 300
278 // Returns a string with relevant info about client's sync state (if 301 // Returns a string with relevant info about client's sync state (if
279 // available), annotated with |message|. Useful for logging. 302 // available), annotated with |message|. Useful for logging.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 const std::string profile_debug_name_; 343 const std::string profile_debug_name_;
321 344
322 // Keeps track of the number of attempts at exponential backoff and its 345 // Keeps track of the number of attempts at exponential backoff and its
323 // related bookkeeping information for verification. 346 // related bookkeeping information for verification.
324 browser_sync::RetryVerifier retry_verifier_; 347 browser_sync::RetryVerifier retry_verifier_;
325 348
326 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceHarness); 349 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceHarness);
327 }; 350 };
328 351
329 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_HARNESS_H_ 352 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_HARNESS_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service.cc ('k') | chrome/browser/sync/profile_sync_service_harness.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698