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

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

Issue 10696087: [Sync] Move ModelType and related classes to 'syncer' namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sort headers, update copyrights Created 8 years, 5 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) 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 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 bool IsSyncAlreadySetup(); 52 bool IsSyncAlreadySetup();
53 53
54 // Creates a ProfileSyncService for the profile passed at construction and 54 // Creates a ProfileSyncService for the profile passed at construction and
55 // enables sync for all available datatypes. Returns true only after sync has 55 // enables sync for all available datatypes. Returns true only after sync has
56 // been fully initialized and authenticated, and we are ready to process 56 // been fully initialized and authenticated, and we are ready to process
57 // changes. 57 // changes.
58 bool SetupSync(); 58 bool SetupSync();
59 59
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(syncable::ModelTypeSet synced_datatypes); 62 bool SetupSync(syncer::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 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();
(...skipping 22 matching lines...) Expand all
95 bool AwaitSyncDisabled(const std::string& reason); 95 bool AwaitSyncDisabled(const std::string& reason);
96 96
97 // Blocks the caller until exponential backoff has been verified to happen. 97 // Blocks the caller until exponential backoff has been verified to happen.
98 bool AwaitExponentialBackoffVerification(); 98 bool AwaitExponentialBackoffVerification();
99 99
100 // Blocks the caller until the syncer receives an actionable error. 100 // Blocks the caller until the syncer receives an actionable error.
101 // Returns true if the sync client received an actionable error. 101 // Returns true if the sync client received an actionable error.
102 bool AwaitActionableError(); 102 bool AwaitActionableError();
103 103
104 // Blocks until the given set of data types are migrated. 104 // Blocks until the given set of data types are migrated.
105 bool AwaitMigration(syncable::ModelTypeSet expected_migrated_types); 105 bool AwaitMigration(syncer::ModelTypeSet expected_migrated_types);
106 106
107 // Blocks the caller until this harness has observed that the sync engine 107 // Blocks the caller until this harness has observed that the sync engine
108 // has downloaded all the changes seen by the |partner| harness's client. 108 // has downloaded all the changes seen by the |partner| harness's client.
109 bool WaitUntilTimestampMatches( 109 bool WaitUntilTimestampMatches(
110 ProfileSyncServiceHarness* partner, const std::string& reason); 110 ProfileSyncServiceHarness* partner, const std::string& reason);
111 111
112 // Calling this acts as a barrier and blocks the caller until |this| and 112 // Calling this acts as a barrier and blocks the caller until |this| and
113 // |partner| have both completed a sync cycle. When calling this method, 113 // |partner| have both completed a sync cycle. When calling this method,
114 // the |partner| should be the passive responder who responds to the actions 114 // the |partner| should be the passive responder who responds to the actions
115 // of |this|. This method relies upon the synchronization of callbacks 115 // of |this|. This method relies upon the synchronization of callbacks
(...skipping 26 matching lines...) Expand all
142 // Returns the ProfileSyncService member of the sync client. 142 // Returns the ProfileSyncService member of the sync client.
143 ProfileSyncService* service() { return service_; } 143 ProfileSyncService* service() { return service_; }
144 144
145 // Returns the status of the ProfileSyncService member of the sync client. 145 // Returns the status of the ProfileSyncService member of the sync client.
146 ProfileSyncService::Status GetStatus(); 146 ProfileSyncService::Status GetStatus();
147 147
148 // See ProfileSyncService::ShouldPushChanges(). 148 // See ProfileSyncService::ShouldPushChanges().
149 bool ServiceIsPushingChanges() { return service_->ShouldPushChanges(); } 149 bool ServiceIsPushingChanges() { return service_->ShouldPushChanges(); }
150 150
151 // Enables sync for a particular sync datatype. Returns true on success. 151 // Enables sync for a particular sync datatype. Returns true on success.
152 bool EnableSyncForDatatype(syncable::ModelType datatype); 152 bool EnableSyncForDatatype(syncer::ModelType datatype);
153 153
154 // Disables sync for a particular sync datatype. Returns true on success. 154 // Disables sync for a particular sync datatype. Returns true on success.
155 bool DisableSyncForDatatype(syncable::ModelType datatype); 155 bool DisableSyncForDatatype(syncer::ModelType datatype);
156 156
157 // Enables sync for all sync datatypes. Returns true on success. 157 // Enables sync for all sync datatypes. Returns true on success.
158 bool EnableSyncForAllDatatypes(); 158 bool EnableSyncForAllDatatypes();
159 159
160 // Disables sync for all sync datatypes. Returns true on success. 160 // Disables sync for all sync datatypes. Returns true on success.
161 bool DisableSyncForAllDatatypes(); 161 bool DisableSyncForAllDatatypes();
162 162
163 // Returns a snapshot of the current sync session. 163 // Returns a snapshot of the current sync session.
164 syncer::sessions::SyncSessionSnapshot GetLastSessionSnapshot() const; 164 syncer::sessions::SyncSessionSnapshot GetLastSessionSnapshot() const;
165 165
166 // Encrypt the datatype |type|. This method will block while the sync backend 166 // Encrypt the datatype |type|. This method will block while the sync backend
167 // host performs the encryption or a timeout is reached. 167 // host performs the encryption or a timeout is reached.
168 // PostCondition: 168 // PostCondition:
169 // returns: True if |type| was encrypted and we are fully synced. 169 // returns: True if |type| was encrypted and we are fully synced.
170 // False if we timed out. 170 // False if we timed out.
171 bool EnableEncryptionForType(syncable::ModelType type); 171 bool EnableEncryptionForType(syncer::ModelType type);
172 172
173 // Wait until |type| is encrypted or we time out. 173 // Wait until |type| is encrypted or we time out.
174 // PostCondition: 174 // PostCondition:
175 // returns: True if |type| is currently encrypted and we are fully synced. 175 // returns: True if |type| is currently encrypted and we are fully synced.
176 // False if we timed out. 176 // False if we timed out.
177 bool WaitForTypeEncryption(syncable::ModelType type); 177 bool WaitForTypeEncryption(syncer::ModelType type);
178 178
179 // Check if |type| is encrypted. 179 // Check if |type| is encrypted.
180 bool IsTypeEncrypted(syncable::ModelType type); 180 bool IsTypeEncrypted(syncer::ModelType type);
181 181
182 // Check if |type| is registered and the controller is running. 182 // Check if |type| is registered and the controller is running.
183 bool IsTypeRunning(syncable::ModelType type); 183 bool IsTypeRunning(syncer::ModelType type);
184 184
185 // Check if |type| is being synced. 185 // Check if |type| is being synced.
186 bool IsTypePreferred(syncable::ModelType type); 186 bool IsTypePreferred(syncer::ModelType type);
187 187
188 // Get the number of sync entries this client has. This includes all top 188 // Get the number of sync entries this client has. This includes all top
189 // level or permanent items, and can include recently deleted entries. 189 // level or permanent items, and can include recently deleted entries.
190 size_t GetNumEntries() const; 190 size_t GetNumEntries() const;
191 191
192 // Get the number of sync datatypes registered (ignoring whatever state 192 // Get the number of sync datatypes registered (ignoring whatever state
193 // they're in). 193 // they're in).
194 size_t GetNumDatatypes() const; 194 size_t GetNumDatatypes() const;
195 195
196 // Gets the |auto_start_enabled_| variable from the |service_|. 196 // Gets the |auto_start_enabled_| variable from the |service_|.
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 // Returns true if this client has downloaded all the items that the 310 // Returns true if this client has downloaded all the items that the
311 // other client has. 311 // other client has.
312 bool MatchesOtherClient(ProfileSyncServiceHarness* partner); 312 bool MatchesOtherClient(ProfileSyncServiceHarness* partner);
313 313
314 // Returns a string with relevant info about client's sync state (if 314 // Returns a string with relevant info about client's sync state (if
315 // available), annotated with |message|. Useful for logging. 315 // available), annotated with |message|. Useful for logging.
316 std::string GetClientInfoString(const std::string& message); 316 std::string GetClientInfoString(const std::string& message);
317 317
318 // Gets the current progress indicator of the current sync session 318 // Gets the current progress indicator of the current sync session
319 // for a particular datatype. 319 // for a particular datatype.
320 std::string GetUpdatedTimestamp(syncable::ModelType model_type); 320 std::string GetUpdatedTimestamp(syncer::ModelType model_type);
321 321
322 // Gets detailed status from |service_| in pretty-printable form. 322 // Gets detailed status from |service_| in pretty-printable form.
323 std::string GetServiceStatus(); 323 std::string GetServiceStatus();
324 324
325 // When in WAITING_FOR_ENCRYPTION state, we check to see if this type is now 325 // When in WAITING_FOR_ENCRYPTION state, we check to see if this type is now
326 // encrypted to determine if we're done. 326 // encrypted to determine if we're done.
327 syncable::ModelType waiting_for_encryption_type_; 327 syncer::ModelType waiting_for_encryption_type_;
328 328
329 // The WaitState in which the sync client currently is. Helps determine what 329 // The WaitState in which the sync client currently is. Helps determine what
330 // action to take when RunStateChangeMachine() is called. 330 // action to take when RunStateChangeMachine() is called.
331 WaitState wait_state_; 331 WaitState wait_state_;
332 332
333 // Sync profile associated with this sync client. 333 // Sync profile associated with this sync client.
334 Profile* profile_; 334 Profile* profile_;
335 335
336 // ProfileSyncService object associated with |profile_|. 336 // ProfileSyncService object associated with |profile_|.
337 ProfileSyncService* service_; 337 ProfileSyncService* service_;
338 338
339 // The harness of the client whose update progress marker we're expecting 339 // The harness of the client whose update progress marker we're expecting
340 // eventually match. 340 // eventually match.
341 ProfileSyncServiceHarness* timestamp_match_partner_; 341 ProfileSyncServiceHarness* timestamp_match_partner_;
342 342
343 // Credentials used for GAIA authentication. 343 // Credentials used for GAIA authentication.
344 std::string username_; 344 std::string username_;
345 std::string password_; 345 std::string password_;
346 346
347 // The current set of data types pending migration. Used by 347 // The current set of data types pending migration. Used by
348 // AwaitMigration(). 348 // AwaitMigration().
349 syncable::ModelTypeSet pending_migration_types_; 349 syncer::ModelTypeSet pending_migration_types_;
350 350
351 // The set of data types that have undergone migration. Used by 351 // The set of data types that have undergone migration. Used by
352 // AwaitMigration(). 352 // AwaitMigration().
353 syncable::ModelTypeSet migrated_types_; 353 syncer::ModelTypeSet migrated_types_;
354 354
355 // Used for logging. 355 // Used for logging.
356 const std::string profile_debug_name_; 356 const std::string profile_debug_name_;
357 357
358 // Keeps track of the number of attempts at exponential backoff and its 358 // Keeps track of the number of attempts at exponential backoff and its
359 // related bookkeeping information for verification. 359 // related bookkeeping information for verification.
360 browser_sync::RetryVerifier retry_verifier_; 360 browser_sync::RetryVerifier retry_verifier_;
361 361
362 // Flag set to true when we're waiting for a status change to happen. Used to 362 // Flag set to true when we're waiting for a status change to happen. Used to
363 // avoid triggering internal state machine logic on unexpected sync observer 363 // avoid triggering internal state machine logic on unexpected sync observer
364 // callbacks. 364 // callbacks.
365 bool waiting_for_status_change_; 365 bool waiting_for_status_change_;
366 366
367 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceHarness); 367 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceHarness);
368 }; 368 };
369 369
370 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_HARNESS_H_ 370 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_HARNESS_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service_bookmark_unittest.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