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 ATTESTATION_SERVER_MOCK_KEY_STORE_H_ 18#define ATTESTATION_SERVER_MOCK_KEY_STORE_H_ 19 20#include "attestation/server/key_store.h" 21 22#include <string> 23 24#include <base/macros.h> 25#include <gmock/gmock.h> 26 27namespace attestation { 28 29class MockKeyStore : public KeyStore { 30 public: 31 MockKeyStore(); 32 virtual ~MockKeyStore(); 33 34 MOCK_METHOD3(Read, 35 bool(const std::string& username, 36 const std::string& name, 37 std::string* key_data)); 38 MOCK_METHOD3(Write, 39 bool(const std::string& username, 40 const std::string& name, 41 const std::string& key_data)); 42 MOCK_METHOD2(Delete, 43 bool(const std::string& username, const std::string& name)); 44 MOCK_METHOD2(DeleteByPrefix, 45 bool(const std::string& username, 46 const std::string& key_prefix)); 47 MOCK_METHOD7(Register, 48 bool(const std::string& username, 49 const std::string& label, 50 KeyType key_type, 51 KeyUsage key_usage, 52 const std::string& private_key_blob, 53 const std::string& public_key_der, 54 const std::string& certificate)); 55 MOCK_METHOD2(RegisterCertificate, 56 bool(const std::string& username, 57 const std::string& certificate)); 58 59 private: 60 DISALLOW_COPY_AND_ASSIGN(MockKeyStore); 61}; 62 63} // namespace attestation 64 65#endif // ATTESTATION_SERVER_MOCK_KEY_STORE_H_ 66