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/chromeos/login/fake_login_utils.h" | 5 #include "chrome/browser/chromeos/login/fake_login_utils.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 bool has_active_session, | 66 bool has_active_session, |
67 LoginUtils::Delegate* delegate) { | 67 LoginUtils::Delegate* delegate) { |
68 UserManager::Get()->UserLoggedIn( | 68 UserManager::Get()->UserLoggedIn( |
69 user_context.GetUserID(), user_context.GetUserIDHash(), false); | 69 user_context.GetUserID(), user_context.GetUserIDHash(), false); |
70 user_manager::User* user = | 70 user_manager::User* user = |
71 UserManager::Get()->FindUserAndModify(user_context.GetUserID()); | 71 UserManager::Get()->FindUserAndModify(user_context.GetUserID()); |
72 DCHECK(user); | 72 DCHECK(user); |
73 | 73 |
74 // Make sure that we get the real Profile instead of the login Profile. | 74 // Make sure that we get the real Profile instead of the login Profile. |
75 user->set_profile_is_created(); | 75 user->set_profile_is_created(); |
76 Profile* profile = ProfileHelper::Get()->GetProfileByUser(user); | 76 Profile* profile = ProfileHelper::Get()->GetProfileByUserUnsafe(user); |
77 profile->GetPrefs()->SetString(prefs::kGoogleServicesUsername, | 77 profile->GetPrefs()->SetString(prefs::kGoogleServicesUsername, |
78 user_context.GetUserID()); | 78 user_context.GetUserID()); |
79 | 79 |
80 if (UserManager::Get()->IsLoggedInAsSupervisedUser()) { | 80 if (UserManager::Get()->IsLoggedInAsSupervisedUser()) { |
81 user_manager::User* active_user = UserManager::Get()->GetActiveUser(); | 81 user_manager::User* active_user = UserManager::Get()->GetActiveUser(); |
82 std::string supervised_user_sync_id = | 82 std::string supervised_user_sync_id = |
83 UserManager::Get()->GetSupervisedUserManager()-> | 83 UserManager::Get()->GetSupervisedUserManager()-> |
84 GetUserSyncId(active_user->email()); | 84 GetUserSyncId(active_user->email()); |
85 if (supervised_user_sync_id.empty()) | 85 if (supervised_user_sync_id.empty()) |
86 supervised_user_sync_id = "DUMMY ID"; | 86 supervised_user_sync_id = "DUMMY ID"; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 118 |
119 void FakeLoginUtils::SetExpectedCredentials(const UserContext& user_context) { | 119 void FakeLoginUtils::SetExpectedCredentials(const UserContext& user_context) { |
120 expected_user_context_ = user_context; | 120 expected_user_context_ = user_context; |
121 if (authenticator_) { | 121 if (authenticator_) { |
122 static_cast<MockAuthenticator*>(authenticator_.get())-> | 122 static_cast<MockAuthenticator*>(authenticator_.get())-> |
123 SetExpectedCredentials(user_context); | 123 SetExpectedCredentials(user_context); |
124 } | 124 } |
125 } | 125 } |
126 | 126 |
127 } // namespace chromeos | 127 } // namespace chromeos |
OLD | NEW |