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

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

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

Powered by Google App Engine
This is Rietveld 408576698