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 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" | 5 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <ostream> | 9 #include <ostream> |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
148 // Initialize the sync client's profile sync service object. | 148 // Initialize the sync client's profile sync service object. |
149 if (service() == NULL) { | 149 if (service() == NULL) { |
150 LOG(ERROR) << "SetupSync(): service() is null."; | 150 LOG(ERROR) << "SetupSync(): service() is null."; |
151 return false; | 151 return false; |
152 } | 152 } |
153 | 153 |
154 // Tell the sync service that setup is in progress so we don't start syncing | 154 // Tell the sync service that setup is in progress so we don't start syncing |
155 // until we've finished configuration. | 155 // until we've finished configuration. |
156 service()->SetSetupInProgress(true); | 156 service()->SetSetupInProgress(true); |
157 | 157 |
158 // Authenticate sync client using GAIA credentials. | |
159 service()->signin()->SetAuthenticatedAccountInfo(username_, username_); | |
Nicolas Zea
2015/04/10 20:15:29
user id instead of username for first param? (here
Roger Tawa OOO till Jul 10th
2015/04/11 00:23:08
Done, and did some cleanup as well for some apis t
| |
160 service()->GoogleSigninSucceeded(username_, username_, password_); | |
161 | |
158 DCHECK(!username_.empty()); | 162 DCHECK(!username_.empty()); |
159 if (signin_type_ == SigninType::UI_SIGNIN) { | 163 if (signin_type_ == SigninType::UI_SIGNIN) { |
160 Browser* browser = | 164 Browser* browser = |
161 FindBrowserWithProfile(profile_, chrome::GetActiveDesktop()); | 165 FindBrowserWithProfile(profile_, chrome::GetActiveDesktop()); |
162 DCHECK(browser); | 166 DCHECK(browser); |
163 if (!login_ui_test_utils::SignInWithUI(browser, username_, password_)) { | 167 if (!login_ui_test_utils::SignInWithUI(browser, username_, password_)) { |
164 LOG(ERROR) << "Could not sign in to GAIA servers."; | 168 LOG(ERROR) << "Could not sign in to GAIA servers."; |
165 return false; | 169 return false; |
166 } | 170 } |
167 } else if (signin_type_ == SigninType::FAKE_SIGNIN) { | 171 } else if (signin_type_ == SigninType::FAKE_SIGNIN) { |
168 // Authenticate sync client using GAIA credentials. | 172 // Authenticate sync client using GAIA credentials. |
169 service()->signin()->SetAuthenticatedUsername(username_); | 173 service()->signin()->SetAuthenticatedAccountInfo(username_, username_); |
170 service()->GoogleSigninSucceeded(username_, username_, password_); | 174 service()->GoogleSigninSucceeded(username_, username_, password_); |
171 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)-> | 175 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)-> |
172 UpdateCredentials(username_, GenerateFakeOAuth2RefreshTokenString()); | 176 UpdateCredentials(username_, GenerateFakeOAuth2RefreshTokenString()); |
173 } else { | 177 } else { |
174 LOG(ERROR) << "Unsupported profile signin type."; | 178 LOG(ERROR) << "Unsupported profile signin type."; |
175 } | 179 } |
176 | 180 |
177 if (!AwaitBackendInitialization()) { | 181 if (!AwaitBackendInitialization()) { |
178 return false; | 182 return false; |
179 } | 183 } |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
461 | 465 |
462 std::string ProfileSyncServiceHarness::GetServiceStatus() { | 466 std::string ProfileSyncServiceHarness::GetServiceStatus() { |
463 scoped_ptr<base::DictionaryValue> value( | 467 scoped_ptr<base::DictionaryValue> value( |
464 sync_ui_util::ConstructAboutInformation(service())); | 468 sync_ui_util::ConstructAboutInformation(service())); |
465 std::string service_status; | 469 std::string service_status; |
466 base::JSONWriter::WriteWithOptions(value.get(), | 470 base::JSONWriter::WriteWithOptions(value.get(), |
467 base::JSONWriter::OPTIONS_PRETTY_PRINT, | 471 base::JSONWriter::OPTIONS_PRETTY_PRINT, |
468 &service_status); | 472 &service_status); |
469 return service_status; | 473 return service_status; |
470 } | 474 } |
OLD | NEW |