| // Copyright 2015 The Chromium OS Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #include "tpm_manager/common/mock_tpm_ownership_interface.h" |
| |
| using testing::_; |
| using testing::Invoke; |
| using testing::WithArgs; |
| |
| namespace { |
| |
| template <typename ReplyProtoType> |
| void RunCallback(const base::Callback<void(const ReplyProtoType&)>& callback) { |
| ReplyProtoType empty_proto; |
| callback.Run(empty_proto); |
| } |
| |
| } // namespace |
| |
| namespace tpm_manager { |
| |
| MockTpmOwnershipInterface::MockTpmOwnershipInterface() { |
| ON_CALL(*this, GetTpmStatus(_, _)) |
| .WillByDefault(WithArgs<1>(Invoke(RunCallback<GetTpmStatusReply>))); |
| ON_CALL(*this, GetVersionInfo(_, _)) |
| .WillByDefault(WithArgs<1>(Invoke(RunCallback<GetVersionInfoReply>))); |
| ON_CALL(*this, GetDictionaryAttackInfo(_, _)) |
| .WillByDefault( |
| WithArgs<1>(Invoke(RunCallback<GetDictionaryAttackInfoReply>))); |
| ON_CALL(*this, ResetDictionaryAttackLock(_, _)) |
| .WillByDefault( |
| WithArgs<1>(Invoke(RunCallback<ResetDictionaryAttackLockReply>))); |
| ON_CALL(*this, TakeOwnership(_, _)) |
| .WillByDefault(WithArgs<1>(Invoke(RunCallback<TakeOwnershipReply>))); |
| ON_CALL(*this, RemoveOwnerDependency(_, _)) |
| .WillByDefault( |
| WithArgs<1>(Invoke(RunCallback<RemoveOwnerDependencyReply>))); |
| ON_CALL(*this, ClearStoredOwnerPassword(_, _)) |
| .WillByDefault( |
| WithArgs<1>(Invoke(RunCallback<ClearStoredOwnerPasswordReply>))); |
| } |
| |
| MockTpmOwnershipInterface::~MockTpmOwnershipInterface() {} |
| |
| } // namespace tpm_manager |