| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 LOG(ERROR) << "SetupSync(): service() is null."; | 154 LOG(ERROR) << "SetupSync(): service() is null."; |
| 155 return false; | 155 return false; |
| 156 } | 156 } |
| 157 | 157 |
| 158 // Tell the sync service that setup is in progress so we don't start syncing | 158 // Tell the sync service that setup is in progress so we don't start syncing |
| 159 // until we've finished configuration. | 159 // until we've finished configuration. |
| 160 service()->SetSetupInProgress(true); | 160 service()->SetSetupInProgress(true); |
| 161 | 161 |
| 162 DCHECK(!username_.empty()); | 162 DCHECK(!username_.empty()); |
| 163 if (signin_type_ == SigninType::UI_SIGNIN) { | 163 if (signin_type_ == SigninType::UI_SIGNIN) { |
| 164 Browser* browser = | 164 Browser* browser = chrome::FindBrowserWithProfile(profile_); |
| 165 FindBrowserWithProfile(profile_, chrome::GetActiveDesktop()); | |
| 166 DCHECK(browser); | 165 DCHECK(browser); |
| 167 if (!login_ui_test_utils::SignInWithUI(browser, username_, password_)) { | 166 if (!login_ui_test_utils::SignInWithUI(browser, username_, password_)) { |
| 168 LOG(ERROR) << "Could not sign in to GAIA servers."; | 167 LOG(ERROR) << "Could not sign in to GAIA servers."; |
| 169 return false; | 168 return false; |
| 170 } | 169 } |
| 171 } else if (signin_type_ == SigninType::FAKE_SIGNIN) { | 170 } else if (signin_type_ == SigninType::FAKE_SIGNIN) { |
| 172 // Authenticate sync client using GAIA credentials. | 171 // Authenticate sync client using GAIA credentials. |
| 173 std::string gaia_id = GetGaiaIdForUsername(username_); | 172 std::string gaia_id = GetGaiaIdForUsername(username_); |
| 174 service()->signin()->SetAuthenticatedAccountInfo(gaia_id, username_); | 173 service()->signin()->SetAuthenticatedAccountInfo(gaia_id, username_); |
| 175 std::string account_id = service()->signin()->GetAuthenticatedAccountId(); | 174 std::string account_id = service()->signin()->GetAuthenticatedAccountId(); |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 | 468 |
| 470 std::string ProfileSyncServiceHarness::GetServiceStatus() { | 469 std::string ProfileSyncServiceHarness::GetServiceStatus() { |
| 471 scoped_ptr<base::DictionaryValue> value( | 470 scoped_ptr<base::DictionaryValue> value( |
| 472 sync_driver::sync_ui_util::ConstructAboutInformation( | 471 sync_driver::sync_ui_util::ConstructAboutInformation( |
| 473 service(), service()->signin(), chrome::GetChannel())); | 472 service(), service()->signin(), chrome::GetChannel())); |
| 474 std::string service_status; | 473 std::string service_status; |
| 475 base::JSONWriter::WriteWithOptions( | 474 base::JSONWriter::WriteWithOptions( |
| 476 *value, base::JSONWriter::OPTIONS_PRETTY_PRINT, &service_status); | 475 *value, base::JSONWriter::OPTIONS_PRETTY_PRINT, &service_status); |
| 477 return service_status; | 476 return service_status; |
| 478 } | 477 } |
| OLD | NEW |