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, bool(const std::string& username,
35                          const std::string& name,
36                          std::string* key_data));
37  MOCK_METHOD3(Write, bool(const std::string& username,
38                           const std::string& name,
39                           const std::string& key_data));
40  MOCK_METHOD2(Delete, bool(const std::string& username,
41                            const std::string& name));
42  MOCK_METHOD2(DeleteByPrefix, bool(const std::string& username,
43                                    const std::string& key_prefix));
44  MOCK_METHOD7(Register, bool(const std::string& username,
45                              const std::string& label,
46                              KeyType key_type,
47                              KeyUsage key_usage,
48                              const std::string& private_key_blob,
49                              const std::string& public_key_der,
50                              const std::string& certificate));
51  MOCK_METHOD2(RegisterCertificate, bool(const std::string& username,
52                                         const std::string& certificate));
53
54 private:
55  DISALLOW_COPY_AND_ASSIGN(MockKeyStore);
56};
57
58}  // namespace attestation
59
60#endif  // ATTESTATION_SERVER_MOCK_KEY_STORE_H_
61