Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(436)

Side by Side Diff: chrome/browser/sync/test/integration/profile_sync_service_harness.h

Issue 2388163002: [Sync] Move //components/sync to the syncer namespace, take 2. (Closed)
Patch Set: Rebase. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "components/sync/base/model_type.h" 14 #include "components/sync/base/model_type.h"
15 #include "components/sync/engine/cycle/sync_cycle_snapshot.h" 15 #include "components/sync/engine/cycle/sync_cycle_snapshot.h"
16 16
17 class Profile; 17 class Profile;
18 18
19 namespace browser_sync { 19 namespace browser_sync {
20 class ProfileSyncService; 20 class ProfileSyncService;
21 } // namespace browser_sync 21 } // namespace browser_sync
22 22
23 namespace sync_driver { 23 namespace syncer {
24 class SyncSetupInProgressHandle; 24 class SyncSetupInProgressHandle;
25 } // namespace sync_driver 25 } // namespace syncer
26 26
27 // 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
28 // automation purposes. It harnesses the ProfileSyncService member of the 28 // automation purposes. It harnesses the ProfileSyncService member of the
29 // 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
30 // 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
31 // several clients to get to the same state. 31 // several clients to get to the same state.
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 {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 static bool AwaitQuiescence( 82 static bool AwaitQuiescence(
83 const std::vector<ProfileSyncServiceHarness*>& clients); 83 const std::vector<ProfileSyncServiceHarness*>& clients);
84 84
85 // 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
86 // (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
87 // initialized successfully. See ProfileSyncService's IsBackendInitialized() 87 // initialized successfully. See ProfileSyncService's IsBackendInitialized()
88 // method for the definition of backend initialization. 88 // method for the definition of backend initialization.
89 bool AwaitBackendInitialization(); 89 bool AwaitBackendInitialization();
90 90
91 // 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
92 // if sync setup completed successfully. See sync_driver::SyncService's 92 // if sync setup completed successfully. See syncer::SyncService's
93 // IsSyncActive() method for the definition of what successful means here. 93 // IsSyncActive() method for the definition of what successful means here.
94 bool AwaitSyncSetupCompletion(); 94 bool AwaitSyncSetupCompletion();
95 95
96 // Returns the ProfileSyncService member of the sync client. 96 // Returns the ProfileSyncService member of the sync client.
97 browser_sync::ProfileSyncService* service() const { return service_; } 97 browser_sync::ProfileSyncService* service() const { return service_; }
98 98
99 // Returns the debug name for this profile. Used for logging. 99 // Returns the debug name for this profile. Used for logging.
100 const std::string& profile_debug_name() const { return profile_debug_name_; } 100 const std::string& profile_debug_name() const { return profile_debug_name_; }
101 101
102 // 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
142 // Returns true if sync is disabled for this client. 142 // Returns true if sync is disabled for this client.
143 bool IsSyncDisabled() const; 143 bool IsSyncDisabled() const;
144 144
145 // Sync profile associated with this sync client. 145 // Sync profile associated with this sync client.
146 Profile* profile_; 146 Profile* profile_;
147 147
148 // ProfileSyncService object associated with |profile_|. 148 // ProfileSyncService object associated with |profile_|.
149 browser_sync::ProfileSyncService* service_; 149 browser_sync::ProfileSyncService* service_;
150 150
151 // Prevents Sync from running until configuration is complete. 151 // Prevents Sync from running until configuration is complete.
152 std::unique_ptr<sync_driver::SyncSetupInProgressHandle> sync_blocker_; 152 std::unique_ptr<syncer::SyncSetupInProgressHandle> sync_blocker_;
153 153
154 // Credentials used for GAIA authentication. 154 // Credentials used for GAIA authentication.
155 std::string username_; 155 std::string username_;
156 std::string password_; 156 std::string password_;
157 157
158 // Used to decide what method of profile signin to use. 158 // Used to decide what method of profile signin to use.
159 const SigninType signin_type_; 159 const SigninType signin_type_;
160 160
161 // Number used by GenerateFakeOAuth2RefreshTokenString() to make sure that 161 // Number used by GenerateFakeOAuth2RefreshTokenString() to make sure that
162 // all refresh tokens used in the tests are different. 162 // all refresh tokens used in the tests are different.
163 int oauth2_refesh_token_number_; 163 int oauth2_refesh_token_number_;
164 164
165 // Used for logging. 165 // Used for logging.
166 const std::string profile_debug_name_; 166 const std::string profile_debug_name_;
167 167
168 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceHarness); 168 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceHarness);
169 }; 169 };
170 170
171 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_PROFILE_SYNC_SERVICE_HARNESS_H_ 171 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_PROFILE_SYNC_SERVICE_HARNESS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698