| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chromeos/dbus/fake_auth_policy_client.h" | 5 #include "chromeos/dbus/fake_auth_policy_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 return; | 95 return; |
| 96 } | 96 } |
| 97 | 97 |
| 98 callback.Run(authpolicy::ERROR_NONE); | 98 callback.Run(authpolicy::ERROR_NONE); |
| 99 } | 99 } |
| 100 | 100 |
| 101 void FakeAuthPolicyClient::AuthenticateUser( | 101 void FakeAuthPolicyClient::AuthenticateUser( |
| 102 const std::string& user_principal_name, | 102 const std::string& user_principal_name, |
| 103 int password_fd, | 103 int password_fd, |
| 104 const AuthCallback& callback) { | 104 const AuthCallback& callback) { |
| 105 callback.Run(authpolicy::ERROR_NONE, base::MD5String(user_principal_name)); | 105 authpolicy::ActiveDirectoryAccountData account_data; |
| 106 account_data.set_account_id(base::MD5String(user_principal_name)); |
| 107 callback.Run(authpolicy::ERROR_NONE, account_data); |
| 106 } | 108 } |
| 107 | 109 |
| 108 void FakeAuthPolicyClient::RefreshDevicePolicy( | 110 void FakeAuthPolicyClient::RefreshDevicePolicy( |
| 109 const RefreshPolicyCallback& callback) { | 111 const RefreshPolicyCallback& callback) { |
| 110 base::FilePath policy_path; | 112 base::FilePath policy_path; |
| 111 if (!PathService::Get(chromeos::FILE_OWNER_KEY, &policy_path)) { | 113 if (!PathService::Get(chromeos::FILE_OWNER_KEY, &policy_path)) { |
| 112 callback.Run(false); | 114 callback.Run(false); |
| 113 return; | 115 return; |
| 114 } | 116 } |
| 115 policy_path = policy_path.DirName().AppendASCII("stub_device_policy"); | 117 policy_path = policy_path.DirName().AppendASCII("stub_device_policy"); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 .WithShutdownBehavior( | 156 .WithShutdownBehavior( |
| 155 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN) | 157 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN) |
| 156 .WithPriority(base::TaskPriority::BACKGROUND) | 158 .WithPriority(base::TaskPriority::BACKGROUND) |
| 157 .MayBlock(), | 159 .MayBlock(), |
| 158 base::Bind(&WritePolicyFile, policy_path, payload, | 160 base::Bind(&WritePolicyFile, policy_path, payload, |
| 159 "google/chromeos/user"), | 161 "google/chromeos/user"), |
| 160 callback); | 162 callback); |
| 161 } | 163 } |
| 162 | 164 |
| 163 } // namespace chromeos | 165 } // namespace chromeos |
| OLD | NEW |