OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROMEOS_DBUS_MOCK_AUTH_POLICY_CLIENT_H_ |
| 6 #define CHROMEOS_DBUS_MOCK_AUTH_POLICY_CLIENT_H_ |
| 7 |
| 8 #include "chromeos/dbus/auth_policy_client.h" |
| 9 |
| 10 #include <string> |
| 11 |
| 12 #include "base/logging.h" |
| 13 #include "base/threading/thread_task_runner_handle.h" |
| 14 #include "testing/gmock/include/gmock/gmock.h" |
| 15 |
| 16 class AccountId; |
| 17 |
| 18 namespace chromeos { |
| 19 |
| 20 class MockAuthPolicyClient : public AuthPolicyClient { |
| 21 public: |
| 22 MockAuthPolicyClient(); |
| 23 virtual ~MockAuthPolicyClient(); |
| 24 |
| 25 MOCK_METHOD1(Init, void(dbus::Bus* bus)); |
| 26 |
| 27 void JoinAdDomain(const std::string& machine_name, |
| 28 const std::string& user_principal_name, |
| 29 int password_fd, |
| 30 JoinCallback callback) { |
| 31 // Not implemented. |
| 32 NOTREACHED(); |
| 33 } |
| 34 |
| 35 void AuthenticateUser(const std::string& user_principal_name, |
| 36 const std::string& object_guid, |
| 37 int password_fd, |
| 38 AuthCallback callback) { |
| 39 // Not implemented. |
| 40 NOTREACHED(); |
| 41 } |
| 42 |
| 43 void GetUserStatus(const std::string& object_guid, |
| 44 GetUserStatusCallback callback) { |
| 45 // Not implemented. |
| 46 NOTREACHED(); |
| 47 } |
| 48 |
| 49 void RefreshDevicePolicy(RefreshPolicyCallback callback) { |
| 50 // Not implemented. |
| 51 NOTREACHED(); |
| 52 } |
| 53 |
| 54 void RefreshUserPolicy(const AccountId& account_id, |
| 55 RefreshPolicyCallback callback) override { |
| 56 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 57 FROM_HERE, base::BindOnce(std::move(callback), |
| 58 refresh_user_policy_callback_success_)); |
| 59 } |
| 60 |
| 61 void SetRefreshUserPolicyCallbackSuccess(bool success) { |
| 62 refresh_user_policy_callback_success_ = success; |
| 63 } |
| 64 |
| 65 private: |
| 66 bool refresh_user_policy_callback_success_ = true; |
| 67 }; |
| 68 |
| 69 } // namespace chromeos |
| 70 |
| 71 #endif // CHROMEOS_DBUS_MOCK_AUTH_POLICY_CLIENT_H_ |
OLD | NEW |