| 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 15 matching lines...) Expand all Loading... |
| 26 #include "chrome/common/pref_names.h" | 26 #include "chrome/common/pref_names.h" |
| 27 #include "components/invalidation/p2p_invalidation_service.h" | 27 #include "components/invalidation/p2p_invalidation_service.h" |
| 28 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 28 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 29 #include "components/signin/core/browser/signin_manager_base.h" | 29 #include "components/signin/core/browser/signin_manager_base.h" |
| 30 #include "components/sync_driver/data_type_controller.h" | 30 #include "components/sync_driver/data_type_controller.h" |
| 31 #include "google_apis/gaia/gaia_constants.h" | 31 #include "google_apis/gaia/gaia_constants.h" |
| 32 #include "sync/internal_api/public/base/progress_marker_map.h" | 32 #include "sync/internal_api/public/base/progress_marker_map.h" |
| 33 #include "sync/internal_api/public/util/sync_string_conversions.h" | 33 #include "sync/internal_api/public/util/sync_string_conversions.h" |
| 34 | 34 |
| 35 #if defined(ENABLE_MANAGED_USERS) | 35 #if defined(ENABLE_MANAGED_USERS) |
| 36 #include "chrome/browser/managed_mode/managed_user_constants.h" | 36 #include "chrome/browser/supervised_user/supervised_user_constants.h" |
| 37 #endif | 37 #endif |
| 38 | 38 |
| 39 using syncer::sessions::SyncSessionSnapshot; | 39 using syncer::sessions::SyncSessionSnapshot; |
| 40 | 40 |
| 41 namespace { | 41 namespace { |
| 42 | 42 |
| 43 bool HasAuthError(ProfileSyncService* service) { | 43 bool HasAuthError(ProfileSyncService* service) { |
| 44 return service->GetAuthError().state() == | 44 return service->GetAuthError().state() == |
| 45 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS || | 45 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS || |
| 46 service->GetAuthError().state() == | 46 service->GetAuthError().state() == |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 // Tell the sync service that setup is in progress so we don't start syncing | 155 // Tell the sync service that setup is in progress so we don't start syncing |
| 156 // until we've finished configuration. | 156 // until we've finished configuration. |
| 157 service()->SetSetupInProgress(true); | 157 service()->SetSetupInProgress(true); |
| 158 | 158 |
| 159 // Authenticate sync client using GAIA credentials. | 159 // Authenticate sync client using GAIA credentials. |
| 160 service()->signin()->SetAuthenticatedUsername(username_); | 160 service()->signin()->SetAuthenticatedUsername(username_); |
| 161 service()->GoogleSigninSucceeded(username_, password_); | 161 service()->GoogleSigninSucceeded(username_, password_); |
| 162 | 162 |
| 163 #if defined(ENABLE_MANAGED_USERS) | 163 #if defined(ENABLE_MANAGED_USERS) |
| 164 std::string account_id = profile_->IsSupervised() ? | 164 std::string account_id = profile_->IsSupervised() ? |
| 165 managed_users::kManagedUserPseudoEmail : username_; | 165 supervised_users::kSupervisedUserPseudoEmail : username_; |
| 166 #else | 166 #else |
| 167 std::string account_id = username_; | 167 std::string account_id = username_; |
| 168 #endif | 168 #endif |
| 169 DCHECK(!account_id.empty()); | 169 DCHECK(!account_id.empty()); |
| 170 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)-> | 170 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)-> |
| 171 UpdateCredentials(account_id, GenerateFakeOAuth2RefreshTokenString()); | 171 UpdateCredentials(account_id, GenerateFakeOAuth2RefreshTokenString()); |
| 172 | 172 |
| 173 // Wait for the OnBackendInitialized() callback. | 173 // Wait for the OnBackendInitialized() callback. |
| 174 BackendInitializeChecker checker(service()); | 174 BackendInitializeChecker checker(service()); |
| 175 checker.Wait(); | 175 checker.Wait(); |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 | 441 |
| 442 std::string ProfileSyncServiceHarness::GetServiceStatus() { | 442 std::string ProfileSyncServiceHarness::GetServiceStatus() { |
| 443 scoped_ptr<base::DictionaryValue> value( | 443 scoped_ptr<base::DictionaryValue> value( |
| 444 sync_ui_util::ConstructAboutInformation(service())); | 444 sync_ui_util::ConstructAboutInformation(service())); |
| 445 std::string service_status; | 445 std::string service_status; |
| 446 base::JSONWriter::WriteWithOptions(value.get(), | 446 base::JSONWriter::WriteWithOptions(value.get(), |
| 447 base::JSONWriter::OPTIONS_PRETTY_PRINT, | 447 base::JSONWriter::OPTIONS_PRETTY_PRINT, |
| 448 &service_status); | 448 &service_status); |
| 449 return service_status; | 449 return service_status; |
| 450 } | 450 } |
| OLD | NEW |