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

Unified Diff: chromeos/dbus/mock_auth_policy_client.h

Issue 2954293002: Chromad: Prevent session from starting without policy (Closed)
Patch Set: Address nits Created 3 years, 5 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/mock_auth_policy_client.h
diff --git a/chromeos/dbus/mock_auth_policy_client.h b/chromeos/dbus/mock_auth_policy_client.h
new file mode 100644
index 0000000000000000000000000000000000000000..43eb321095870d251e594c2821cbf0c7c55f0060
--- /dev/null
+++ b/chromeos/dbus/mock_auth_policy_client.h
@@ -0,0 +1,71 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROMEOS_DBUS_MOCK_AUTH_POLICY_CLIENT_H_
+#define CHROMEOS_DBUS_MOCK_AUTH_POLICY_CLIENT_H_
+
+#include "chromeos/dbus/auth_policy_client.h"
+
+#include <string>
+
+#include "base/logging.h"
+#include "base/threading/thread_task_runner_handle.h"
+#include "testing/gmock/include/gmock/gmock.h"
+
+class AccountId;
+
+namespace chromeos {
+
+class MockAuthPolicyClient : public AuthPolicyClient {
+ public:
+ MockAuthPolicyClient();
+ virtual ~MockAuthPolicyClient();
+
+ MOCK_METHOD1(Init, void(dbus::Bus* bus));
+
+ void JoinAdDomain(const std::string& machine_name,
+ const std::string& user_principal_name,
+ int password_fd,
+ JoinCallback callback) {
stevenjb 2017/07/17 16:07:37 override for all of these?
Thiemo Nagel 2017/07/18 13:02:18 Done.
+ // Not implemented.
stevenjb 2017/07/17 16:07:37 Comment not really helpful :) (here and below)
Thiemo Nagel 2017/07/18 13:02:18 Good point. :) That used to be NOTREACHED().
+ NOTIMPLEMENTED();
+ }
stevenjb 2017/07/17 16:07:37 This isn't really a mock, it's closer to a Fake. W
Thiemo Nagel 2017/07/18 13:02:18 There is already a FakeAuthPolicyClient which is s
stevenjb 2017/07/18 15:37:44 Hmm. In that case, if this is only used in one tes
Thiemo Nagel 2017/07/18 16:03:32 Thanks, done.
+
+ void AuthenticateUser(const std::string& user_principal_name,
+ const std::string& object_guid,
+ int password_fd,
+ AuthCallback callback) {
+ // Not implemented.
+ NOTIMPLEMENTED();
+ }
+
+ void GetUserStatus(const std::string& object_guid,
+ GetUserStatusCallback callback) {
+ // Not implemented.
+ NOTIMPLEMENTED();
+ }
+
+ void RefreshDevicePolicy(RefreshPolicyCallback callback) {
+ // Not implemented.
+ NOTIMPLEMENTED();
+ }
+
+ void RefreshUserPolicy(const AccountId& account_id,
+ RefreshPolicyCallback callback) override {
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::BindOnce(std::move(callback),
+ refresh_user_policy_callback_success_));
+ }
+
+ void SetRefreshUserPolicyCallbackSuccess(bool success) {
+ refresh_user_policy_callback_success_ = success;
+ }
+
+ private:
+ bool refresh_user_policy_callback_success_ = true;
+};
+
+} // namespace chromeos
+
+#endif // CHROMEOS_DBUS_MOCK_AUTH_POLICY_CLIENT_H_

Powered by Google App Engine
This is Rietveld 408576698