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

Unified Diff: chromeos/dbus/fake_auth_policy_client.cc

Issue 2673813003: Emulate StartAuthPolicyService from FakeUpstartClient (Closed)
Patch Set: rebase 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
« no previous file with comments | « chromeos/dbus/fake_auth_policy_client.h ('k') | chromeos/dbus/fake_auth_policy_client_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5329b36c43ab02ea8866e4f0f8d7a20b63b42c91..819105fb7921ee0ddfc1c363945d0a55bb02a8a4 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;
@@ -103,12 +108,22 @@ void FakeAuthPolicyClient::AuthenticateUser(
int password_fd,
const AuthCallback& callback) {
authpolicy::ActiveDirectoryAccountData account_data;
+ if (!started_) {
+ LOG(ERROR) << "authpolicyd not started";
+ callback.Run(authpolicy::ERROR_DBUS_FAILURE, account_data);
+ return;
+ }
account_data.set_account_id(base::MD5String(user_principal_name));
callback.Run(authpolicy::ERROR_NONE, account_data);
}
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);
@@ -134,6 +149,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);
« no previous file with comments | « chromeos/dbus/fake_auth_policy_client.h ('k') | chromeos/dbus/fake_auth_policy_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698