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 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 for (const auto& user_affiliation_id : user_affiliation_ids) { | 92 for (const auto& user_affiliation_id : user_affiliation_ids) { |
93 user_policy->policy_data().add_user_affiliation_ids(user_affiliation_id); | 93 user_policy->policy_data().add_user_affiliation_ids(user_affiliation_id); |
94 } | 94 } |
95 user_policy->Build(); | 95 user_policy->Build(); |
96 fake_session_manager_client->set_user_policy( | 96 fake_session_manager_client->set_user_policy( |
97 cryptohome::Identification(account_id), user_policy->GetBlob()); | 97 cryptohome::Identification(account_id), user_policy->GetBlob()); |
98 } | 98 } |
99 | 99 |
100 void PreLoginUser(const std::string& user_id) { | 100 void PreLoginUser(const std::string& user_id) { |
101 ListPrefUpdate users_pref(g_browser_process->local_state(), "LoggedInUsers"); | 101 ListPrefUpdate users_pref(g_browser_process->local_state(), "LoggedInUsers"); |
102 users_pref->AppendIfNotPresent(base::MakeUnique<base::StringValue>(user_id)); | 102 users_pref->AppendIfNotPresent(base::MakeUnique<base::Value>(user_id)); |
103 chromeos::StartupUtils::MarkOobeCompleted(); | 103 chromeos::StartupUtils::MarkOobeCompleted(); |
104 } | 104 } |
105 | 105 |
106 void LoginUser(const std::string& user_id) { | 106 void LoginUser(const std::string& user_id) { |
107 chromeos::test::UserSessionManagerTestApi session_manager_test_api( | 107 chromeos::test::UserSessionManagerTestApi session_manager_test_api( |
108 chromeos::UserSessionManager::GetInstance()); | 108 chromeos::UserSessionManager::GetInstance()); |
109 session_manager_test_api.SetShouldObtainTokenHandleInTests(false); | 109 session_manager_test_api.SetShouldObtainTokenHandleInTests(false); |
110 | 110 |
111 chromeos::UserContext user_context( | 111 chromeos::UserContext user_context( |
112 AccountId::FromUserEmailGaiaId(user_id, "gaia-id-" + user_id)); | 112 AccountId::FromUserEmailGaiaId(user_id, "gaia-id-" + user_id)); |
(...skipping 26 matching lines...) Expand all Loading... |
139 // LoginManager tests typically don't stand up a policy test server but | 139 // LoginManager tests typically don't stand up a policy test server but |
140 // instead inject policies directly through a SessionManagerClient. So allow | 140 // instead inject policies directly through a SessionManagerClient. So allow |
141 // policy fetches to fail - this is expected. | 141 // policy fetches to fail - this is expected. |
142 command_line->AppendSwitch( | 142 command_line->AppendSwitch( |
143 chromeos::switches::kAllowFailedPolicyFetchForTest); | 143 chromeos::switches::kAllowFailedPolicyFetchForTest); |
144 } | 144 } |
145 | 145 |
146 } // namespace affiliation_test_helper | 146 } // namespace affiliation_test_helper |
147 | 147 |
148 } // namespace policy | 148 } // namespace policy |
OLD | NEW |