| 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 <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "components/sync/base/model_type.h" | 13 #include "components/sync/base/model_type.h" |
| 14 #include "components/sync/engine/cycle/sync_cycle_snapshot.h" | 14 #include "components/sync/engine/cycle/sync_cycle_snapshot.h" |
| 15 | 15 |
| 16 class Profile; | 16 class Profile; |
| 17 |
| 18 namespace browser_sync { |
| 17 class ProfileSyncService; | 19 class ProfileSyncService; |
| 20 } // namespace browser_sync |
| 18 | 21 |
| 19 namespace sync_driver { | 22 namespace sync_driver { |
| 20 class SyncSetupInProgressHandle; | 23 class SyncSetupInProgressHandle; |
| 21 } | 24 } // namespace sync_driver |
| 22 | 25 |
| 23 // An instance of this class is basically our notion of a "sync client" for | 26 // An instance of this class is basically our notion of a "sync client" for |
| 24 // automation purposes. It harnesses the ProfileSyncService member of the | 27 // automation purposes. It harnesses the ProfileSyncService member of the |
| 25 // profile passed to it on construction and automates certain things like setup | 28 // profile passed to it on construction and automates certain things like setup |
| 26 // and authentication. It provides ways to "wait" adequate periods of time for | 29 // and authentication. It provides ways to "wait" adequate periods of time for |
| 27 // several clients to get to the same state. | 30 // several clients to get to the same state. |
| 28 class ProfileSyncServiceHarness { | 31 class ProfileSyncServiceHarness { |
| 29 public: | 32 public: |
| 30 // The type of profile signin method to authenticate a profile. | 33 // The type of profile signin method to authenticate a profile. |
| 31 enum class SigninType { | 34 enum class SigninType { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 // initialized successfully. See ProfileSyncService's IsBackendInitialized() | 86 // initialized successfully. See ProfileSyncService's IsBackendInitialized() |
| 84 // method for the definition of backend initialization. | 87 // method for the definition of backend initialization. |
| 85 bool AwaitBackendInitialization(); | 88 bool AwaitBackendInitialization(); |
| 86 | 89 |
| 87 // Blocks the caller until sync setup is complete. Returns true if and only | 90 // Blocks the caller until sync setup is complete. Returns true if and only |
| 88 // if sync setup completed successfully. See sync_driver::SyncService's | 91 // if sync setup completed successfully. See sync_driver::SyncService's |
| 89 // IsSyncActive() method for the definition of what successful means here. | 92 // IsSyncActive() method for the definition of what successful means here. |
| 90 bool AwaitSyncSetupCompletion(); | 93 bool AwaitSyncSetupCompletion(); |
| 91 | 94 |
| 92 // Returns the ProfileSyncService member of the sync client. | 95 // Returns the ProfileSyncService member of the sync client. |
| 93 ProfileSyncService* service() const { return service_; } | 96 browser_sync::ProfileSyncService* service() const { return service_; } |
| 94 | 97 |
| 95 // Returns the debug name for this profile. Used for logging. | 98 // Returns the debug name for this profile. Used for logging. |
| 96 const std::string& profile_debug_name() const { return profile_debug_name_; } | 99 const std::string& profile_debug_name() const { return profile_debug_name_; } |
| 97 | 100 |
| 98 // Enables sync for a particular sync datatype. Returns true on success. | 101 // Enables sync for a particular sync datatype. Returns true on success. |
| 99 bool EnableSyncForDatatype(syncer::ModelType datatype); | 102 bool EnableSyncForDatatype(syncer::ModelType datatype); |
| 100 | 103 |
| 101 // Disables sync for a particular sync datatype. Returns true on success. | 104 // Disables sync for a particular sync datatype. Returns true on success. |
| 102 bool DisableSyncForDatatype(syncer::ModelType datatype); | 105 bool DisableSyncForDatatype(syncer::ModelType datatype); |
| 103 | 106 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 // Gets detailed status from |service_| in pretty-printable form. | 138 // Gets detailed status from |service_| in pretty-printable form. |
| 136 std::string GetServiceStatus(); | 139 std::string GetServiceStatus(); |
| 137 | 140 |
| 138 // Returns true if sync is disabled for this client. | 141 // Returns true if sync is disabled for this client. |
| 139 bool IsSyncDisabled() const; | 142 bool IsSyncDisabled() const; |
| 140 | 143 |
| 141 // Sync profile associated with this sync client. | 144 // Sync profile associated with this sync client. |
| 142 Profile* profile_; | 145 Profile* profile_; |
| 143 | 146 |
| 144 // ProfileSyncService object associated with |profile_|. | 147 // ProfileSyncService object associated with |profile_|. |
| 145 ProfileSyncService* service_; | 148 browser_sync::ProfileSyncService* service_; |
| 146 | 149 |
| 147 // Prevents Sync from running until configuration is complete. | 150 // Prevents Sync from running until configuration is complete. |
| 148 std::unique_ptr<sync_driver::SyncSetupInProgressHandle> sync_blocker_; | 151 std::unique_ptr<sync_driver::SyncSetupInProgressHandle> sync_blocker_; |
| 149 | 152 |
| 150 // Credentials used for GAIA authentication. | 153 // Credentials used for GAIA authentication. |
| 151 std::string username_; | 154 std::string username_; |
| 152 std::string password_; | 155 std::string password_; |
| 153 | 156 |
| 154 // Used to decide what method of profile signin to use. | 157 // Used to decide what method of profile signin to use. |
| 155 const SigninType signin_type_; | 158 const SigninType signin_type_; |
| 156 | 159 |
| 157 // Number used by GenerateFakeOAuth2RefreshTokenString() to make sure that | 160 // Number used by GenerateFakeOAuth2RefreshTokenString() to make sure that |
| 158 // all refresh tokens used in the tests are different. | 161 // all refresh tokens used in the tests are different. |
| 159 int oauth2_refesh_token_number_; | 162 int oauth2_refesh_token_number_; |
| 160 | 163 |
| 161 // Used for logging. | 164 // Used for logging. |
| 162 const std::string profile_debug_name_; | 165 const std::string profile_debug_name_; |
| 163 | 166 |
| 164 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceHarness); | 167 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceHarness); |
| 165 }; | 168 }; |
| 166 | 169 |
| 167 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_PROFILE_SYNC_SERVICE_HARNESS_H_ | 170 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_PROFILE_SYNC_SERVICE_HARNESS_H_ |
| OLD | NEW |