1 // 2 // Copyright (C) 2011 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 SHILL_MOCK_STORE_H_ 18 #define SHILL_MOCK_STORE_H_ 19 20 #include <set> 21 #include <string> 22 #include <vector> 23 24 #include <base/macros.h> 25 #include <gmock/gmock.h> 26 27 #include "shill/key_value_store.h" 28 #include "shill/store_interface.h" 29 30 namespace shill { 31 32 class MockStore : public StoreInterface { 33 public: 34 MockStore(); 35 ~MockStore() override; 36 37 MOCK_CONST_METHOD0(IsNonEmpty, bool()); 38 MOCK_METHOD0(Open, bool()); 39 MOCK_METHOD0(Close, bool()); 40 MOCK_METHOD0(Flush, bool()); 41 MOCK_METHOD0(MarkAsCorrupted, bool()); 42 MOCK_CONST_METHOD0(GetGroups, std::set<std::string>()); 43 MOCK_CONST_METHOD1(GetGroupsWithKey, 44 std::set<std::string>(const std::string& key)); 45 MOCK_CONST_METHOD1(GetGroupsWithProperties, 46 std::set<std::string>(const KeyValueStore& properties)); 47 MOCK_CONST_METHOD1(ContainsGroup, bool(const std::string& group)); 48 MOCK_METHOD2(DeleteKey, bool(const std::string& group, 49 const std::string& key)); 50 MOCK_METHOD1(DeleteGroup, bool(const std::string& group)); 51 MOCK_METHOD1(SetHeader, bool(const std::string& header)); 52 MOCK_CONST_METHOD3(GetString, bool(const std::string& group, 53 const std::string& key, 54 std::string* value)); 55 MOCK_METHOD3(SetString, bool(const std::string& group, 56 const std::string& key, 57 const std::string& value)); 58 MOCK_CONST_METHOD3(GetBool, bool(const std::string& group, 59 const std::string& key, 60 bool* value)); 61 MOCK_METHOD3(SetBool, bool(const std::string& group, 62 const std::string& key, 63 bool value)); 64 MOCK_CONST_METHOD3(GetInt, bool(const std::string& group, 65 const std::string& key, 66 int* value)); 67 MOCK_METHOD3(SetInt, bool(const std::string& group, 68 const std::string& key, 69 int value)); 70 MOCK_CONST_METHOD3(GetUint64, bool(const std::string& group, 71 const std::string& key, 72 uint64_t* value)); 73 MOCK_METHOD3(SetUint64, bool(const std::string& group, 74 const std::string& key, 75 uint64_t value)); 76 MOCK_CONST_METHOD3(GetStringList, bool(const std::string& group, 77 const std::string& key, 78 std::vector<std::string>* value)); 79 MOCK_METHOD3(SetStringList, bool(const std::string& group, 80 const std::string& key, 81 const std::vector<std::string>& value)); 82 MOCK_METHOD3(GetCryptedString, bool(const std::string& group, 83 const std::string& key, 84 std::string* value)); 85 MOCK_METHOD3(SetCryptedString, bool(const std::string& group, 86 const std::string& key, 87 const std::string& value)); 88 89 private: 90 DISALLOW_COPY_AND_ASSIGN(MockStore); 91 }; 92 93 } // namespace shill 94 95 #endif // SHILL_MOCK_STORE_H_ 96