1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef SECURITY_GUARD_CONFIG_DATA_MANAGER_MOCK_H
17 #define SECURITY_GUARD_CONFIG_DATA_MANAGER_MOCK_H
18 
19 #include "gmock/gmock.h"
20 
21 #include "config_define.h"
22 
23 namespace OHOS::Security::SecurityGuard {
24 class BaseConfigDataManager {
25 public:
26     virtual std::vector<uint32_t> GetAllModelIds() = 0;
27     virtual bool GetModelConfig(uint32_t modelId, ModelCfg &config) = 0;
28     virtual bool GetEventConfig(int64_t eventId, EventCfg &config) = 0;
29     virtual std::string GetTableFromEventId(int64_t eventId) = 0;
30     virtual std::vector<int64_t> GetAllEventIds() = 0;
31     virtual std::vector<AppInfo> GetAppInfosByName(const std::string &appName) = 0;
32 };
33 
34 class ConfigDataManager : public BaseConfigDataManager {
35 public:
GetInstance()36     static ConfigDataManager &GetInstance()
37     {
38         static ConfigDataManager instance;
39         return instance;
40     };
41     MOCK_METHOD0(GetAllModelIds, std::vector<uint32_t>());
42     MOCK_METHOD2(GetModelConfig, bool(uint32_t modelId, ModelCfg &config));
43     MOCK_METHOD2(GetEventConfig, bool(int64_t eventId, EventCfg &config));
44     MOCK_METHOD1(GetTableFromEventId, std::string(int64_t eventId));
45     MOCK_METHOD0(GetAllEventIds, std::vector<int64_t>());
46     MOCK_METHOD1(GetAppInfosByName, std::vector<AppInfo>(const std::string &appName));
47 };
48 } // OHOS::Security::SecurityGuard
49 
50 #endif // SECURITY_GUARD_CONFIG_DATA_MANAGER_MOCK_H