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

Unified Diff: chrome/browser/sync/profile_sync_service_harness.cc

Issue 60733019: This is the third CL of several that will eventually replace TokenService with (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/profile_sync_service_harness.cc
diff --git a/chrome/browser/sync/profile_sync_service_harness.cc b/chrome/browser/sync/profile_sync_service_harness.cc
index 287b27c6573af4e4c7172a70327185d4fec62d71..b7a1c943093a74392a95e2277c7d1d723aeaea4f 100644
--- a/chrome/browser/sync/profile_sync_service_harness.cc
+++ b/chrome/browser/sync/profile_sync_service_harness.cc
@@ -25,9 +25,9 @@
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/invalidation/p2p_invalidation_service.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/signin/profile_oauth2_token_service.h"
+#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/signin/signin_manager_base.h"
-#include "chrome/browser/signin/token_service.h"
-#include "chrome/browser/signin/token_service_factory.h"
#include "chrome/browser/sync/about_sync_util.h"
#include "chrome/browser/sync/glue/data_type_controller.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
@@ -39,6 +39,10 @@
#include "sync/internal_api/public/sessions/sync_session_snapshot.h"
#include "sync/internal_api/public/util/sync_string_conversions.h"
+#if defined(ENABLE_MANAGED_USERS)
+#include "chrome/browser/managed_mode/managed_user_constants.h"
+#endif
+
using syncer::sessions::SyncSessionSnapshot;
using invalidation::P2PInvalidationService;
@@ -209,9 +213,16 @@ bool ProfileSyncServiceHarness::SetupSync(
chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL,
content::Source<Profile>(profile_),
content::Details<const GoogleServiceSigninSuccessDetails>(&details));
- TokenServiceFactory::GetForProfile(profile_)->IssueAuthTokenForTest(
- GaiaConstants::kGaiaOAuth2LoginRefreshToken,
- GenerateFakeOAuth2RefreshTokenString());
+
+#if defined(ENABLE_MANAGED_USERS)
+ std::string account_id = profile_->IsManaged() ?
+ managed_users::kManagedUserPseudoEmail : username_;
+#else
+ std::string account_id = username_;
+#endif
+ DCHECK(!account_id.empty());
+ ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)->
+ UpdateCredentials(account_id, GenerateFakeOAuth2RefreshTokenString());
// Wait for the OnBackendInitialized() callback.
if (!AwaitBackendInitialized()) {

Powered by Google App Engine
This is Rietveld 408576698