Chromium Code Reviews| 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_ |