Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 // Same as the above method, but enables sync only for the datatypes contained | 60 // Same as the above method, but enables sync only for the datatypes contained |
| 61 // in |synced_datatypes|. | 61 // in |synced_datatypes|. |
| 62 bool SetupSync(const syncable::ModelTypeSet& synced_datatypes); | 62 bool SetupSync(const syncable::ModelTypeSet& synced_datatypes); |
| 63 | 63 |
| 64 // ProfileSyncServiceObserver implementation. | 64 // ProfileSyncServiceObserver implementation. |
| 65 virtual void OnStateChanged() OVERRIDE; | 65 virtual void OnStateChanged() OVERRIDE; |
| 66 | 66 |
| 67 // MigrationObserver implementation. | 67 // MigrationObserver implementation. |
| 68 virtual void OnMigrationStateChange() OVERRIDE; | 68 virtual void OnMigrationStateChange() OVERRIDE; |
| 69 | 69 |
| 70 // Blocks the caller until the sync backend host associated with this harness | 70 // Blocks the caller until sync backend host associated with this harness |
|
Raghu Simha
2011/09/19 22:25:02
Undo this change.
lipalani1
2011/09/22 20:42:46
Done.
| |
| 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 // Blocks 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 AwaitSyncCycleCompletion(const std::string& reason); |
| 82 | 82 |
| 83 // Blocks the caller until the sync has been disabled for this client. Returns | 83 // Blocks the caller until sync has been disabled for this client. Returns |
| 84 // true if sync is disabled. | 84 // true if sync is disabled. |
| 85 bool AwaitSyncDisabled(const std::string& reason); | 85 bool AwaitSyncDisabled(const std::string& reason); |
| 86 | 86 |
| 87 // Blocks the caller until exponential backoff has been verified to happen. | 87 // Blocks the caller until exponential backoff has been verified to happen. |
| 88 bool AwaitExponentialBackoffVerification(); | 88 bool AwaitExponentialBackoffVerification(); |
| 89 | 89 |
| 90 // Blocks the caller until the syncer receives an actionable error. And | |
| 91 // return true if sync client had received an actionable error. | |
|
Raghu Simha
2011/09/19 22:25:02
s/And return true if sync client had received/Retu
lipalani1
2011/09/22 20:42:46
Done.
Raghu Simha
2011/09/22 21:15:10
This isn't done yet.
s/And returns true if sync cl
lipalani1
2011/09/22 21:23:57
Done.
| |
| 92 bool AwaitActionableError(); | |
| 93 | |
| 90 // Blocks until the given set of data types are migrated. | 94 // Blocks until the given set of data types are migrated. |
| 91 bool AwaitMigration(const syncable::ModelTypeSet& expected_migrated_types); | 95 bool AwaitMigration(const syncable::ModelTypeSet& expected_migrated_types); |
| 92 | 96 |
| 93 // Blocks the caller until this harness has observed that the sync engine | 97 // Blocks the caller until this harness has observed that sync engine |
|
Raghu Simha
2011/09/19 22:25:02
Undo this change.
lipalani1
2011/09/22 20:42:46
Done.
| |
| 94 // has downloaded all the changes seen by the |partner| harness's client. | 98 // has downloaded all the changes seen by the |partner| harness's client. |
| 95 bool WaitUntilTimestampMatches( | 99 bool WaitUntilTimestampMatches( |
| 96 ProfileSyncServiceHarness* partner, const std::string& reason); | 100 ProfileSyncServiceHarness* partner, const std::string& reason); |
| 97 | 101 |
| 98 // Calling this acts as a barrier and blocks the caller until |this| and | 102 // Calling this acts as a barrier and blocks the caller until |this| and |
| 99 // |partner| have both completed a sync cycle. When calling this method, | 103 // |partner| have both completed a sync cycle. When calling this method, |
| 100 // the |partner| should be the passive responder who responds to the actions | 104 // the |partner| should be the passive responder who responds to the actions |
| 101 // of |this|. This method relies upon the synchronization of callbacks | 105 // of |this|. This method relies upon the synchronization of callbacks |
| 102 // from the message queue. Returns true if two sync cycles have completed. | 106 // from the message queue. Returns true if two sync cycles have completed. |
| 103 // Note: Use this method when exactly one client makes local change(s), and | 107 // Note: Use this method when exactly one client makes local change(s), and |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 118 static bool AwaitQuiescence( | 122 static bool AwaitQuiescence( |
| 119 std::vector<ProfileSyncServiceHarness*>& clients); | 123 std::vector<ProfileSyncServiceHarness*>& clients); |
| 120 | 124 |
| 121 // Blocks the caller until |service_| indicates that a passphrase is required. | 125 // Blocks the caller until |service_| indicates that a passphrase is required. |
| 122 bool AwaitPassphraseRequired(); | 126 bool AwaitPassphraseRequired(); |
| 123 | 127 |
| 124 // Blocks the caller until |service_| indicates that the passphrase set by | 128 // Blocks the caller until |service_| indicates that the passphrase set by |
| 125 // calling SetPassphrase has been accepted. | 129 // calling SetPassphrase has been accepted. |
| 126 bool AwaitPassphraseAccepted(); | 130 bool AwaitPassphraseAccepted(); |
| 127 | 131 |
| 128 // Returns the ProfileSyncService member of the the sync client. | 132 // Returns the ProfileSyncService member of sync client. |
|
Raghu Simha
2011/09/19 22:25:02
s/of sync client/of the sync client/
lipalani1
2011/09/22 20:42:46
Done.
| |
| 129 ProfileSyncService* service() { return service_; } | 133 ProfileSyncService* service() { return service_; } |
| 130 | 134 |
| 131 // Returns the status of the ProfileSyncService member of the the sync client. | 135 // Returns the status of the ProfileSyncService member of sync client. |
|
Raghu Simha
2011/09/19 22:25:02
s/of sync client/of the sync client/
lipalani1
2011/09/22 20:42:46
Done.
| |
| 132 ProfileSyncService::Status GetStatus(); | 136 ProfileSyncService::Status GetStatus(); |
| 133 | 137 |
| 134 // See ProfileSyncService::ShouldPushChanges(). | 138 // See ProfileSyncService::ShouldPushChanges(). |
| 135 bool ServiceIsPushingChanges() { return service_->ShouldPushChanges(); } | 139 bool ServiceIsPushingChanges() { return service_->ShouldPushChanges(); } |
| 136 | 140 |
| 137 // Enables sync for a particular sync datatype. Returns true on success. | 141 // Enables sync for a particular sync datatype. Returns true on success. |
| 138 bool EnableSyncForDatatype(syncable::ModelType datatype); | 142 bool EnableSyncForDatatype(syncable::ModelType datatype); |
| 139 | 143 |
| 140 // Disables sync for a particular sync datatype. Returns true on success. | 144 // Disables sync for a particular sync datatype. Returns true on success. |
| 141 bool DisableSyncForDatatype(syncable::ModelType datatype); | 145 bool DisableSyncForDatatype(syncable::ModelType datatype); |
| 142 | 146 |
| 143 // Enables sync for all sync datatypes. Returns true on success. | 147 // Enables sync for all sync datatypes. Returns true on success. |
| 144 bool EnableSyncForAllDatatypes(); | 148 bool EnableSyncForAllDatatypes(); |
| 145 | 149 |
| 146 // Disables sync for all sync datatypes. Returns true on success. | 150 // Disables sync for all sync datatypes. Returns true on success. |
| 147 bool DisableSyncForAllDatatypes(); | 151 bool DisableSyncForAllDatatypes(); |
| 148 | 152 |
| 149 // Returns a snapshot of the current sync session. | 153 // Returns a snapshot of the current sync session. |
| 150 const browser_sync::sessions::SyncSessionSnapshot* | 154 const browser_sync::sessions::SyncSessionSnapshot* |
| 151 GetLastSessionSnapshot() const; | 155 GetLastSessionSnapshot() const; |
| 152 | 156 |
| 153 // Encrypt the datatype |type|. This method will block while the sync backend | 157 // Encrypt the datatype |type|. This method will block while sync backend |
|
Raghu Simha
2011/09/19 22:25:02
Undo this change.
lipalani1
2011/09/22 20:42:46
Done.
| |
| 154 // host performs the encryption or a timeout is reached. | 158 // host performs the encryption or a timeout is reached. |
| 155 // PostCondition: | 159 // PostCondition: |
| 156 // returns: True if |type| was encrypted and we are fully synced. | 160 // returns: True if |type| was encrypted and we are fully synced. |
| 157 // False if we timed out. | 161 // False if we timed out. |
| 158 bool EnableEncryptionForType(syncable::ModelType type); | 162 bool EnableEncryptionForType(syncable::ModelType type); |
| 159 | 163 |
| 160 // Wait until |type| is encrypted or we time out. | 164 // Wait until |type| is encrypted or we time out. |
| 161 // PostCondition: | 165 // PostCondition: |
| 162 // returns: True if |type| is currently encrypted and we are fully synced. | 166 // returns: True if |type| is currently encrypted and we are fully synced. |
| 163 // False if we timed out. | 167 // False if we timed out. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 200 WAITING_FOR_PASSPHRASE_ACCEPTED, | 204 WAITING_FOR_PASSPHRASE_ACCEPTED, |
| 201 | 205 |
| 202 // The sync client anticipates encryption of new datatypes. | 206 // The sync client anticipates encryption of new datatypes. |
| 203 WAITING_FOR_ENCRYPTION, | 207 WAITING_FOR_ENCRYPTION, |
| 204 | 208 |
| 205 // The sync client is waiting for the datatype manager to be configured and | 209 // The sync client is waiting for the datatype manager to be configured and |
| 206 // for sync to be fully initialized. Used after a browser restart, where a | 210 // for sync to be fully initialized. Used after a browser restart, where a |
| 207 // full sync cycle is not expected to occur. | 211 // full sync cycle is not expected to occur. |
| 208 WAITING_FOR_SYNC_CONFIGURATION, | 212 WAITING_FOR_SYNC_CONFIGURATION, |
| 209 | 213 |
| 210 // The sync client is waiting for the sync to be disabled for this client. | 214 // The sync client is waiting for sync to be disabled for this client. |
| 211 WAITING_FOR_SYNC_DISABLED, | 215 WAITING_FOR_SYNC_DISABLED, |
| 212 | 216 |
| 213 // The sync client is in the exponential backoff mode. Verify that | 217 // The sync client is in the exponential backoff mode. Verify that |
| 214 // backoffs are triggered correctly. | 218 // backoffs are triggered correctly. |
| 215 WAITING_FOR_EXPONENTIAL_BACKOFF_VERIFICATION, | 219 WAITING_FOR_EXPONENTIAL_BACKOFF_VERIFICATION, |
| 216 | 220 |
| 217 // The sync client is waiting for migration to start. | 221 // The sync client is waiting for migration to start. |
| 218 WAITING_FOR_MIGRATION_TO_START, | 222 WAITING_FOR_MIGRATION_TO_START, |
| 219 | 223 |
| 220 // The sync client is waiting for migration to finish. | 224 // The sync client is waiting for migration to finish. |
| 221 WAITING_FOR_MIGRATION_TO_FINISH, | 225 WAITING_FOR_MIGRATION_TO_FINISH, |
| 222 | 226 |
| 227 // The sync client is waiting for an actionable error from the server. | |
| 228 WAITING_FOR_ACTIONABLE_ERROR, | |
| 229 | |
| 223 // The client verification is complete. We don't care about the state of | 230 // The client verification is complete. We don't care about the state of |
| 224 // the syncer any more. | 231 // the syncer any more. |
| 225 WAITING_FOR_NOTHING, | 232 WAITING_FOR_NOTHING, |
| 226 | 233 |
| 227 // The sync client needs a passphrase in order to decrypt data. | 234 // The sync client needs a passphrase in order to decrypt data. |
| 228 SET_PASSPHRASE_FAILED, | 235 SET_PASSPHRASE_FAILED, |
| 229 | 236 |
| 230 // The sync client cannot reach the server. | 237 // The sync client cannot reach the server. |
| 231 SERVER_UNREACHABLE, | 238 SERVER_UNREACHABLE, |
| 232 | 239 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 313 const std::string profile_debug_name_; | 320 const std::string profile_debug_name_; |
| 314 | 321 |
| 315 // Keeps track of the number of attempts at exponential backoff and its | 322 // Keeps track of the number of attempts at exponential backoff and its |
| 316 // related bookkeeping information for verification. | 323 // related bookkeeping information for verification. |
| 317 browser_sync::RetryVerifier retry_verifier_; | 324 browser_sync::RetryVerifier retry_verifier_; |
| 318 | 325 |
| 319 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceHarness); | 326 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceHarness); |
| 320 }; | 327 }; |
| 321 | 328 |
| 322 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_HARNESS_H_ | 329 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_HARNESS_H_ |
| OLD | NEW |