Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4400)

Unified Diff: chromeos/dbus/fake_auth_policy_client.cc

Issue 2673813003: Emulate StartAuthPolicyService from FakeUpstartClient (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chromeos/dbus/fake_auth_policy_client.cc
diff --git a/chromeos/dbus/fake_auth_policy_client.cc b/chromeos/dbus/fake_auth_policy_client.cc
index 08a46b2422c022c4de2715b2608d7fcb09ee0a84..89cddeff3d061f1c49e4f88ee1f6d29c185a3ad6 100644
--- a/chromeos/dbus/fake_auth_policy_client.cc
+++ b/chromeos/dbus/fake_auth_policy_client.cc
@@ -76,6 +76,11 @@ void FakeAuthPolicyClient::JoinAdDomain(const std::string& machine_name,
const std::string& user_principal_name,
int password_fd,
const JoinCallback& callback) {
+ if (!started) {
+ LOG(ERROR) << "authpolicyd not started";
+ callback.Run(authpolicy::ERROR_DBUS_FAILURE);
+ return;
+ }
if (machine_name.size() > kMaxMachineNameLength) {
callback.Run(authpolicy::ERROR_MACHINE_NAME_TOO_LONG);
return;
@@ -102,11 +107,21 @@ void FakeAuthPolicyClient::AuthenticateUser(
const std::string& user_principal_name,
int password_fd,
const AuthCallback& callback) {
+ if (!started) {
+ LOG(ERROR) << "authpolicyd not started";
+ callback.Run(authpolicy::ERROR_DBUS_FAILURE, std::string());
+ return;
+ }
callback.Run(authpolicy::ERROR_NONE, base::MD5String(user_principal_name));
}
void FakeAuthPolicyClient::RefreshDevicePolicy(
const RefreshPolicyCallback& callback) {
+ if (!started) {
+ LOG(ERROR) << "authpolicyd not started";
+ callback.Run(false);
+ return;
+ }
base::FilePath policy_path;
if (!PathService::Get(chromeos::FILE_OWNER_KEY, &policy_path)) {
callback.Run(false);
@@ -132,6 +147,11 @@ void FakeAuthPolicyClient::RefreshDevicePolicy(
void FakeAuthPolicyClient::RefreshUserPolicy(
const AccountId& account_id,
const RefreshPolicyCallback& callback) {
+ if (!started) {
+ LOG(ERROR) << "authpolicyd not started";
+ callback.Run(false);
+ return;
+ }
base::FilePath policy_path;
if (!PathService::Get(chromeos::DIR_USER_POLICY_KEYS, &policy_path)) {
callback.Run(false);

Powered by Google App Engine
This is Rietveld 408576698