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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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::ModelEnumSet synced_datatypes); | 62 bool SetupSync(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 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 Loading... |
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::ModelEnumSet expected_migrated_types); | 105 bool AwaitMigration(syncable::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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 // The harness of the client whose update progress marker we're expecting | 328 // The harness of the client whose update progress marker we're expecting |
329 // eventually match. | 329 // eventually match. |
330 ProfileSyncServiceHarness* timestamp_match_partner_; | 330 ProfileSyncServiceHarness* timestamp_match_partner_; |
331 | 331 |
332 // Credentials used for GAIA authentication. | 332 // Credentials used for GAIA authentication. |
333 std::string username_; | 333 std::string username_; |
334 std::string password_; | 334 std::string password_; |
335 | 335 |
336 // The current set of data types pending migration. Used by | 336 // The current set of data types pending migration. Used by |
337 // AwaitMigration(). | 337 // AwaitMigration(). |
338 syncable::ModelEnumSet pending_migration_types_; | 338 syncable::ModelTypeSet pending_migration_types_; |
339 | 339 |
340 // The set of data types that have undergone migration. Used by | 340 // The set of data types that have undergone migration. Used by |
341 // AwaitMigration(). | 341 // AwaitMigration(). |
342 syncable::ModelEnumSet migrated_types_; | 342 syncable::ModelTypeSet migrated_types_; |
343 | 343 |
344 // Used for logging. | 344 // Used for logging. |
345 const std::string profile_debug_name_; | 345 const std::string profile_debug_name_; |
346 | 346 |
347 // Keeps track of the number of attempts at exponential backoff and its | 347 // Keeps track of the number of attempts at exponential backoff and its |
348 // related bookkeeping information for verification. | 348 // related bookkeeping information for verification. |
349 browser_sync::RetryVerifier retry_verifier_; | 349 browser_sync::RetryVerifier retry_verifier_; |
350 | 350 |
351 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceHarness); | 351 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceHarness); |
352 }; | 352 }; |
353 | 353 |
354 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_HARNESS_H_ | 354 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_HARNESS_H_ |
OLD | NEW |