Chromium Code Reviews| 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) { | |
|
stevenjb
2017/07/17 16:07:37
override for all of these?
Thiemo Nagel
2017/07/18 13:02:18
Done.
| |
| 31 // 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().
| |
| 32 NOTIMPLEMENTED(); | |
| 33 } | |
|
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.
| |
| 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 NOTIMPLEMENTED(); | |
| 41 } | |
| 42 | |
| 43 void GetUserStatus(const std::string& object_guid, | |
| 44 GetUserStatusCallback callback) { | |
| 45 // Not implemented. | |
| 46 NOTIMPLEMENTED(); | |
| 47 } | |
| 48 | |
| 49 void RefreshDevicePolicy(RefreshPolicyCallback callback) { | |
| 50 // Not implemented. | |
| 51 NOTIMPLEMENTED(); | |
| 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 |