| OLD | NEW |
| 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 #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 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 // level or permanent items, and can include recently deleted entries. | 188 // level or permanent items, and can include recently deleted entries. |
| 189 size_t GetNumEntries() const; | 189 size_t GetNumEntries() const; |
| 190 | 190 |
| 191 // Get the number of sync datatypes registered (ignoring whatever state | 191 // Get the number of sync datatypes registered (ignoring whatever state |
| 192 // they're in). | 192 // they're in). |
| 193 size_t GetNumDatatypes() const; | 193 size_t GetNumDatatypes() const; |
| 194 | 194 |
| 195 // Gets the |auto_start_enabled_| variable from the |service_|. | 195 // Gets the |auto_start_enabled_| variable from the |service_|. |
| 196 bool AutoStartEnabled(); | 196 bool AutoStartEnabled(); |
| 197 | 197 |
| 198 // Returns true if a status change took place, false on timeout. |
| 199 bool AwaitStatusChangeWithTimeout(int timeout_milliseconds, |
| 200 const std::string& reason); |
| 201 |
| 198 private: | 202 private: |
| 199 friend class StateChangeTimeoutEvent; | 203 friend class StateChangeTimeoutEvent; |
| 200 | 204 |
| 201 enum WaitState { | 205 enum WaitState { |
| 202 // The sync client has just been initialized. | 206 // The sync client has just been initialized. |
| 203 INITIAL_WAIT_STATE = 0, | 207 INITIAL_WAIT_STATE = 0, |
| 204 | 208 |
| 205 // The sync client awaits the OnBackendInitialized() callback. | 209 // The sync client awaits the OnBackendInitialized() callback. |
| 206 WAITING_FOR_ON_BACKEND_INITIALIZED, | 210 WAITING_FOR_ON_BACKEND_INITIALIZED, |
| 207 | 211 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 // Called from the observer when the current wait state has been completed. | 283 // Called from the observer when the current wait state has been completed. |
| 280 void SignalStateCompleteWithNextState(WaitState next_state); | 284 void SignalStateCompleteWithNextState(WaitState next_state); |
| 281 | 285 |
| 282 // Indicates that the operation being waited on is complete. | 286 // Indicates that the operation being waited on is complete. |
| 283 void SignalStateComplete(); | 287 void SignalStateComplete(); |
| 284 | 288 |
| 285 // Finite state machine for controlling state. Returns true only if a state | 289 // Finite state machine for controlling state. Returns true only if a state |
| 286 // change has taken place. | 290 // change has taken place. |
| 287 bool RunStateChangeMachine(); | 291 bool RunStateChangeMachine(); |
| 288 | 292 |
| 289 // Returns true if a status change took place, false on timeout. | |
| 290 bool AwaitStatusChangeWithTimeout(int timeout_milliseconds, | |
| 291 const std::string& reason); | |
| 292 | |
| 293 // A helper for implementing IsDataSynced() and IsFullySynced(). | 293 // A helper for implementing IsDataSynced() and IsFullySynced(). |
| 294 bool IsDataSyncedImpl( | 294 bool IsDataSyncedImpl( |
| 295 const syncer::sessions::SyncSessionSnapshot& snapshot); | 295 const syncer::sessions::SyncSessionSnapshot& snapshot); |
| 296 | 296 |
| 297 // Returns true if the sync client has no unsynced items. | 297 // Returns true if the sync client has no unsynced items. |
| 298 bool IsDataSynced(); | 298 bool IsDataSynced(); |
| 299 | 299 |
| 300 // Returns true if the sync client has no unsynced items and its progress | 300 // Returns true if the sync client has no unsynced items and its progress |
| 301 // markers are believed to be up to date. | 301 // markers are believed to be up to date. |
| 302 // | 302 // |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 | 364 |
| 365 // Flag set to true when we're waiting for a status change to happen. Used to | 365 // Flag set to true when we're waiting for a status change to happen. Used to |
| 366 // avoid triggering internal state machine logic on unexpected sync observer | 366 // avoid triggering internal state machine logic on unexpected sync observer |
| 367 // callbacks. | 367 // callbacks. |
| 368 bool waiting_for_status_change_; | 368 bool waiting_for_status_change_; |
| 369 | 369 |
| 370 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceHarness); | 370 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceHarness); |
| 371 }; | 371 }; |
| 372 | 372 |
| 373 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_HARNESS_H_ | 373 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_HARNESS_H_ |
| OLD | NEW |