| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/chromeos/login/auth/mock_authenticator.h" | 10 #include "chrome/browser/chromeos/login/auth/mock_authenticator.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 user_context.GetUserID(), user_context.GetUserIDHash(), false); | 63 user_context.GetUserID(), user_context.GetUserIDHash(), false); |
| 64 User* user = UserManager::Get()->FindUserAndModify(user_context.GetUserID()); | 64 User* user = UserManager::Get()->FindUserAndModify(user_context.GetUserID()); |
| 65 DCHECK(user); | 65 DCHECK(user); |
| 66 | 66 |
| 67 // Make sure that we get the real Profile instead of the login Profile. | 67 // Make sure that we get the real Profile instead of the login Profile. |
| 68 user->set_profile_is_created(); | 68 user->set_profile_is_created(); |
| 69 Profile* profile = ProfileHelper::Get()->GetProfileByUser(user); | 69 Profile* profile = ProfileHelper::Get()->GetProfileByUser(user); |
| 70 profile->GetPrefs()->SetString(prefs::kGoogleServicesUsername, | 70 profile->GetPrefs()->SetString(prefs::kGoogleServicesUsername, |
| 71 user_context.GetUserID()); | 71 user_context.GetUserID()); |
| 72 | 72 |
| 73 if (UserManager::Get()->IsLoggedInAsLocallyManagedUser()) { | 73 if (UserManager::Get()->IsLoggedInAsSupervisedUser()) { |
| 74 User* active_user = UserManager::Get()->GetActiveUser(); | 74 User* active_user = UserManager::Get()->GetActiveUser(); |
| 75 std::string supervised_user_sync_id = | 75 std::string supervised_user_sync_id = |
| 76 UserManager::Get()->GetSupervisedUserManager()-> | 76 UserManager::Get()->GetSupervisedUserManager()-> |
| 77 GetUserSyncId(active_user->email()); | 77 GetUserSyncId(active_user->email()); |
| 78 if (supervised_user_sync_id.empty()) | 78 if (supervised_user_sync_id.empty()) |
| 79 supervised_user_sync_id = "DUMMY ID"; | 79 supervised_user_sync_id = "DUMMY ID"; |
| 80 profile->GetPrefs()->SetString(prefs::kSupervisedUserId, | 80 profile->GetPrefs()->SetString(prefs::kSupervisedUserId, |
| 81 supervised_user_sync_id); | 81 supervised_user_sync_id); |
| 82 } | 82 } |
| 83 | 83 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 111 | 111 |
| 112 void FakeLoginUtils::SetExpectedCredentials(const UserContext& user_context) { | 112 void FakeLoginUtils::SetExpectedCredentials(const UserContext& user_context) { |
| 113 expected_user_context_ = user_context; | 113 expected_user_context_ = user_context; |
| 114 if (authenticator_) { | 114 if (authenticator_) { |
| 115 static_cast<MockAuthenticator*>(authenticator_.get())-> | 115 static_cast<MockAuthenticator*>(authenticator_.get())-> |
| 116 SetExpectedCredentials(user_context); | 116 SetExpectedCredentials(user_context); |
| 117 } | 117 } |
| 118 } | 118 } |
| 119 | 119 |
| 120 } // namespace chromeos | 120 } // namespace chromeos |
| OLD | NEW |