| 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 21 matching lines...) Expand all Loading... |
| 32 class ProfileSyncServiceHarness { | 32 class ProfileSyncServiceHarness { |
| 33 public: | 33 public: |
| 34 // The type of profile signin method to authenticate a profile. | 34 // The type of profile signin method to authenticate a profile. |
| 35 enum class SigninType { | 35 enum class SigninType { |
| 36 // Fakes user signin process. | 36 // Fakes user signin process. |
| 37 FAKE_SIGNIN, | 37 FAKE_SIGNIN, |
| 38 // Uses UI signin flow and connects to GAIA servers for authentication. | 38 // Uses UI signin flow and connects to GAIA servers for authentication. |
| 39 UI_SIGNIN | 39 UI_SIGNIN |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 static ProfileSyncServiceHarness* Create( | 42 static std::unique_ptr<ProfileSyncServiceHarness> Create( |
| 43 Profile* profile, | 43 Profile* profile, |
| 44 const std::string& username, | 44 const std::string& username, |
| 45 const std::string& password, | 45 const std::string& password, |
| 46 SigninType signin_type); | 46 SigninType signin_type); |
| 47 virtual ~ProfileSyncServiceHarness(); | 47 virtual ~ProfileSyncServiceHarness(); |
| 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 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 78 // from the message queue. Returns true if two sync cycles have completed. | 78 // from the message queue. Returns true if two sync cycles have completed. |
| 79 // Note: Use this method when exactly one client makes local change(s), and | 79 // Note: Use this method when exactly one client makes local change(s), and |
| 80 // exactly one client is waiting to receive those changes. | 80 // exactly one client is waiting to receive those changes. |
| 81 bool AwaitMutualSyncCycleCompletion(ProfileSyncServiceHarness* partner); | 81 bool AwaitMutualSyncCycleCompletion(ProfileSyncServiceHarness* partner); |
| 82 | 82 |
| 83 // Blocks the caller until |this| completes its ongoing sync cycle and every | 83 // Blocks the caller until |this| completes its ongoing sync cycle and every |
| 84 // other client in |partners| have achieved identical download progresses. | 84 // other client in |partners| have achieved identical download progresses. |
| 85 // Note: Use this method when exactly one client makes local change(s), | 85 // Note: Use this method when exactly one client makes local change(s), |
| 86 // and more than one client is waiting to receive those changes. | 86 // and more than one client is waiting to receive those changes. |
| 87 bool AwaitGroupSyncCycleCompletion( | 87 bool AwaitGroupSyncCycleCompletion( |
| 88 const std::vector<ProfileSyncServiceHarness*>& partners); | 88 std::vector<ProfileSyncServiceHarness*> partners); |
| 89 | 89 |
| 90 // Blocks the caller until every client in |clients| completes its ongoing | 90 // Blocks the caller until every client in |clients| completes its ongoing |
| 91 // sync cycle and all the clients' progress markers match. Note: Use this | 91 // sync cycle and all the clients' progress markers match. Note: Use this |
| 92 // method when more than one client makes local change(s), and more than one | 92 // method when more than one client makes local change(s), and more than one |
| 93 // client is waiting to receive those changes. | 93 // client is waiting to receive those changes. |
| 94 static bool AwaitQuiescence( | 94 static bool AwaitQuiescence(std::vector<ProfileSyncServiceHarness*> clients); |
| 95 const std::vector<ProfileSyncServiceHarness*>& clients); | |
| 96 | 95 |
| 97 // 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 |
| 98 // (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 |
| 99 // initialized successfully. See ProfileSyncService's IsEngineInitialized() | 98 // initialized successfully. See ProfileSyncService's IsEngineInitialized() |
| 100 // method for the definition of engine initialization. | 99 // method for the definition of engine initialization. |
| 101 bool AwaitEngineInitialization(bool skip_passphrase_verification = false); | 100 bool AwaitEngineInitialization(bool skip_passphrase_verification = false); |
| 102 | 101 |
| 103 // Blocks the caller until sync setup is complete. Returns true if and only | 102 // Blocks the caller until sync setup is complete. Returns true if and only |
| 104 // if sync setup completed successfully. See syncer::SyncService's | 103 // if sync setup completed successfully. See syncer::SyncService's |
| 105 // IsSyncActive() method for the definition of what successful means here. | 104 // IsSyncActive() method for the definition of what successful means here. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 // all refresh tokens used in the tests are different. | 173 // all refresh tokens used in the tests are different. |
| 175 int oauth2_refesh_token_number_; | 174 int oauth2_refesh_token_number_; |
| 176 | 175 |
| 177 // Used for logging. | 176 // Used for logging. |
| 178 const std::string profile_debug_name_; | 177 const std::string profile_debug_name_; |
| 179 | 178 |
| 180 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceHarness); | 179 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceHarness); |
| 181 }; | 180 }; |
| 182 | 181 |
| 183 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_PROFILE_SYNC_SERVICE_HARNESS_H_ | 182 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_PROFILE_SYNC_SERVICE_HARNESS_H_ |
| OLD | NEW |