1 // 2 // Copyright (C) 2014 The Android Open Source Project 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 // 16 17 #ifndef TRUNKS_MOCK_TPM_STATE_H_ 18 #define TRUNKS_MOCK_TPM_STATE_H_ 19 20 #include <gmock/gmock.h> 21 22 #include "trunks/tpm_state.h" 23 24 namespace trunks { 25 26 class MockTpmState : public TpmState { 27 public: 28 MockTpmState(); 29 ~MockTpmState() override; 30 31 MOCK_METHOD0(Initialize, TPM_RC()); 32 MOCK_METHOD0(IsOwnerPasswordSet, bool()); 33 MOCK_METHOD0(IsEndorsementPasswordSet, bool()); 34 MOCK_METHOD0(IsLockoutPasswordSet, bool()); 35 MOCK_METHOD0(IsOwned, bool()); 36 MOCK_METHOD0(IsInLockout, bool()); 37 MOCK_METHOD0(IsPlatformHierarchyEnabled, bool()); 38 MOCK_METHOD0(IsStorageHierarchyEnabled, bool()); 39 MOCK_METHOD0(IsEndorsementHierarchyEnabled, bool()); 40 MOCK_METHOD0(IsEnabled, bool()); 41 MOCK_METHOD0(WasShutdownOrderly, bool()); 42 MOCK_METHOD0(IsRSASupported, bool()); 43 MOCK_METHOD0(IsECCSupported, bool()); 44 MOCK_METHOD0(GetLockoutCounter, uint32_t()); 45 MOCK_METHOD0(GetLockoutThreshold, uint32_t()); 46 MOCK_METHOD0(GetLockoutInterval, uint32_t()); 47 MOCK_METHOD0(GetLockoutRecovery, uint32_t()); 48 MOCK_METHOD0(GetMaxNVSize, uint32_t()); 49 MOCK_METHOD2(GetTpmProperty, bool(TPM_PT, uint32_t*)); 50 MOCK_METHOD2(GetAlgorithmProperties, bool(TPM_ALG_ID, TPMA_ALGORITHM*)); 51 }; 52 53 } // namespace trunks 54 55 #endif // TRUNKS_MOCK_TPM_STATE_H_ 56