1// 2// Copyright (C) 2015 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_POLICY_SESSION_H_ 18#define TRUNKS_MOCK_POLICY_SESSION_H_ 19 20#include <string> 21#include <vector> 22 23#include <gmock/gmock.h> 24 25#include "trunks/policy_session.h" 26 27namespace trunks { 28 29class MockPolicySession : public PolicySession { 30 public: 31 MockPolicySession(); 32 ~MockPolicySession() override; 33 34 MOCK_METHOD0(GetDelegate, AuthorizationDelegate*()); 35 MOCK_METHOD3(StartBoundSession, TPM_RC( 36 TPMI_DH_ENTITY bind_entity, 37 const std::string& bind_authorization_value, 38 bool enable_encryption)); 39 MOCK_METHOD1(StartUnboundSession, TPM_RC(bool enable_encryption)); 40 MOCK_METHOD1(GetDigest, TPM_RC(std::string*)); 41 MOCK_METHOD1(PolicyOR, TPM_RC(const std::vector<std::string>&)); 42 MOCK_METHOD2(PolicyPCR, TPM_RC(uint32_t, const std::string&)); 43 MOCK_METHOD1(PolicyCommandCode, TPM_RC(TPM_CC)); 44 MOCK_METHOD0(PolicyAuthValue, TPM_RC()); 45 MOCK_METHOD1(SetEntityAuthorizationValue, void(const std::string&)); 46 47 private: 48 DISALLOW_COPY_AND_ASSIGN(MockPolicySession); 49}; 50 51} // namespace trunks 52 53#endif // TRUNKS_MOCK_POLICY_SESSION_H_ 54