| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_TEST_INTEGRATION_PROFILE_SYNC_SERVICE_HARNESS_H_ | 5 #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_PROFILE_SYNC_SERVICE_HARNESS_H_ |
| 6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_PROFILE_SYNC_SERVICE_HARNESS_H_ | 6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_PROFILE_SYNC_SERVICE_HARNESS_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 // Sets the GAIA credentials with which to sign in to sync. | 49 // Sets the GAIA credentials with which to sign in to sync. |
| 50 void SetCredentials(const std::string& username, const std::string& password); | 50 void SetCredentials(const std::string& username, const std::string& password); |
| 51 | 51 |
| 52 // Creates a ProfileSyncService for the profile passed at construction and | 52 // Creates a ProfileSyncService for the profile passed at construction and |
| 53 // enables sync for all available datatypes. Returns true only after sync has | 53 // enables sync for all available datatypes. Returns true only after sync has |
| 54 // been fully initialized and authenticated, and we are ready to process | 54 // been fully initialized and authenticated, and we are ready to process |
| 55 // changes. | 55 // changes. |
| 56 bool SetupSync(); | 56 bool SetupSync(); |
| 57 | 57 |
| 58 // Setup sync without the authenticating through the passphrase encryption. |
| 59 // Use this method when you need to setup a client that you're going to call |
| 60 // RestartSyncService() directly after. |
| 61 bool SetupSyncForClear(); |
| 62 |
| 63 // Both SetupSync and SetupSyncForClear call into this method. |
| 58 // Same as the above method, but enables sync only for the datatypes contained | 64 // Same as the above method, but enables sync only for the datatypes contained |
| 59 // in |synced_datatypes|. | 65 // in |synced_datatypes|. |
| 60 bool SetupSync(syncer::ModelTypeSet synced_datatypes); | 66 bool SetupSync(syncer::ModelTypeSet synced_datatypes, bool for_clear = false); |
| 67 |
| 68 // Restart sync service to simulate a sign-in/sign-out. This is useful |
| 69 // to recover from a lost birthday. Use directly after a clear server data |
| 70 // command to start from clean slate. |
| 71 bool RestartSyncService(); |
| 61 | 72 |
| 62 // Calling this acts as a barrier and blocks the caller until |this| and | 73 // Calling this acts as a barrier and blocks the caller until |this| and |
| 63 // |partner| have both completed a sync cycle. When calling this method, | 74 // |partner| have both completed a sync cycle. When calling this method, |
| 64 // the |partner| should be the passive responder who responds to the actions | 75 // the |partner| should be the passive responder who responds to the actions |
| 65 // of |this|. This method relies upon the synchronization of callbacks | 76 // of |this|. This method relies upon the synchronization of callbacks |
| 66 // from the message queue. Returns true if two sync cycles have completed. | 77 // from the message queue. Returns true if two sync cycles have completed. |
| 67 // Note: Use this method when exactly one client makes local change(s), and | 78 // Note: Use this method when exactly one client makes local change(s), and |
| 68 // exactly one client is waiting to receive those changes. | 79 // exactly one client is waiting to receive those changes. |
| 69 bool AwaitMutualSyncCycleCompletion(ProfileSyncServiceHarness* partner); | 80 bool AwaitMutualSyncCycleCompletion(ProfileSyncServiceHarness* partner); |
| 70 | 81 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 81 // client is waiting to receive those changes. | 92 // client is waiting to receive those changes. |
| 82 static bool AwaitQuiescence( | 93 static bool AwaitQuiescence( |
| 83 const std::vector<ProfileSyncServiceHarness*>& clients); | 94 const std::vector<ProfileSyncServiceHarness*>& clients); |
| 84 | 95 |
| 85 // Blocks the caller until the sync engine is initialized or some end state | 96 // Blocks the caller until the sync engine is initialized or some end state |
| 86 // (e.g., auth error) is reached. Returns true if and only if the engine | 97 // (e.g., auth error) is reached. Returns true if and only if the engine |
| 87 // initialized successfully. See ProfileSyncService's IsEngineInitialized() | 98 // initialized successfully. See ProfileSyncService's IsEngineInitialized() |
| 88 // method for the definition of engine initialization. | 99 // method for the definition of engine initialization. |
| 89 bool AwaitEngineInitialization(); | 100 bool AwaitEngineInitialization(); |
| 90 | 101 |
| 102 // Same as above, but without checks for passphrase decryption. |
| 103 bool AwaitEngineInitializationForClear(); |
| 104 |
| 91 // Blocks the caller until sync setup is complete. Returns true if and only | 105 // Blocks the caller until sync setup is complete. Returns true if and only |
| 92 // if sync setup completed successfully. See syncer::SyncService's | 106 // if sync setup completed successfully. See syncer::SyncService's |
| 93 // IsSyncActive() method for the definition of what successful means here. | 107 // IsSyncActive() method for the definition of what successful means here. |
| 94 bool AwaitSyncSetupCompletion(); | 108 bool AwaitSyncSetupCompletion(); |
| 95 | 109 |
| 96 // Returns the ProfileSyncService member of the sync client. | 110 // Returns the ProfileSyncService member of the sync client. |
| 97 browser_sync::ProfileSyncService* service() const { return service_; } | 111 browser_sync::ProfileSyncService* service() const { return service_; } |
| 98 | 112 |
| 99 // Returns the debug name for this profile. Used for logging. | 113 // Returns the debug name for this profile. Used for logging. |
| 100 const std::string& profile_debug_name() const { return profile_debug_name_; } | 114 const std::string& profile_debug_name() const { return profile_debug_name_; } |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 // all refresh tokens used in the tests are different. | 176 // all refresh tokens used in the tests are different. |
| 163 int oauth2_refesh_token_number_; | 177 int oauth2_refesh_token_number_; |
| 164 | 178 |
| 165 // Used for logging. | 179 // Used for logging. |
| 166 const std::string profile_debug_name_; | 180 const std::string profile_debug_name_; |
| 167 | 181 |
| 168 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceHarness); | 182 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceHarness); |
| 169 }; | 183 }; |
| 170 | 184 |
| 171 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_PROFILE_SYNC_SERVICE_HARNESS_H_ | 185 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_PROFILE_SYNC_SERVICE_HARNESS_H_ |
| OLD | NEW |