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

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

Issue 2044303004: Sync: Support multiple setup UIs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename variable Created 4 years, 6 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 <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 "sync/internal_api/public/base/model_type.h" 13 #include "sync/internal_api/public/base/model_type.h"
14 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" 14 #include "sync/internal_api/public/sessions/sync_session_snapshot.h"
15 15
16 class Profile; 16 class Profile;
17 class ProfileSyncService; 17 class ProfileSyncService;
18 18
19 namespace sync_driver {
20 class SyncSetupInProgressHandle;
21 }
22
19 // An instance of this class is basically our notion of a "sync client" for 23 // An instance of this class is basically our notion of a "sync client" for
20 // automation purposes. It harnesses the ProfileSyncService member of the 24 // automation purposes. It harnesses the ProfileSyncService member of the
21 // profile passed to it on construction and automates certain things like setup 25 // profile passed to it on construction and automates certain things like setup
22 // and authentication. It provides ways to "wait" adequate periods of time for 26 // and authentication. It provides ways to "wait" adequate periods of time for
23 // several clients to get to the same state. 27 // several clients to get to the same state.
24 class ProfileSyncServiceHarness { 28 class ProfileSyncServiceHarness {
25 public: 29 public:
26 // The type of profile signin method to authenticate a profile. 30 // The type of profile signin method to authenticate a profile.
27 enum class SigninType { 31 enum class SigninType {
28 // Fakes user signin process. 32 // Fakes user signin process.
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 115
112 // Returns a string that can be used as the value of an oauth2 refresh token. 116 // Returns a string that can be used as the value of an oauth2 refresh token.
113 // This function guarantees that a different string is returned each time 117 // This function guarantees that a different string is returned each time
114 // it is called. 118 // it is called.
115 std::string GenerateFakeOAuth2RefreshTokenString(); 119 std::string GenerateFakeOAuth2RefreshTokenString();
116 120
117 // Returns a string with relevant info about client's sync state (if 121 // Returns a string with relevant info about client's sync state (if
118 // available), annotated with |message|. Useful for logging. 122 // available), annotated with |message|. Useful for logging.
119 std::string GetClientInfoString(const std::string& message) const; 123 std::string GetClientInfoString(const std::string& message) const;
120 124
125 // Signals that sync setup is complete, and that PSS may begin syncing.
126 void FinishSyncSetup();
127
121 private: 128 private:
122 ProfileSyncServiceHarness( 129 ProfileSyncServiceHarness(
123 Profile* profile, 130 Profile* profile,
124 const std::string& username, 131 const std::string& username,
125 const std::string& password, 132 const std::string& password,
126 SigninType signin_type); 133 SigninType signin_type);
127 134
128 // Signals that sync setup is complete, and that PSS may begin syncing.
129 void FinishSyncSetup();
130
131 // Gets detailed status from |service_| in pretty-printable form. 135 // Gets detailed status from |service_| in pretty-printable form.
132 std::string GetServiceStatus(); 136 std::string GetServiceStatus();
133 137
134 // Returns true if sync is disabled for this client. 138 // Returns true if sync is disabled for this client.
135 bool IsSyncDisabled() const; 139 bool IsSyncDisabled() const;
136 140
137 // Sync profile associated with this sync client. 141 // Sync profile associated with this sync client.
138 Profile* profile_; 142 Profile* profile_;
139 143
140 // ProfileSyncService object associated with |profile_|. 144 // ProfileSyncService object associated with |profile_|.
141 ProfileSyncService* service_; 145 ProfileSyncService* service_;
142 146
147 // Prevents Sync from running until configuration is complete.
148 std::unique_ptr<sync_driver::SyncSetupInProgressHandle> sync_blocker_;
149
143 // Credentials used for GAIA authentication. 150 // Credentials used for GAIA authentication.
144 std::string username_; 151 std::string username_;
145 std::string password_; 152 std::string password_;
146 153
147 // Used to decide what method of profile signin to use. 154 // Used to decide what method of profile signin to use.
148 const SigninType signin_type_; 155 const SigninType signin_type_;
149 156
150 // Number used by GenerateFakeOAuth2RefreshTokenString() to make sure that 157 // Number used by GenerateFakeOAuth2RefreshTokenString() to make sure that
151 // all refresh tokens used in the tests are different. 158 // all refresh tokens used in the tests are different.
152 int oauth2_refesh_token_number_; 159 int oauth2_refesh_token_number_;
153 160
154 // Used for logging. 161 // Used for logging.
155 const std::string profile_debug_name_; 162 const std::string profile_debug_name_;
156 163
157 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceHarness); 164 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceHarness);
158 }; 165 };
159 166
160 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_PROFILE_SYNC_SERVICE_HARNESS_H_ 167 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_PROFILE_SYNC_SERVICE_HARNESS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698