OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "chrome/browser/chromeos/policy/affiliation_test_helper.h" | 4 #include "chrome/browser/chromeos/policy/affiliation_test_helper.h" |
5 | 5 |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 ListPrefUpdate users_pref(g_browser_process->local_state(), "LoggedInUsers"); | 98 ListPrefUpdate users_pref(g_browser_process->local_state(), "LoggedInUsers"); |
99 users_pref->AppendIfNotPresent(new base::StringValue(user_id)); | 99 users_pref->AppendIfNotPresent(new base::StringValue(user_id)); |
100 chromeos::StartupUtils::MarkOobeCompleted(); | 100 chromeos::StartupUtils::MarkOobeCompleted(); |
101 } | 101 } |
102 | 102 |
103 void LoginUser(const std::string& user_id) { | 103 void LoginUser(const std::string& user_id) { |
104 chromeos::test::UserSessionManagerTestApi session_manager_test_api( | 104 chromeos::test::UserSessionManagerTestApi session_manager_test_api( |
105 chromeos::UserSessionManager::GetInstance()); | 105 chromeos::UserSessionManager::GetInstance()); |
106 session_manager_test_api.SetShouldObtainTokenHandleInTests(false); | 106 session_manager_test_api.SetShouldObtainTokenHandleInTests(false); |
107 | 107 |
108 chromeos::UserContext user_context(AccountId::FromUserEmail(user_id)); | 108 chromeos::UserContext user_context( |
109 user_context.SetGaiaID("gaia-id-" + user_id); | 109 AccountId::FromUserEmailGaiaId(user_id, "gaia-id-" + user_id)); |
110 user_context.SetKey(chromeos::Key("password")); | 110 user_context.SetKey(chromeos::Key("password")); |
111 if (user_id == kEnterpriseUser) { | 111 if (user_id == kEnterpriseUser) { |
112 user_context.SetRefreshToken(kFakeRefreshToken); | 112 user_context.SetRefreshToken(kFakeRefreshToken); |
113 } | 113 } |
114 chromeos::ExistingUserController* controller = | 114 chromeos::ExistingUserController* controller = |
115 chromeos::ExistingUserController::current_controller(); | 115 chromeos::ExistingUserController::current_controller(); |
116 CHECK(controller); | 116 CHECK(controller); |
117 content::WindowedNotificationObserver observer( | 117 content::WindowedNotificationObserver observer( |
118 chrome::NOTIFICATION_SESSION_STARTED, | 118 chrome::NOTIFICATION_SESSION_STARTED, |
119 content::NotificationService::AllSources()); | 119 content::NotificationService::AllSources()); |
(...skipping 11 matching lines...) Expand all Loading... |
131 } | 131 } |
132 | 132 |
133 void AppendCommandLineSwitchesForLoginManager(base::CommandLine* command_line) { | 133 void AppendCommandLineSwitchesForLoginManager(base::CommandLine* command_line) { |
134 command_line->AppendSwitch(chromeos::switches::kLoginManager); | 134 command_line->AppendSwitch(chromeos::switches::kLoginManager); |
135 command_line->AppendSwitch(chromeos::switches::kForceLoginManagerInTests); | 135 command_line->AppendSwitch(chromeos::switches::kForceLoginManagerInTests); |
136 } | 136 } |
137 | 137 |
138 } // namespace affiliation_test_helper | 138 } // namespace affiliation_test_helper |
139 | 139 |
140 } // namespace policy | 140 } // namespace policy |
OLD | NEW |