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