1 /* 2 * Copyright (C) 2024 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 OHOS_MOCK_WIFI_SCAN_CONFIG_H 17 #define OHOS_MOCK_WIFI_SCAN_CONFIG_H 18 19 #include <gmock/gmock.h> 20 #include "wifi_internal_msg.h" 21 22 namespace OHOS { 23 namespace Wifi { 24 25 class MockWifiScanConfig { 26 public: 27 virtual ~MockWifiScanConfig() = default; 28 virtual int GetScanControlInfo(ScanControlInfo &info, int instId = 0) = 0; 29 virtual int SetScanControlInfo(const ScanControlInfo &info, int instId = 0) = 0; 30 virtual int SaveScanInfoList(const std::vector<WifiScanInfo> &results) = 0; 31 virtual int ClearScanInfoList() = 0; 32 virtual int GetScanInfoList(std::vector<WifiScanInfo> &results) = 0; 33 virtual void CleanWifiCategoryRecord() = 0; 34 virtual void SetAppPackageName(const std::string &name) = 0; 35 virtual std::string GetAppPackageName() = 0; 36 virtual void SetPackageFilter(std::map<std::string, std::vector<std::string>> &filterMap) = 0; 37 virtual void SetAppRunningState(ScanMode appRunMode) = 0; 38 virtual ScanMode GetAppRunningState() = 0; 39 virtual void RecordWifiCategory(const std::string bssid, WifiCategory category) = 0; 40 virtual WifiCategory GetWifiCategoryRecord(const std::string bssid) = 0; 41 virtual void GetScanInfoListInner(std::vector<WifiScanInfo> &results) = 0; 42 virtual void SetStaScene(const int &scene) = 0; 43 virtual void SetStaSceneForbidCount(int count) = 0; 44 virtual int GetStaSceneForbidCount() = 0; 45 virtual void SetMovingFreezeScaned(bool scanned) = 0; 46 virtual bool GetMovingFreezeScaned() = 0; 47 virtual void SetAbnormalApps(const std::vector<std::string> &abnormalAppList) = 0; 48 virtual void SetStaCurrentTime(time_t time) = 0; 49 virtual time_t GetStaCurrentTime() = 0; 50 }; 51 52 class WifiScanConfig : public MockWifiScanConfig { 53 public: 54 MOCK_METHOD2(GetScanControlInfo, int(ScanControlInfo &info, int)); 55 MOCK_METHOD2(SetScanControlInfo, int(const ScanControlInfo &info, int)); 56 MOCK_METHOD1(SaveScanInfoList, int(const std::vector<WifiScanInfo> &results)); 57 MOCK_METHOD0(ClearScanInfoList, int()); 58 MOCK_METHOD1(GetScanInfoList, int(std::vector<WifiScanInfo> &results)); 59 MOCK_METHOD0(CleanWifiCategoryRecord, void()); 60 MOCK_METHOD1(SetAppPackageName, void(const std::string &name)); 61 MOCK_METHOD0(GetAppPackageName, std::string()); 62 MOCK_METHOD1(SetPackageFilter, void(std::map<std::string, std::vector<std::string>> &filterMap)); 63 MOCK_METHOD1(SetAppRunningState, void(ScanMode appRunMode)); 64 MOCK_METHOD0(GetAppRunningState, ScanMode()); 65 MOCK_METHOD2(RecordWifiCategory, void(const std::string bssid, WifiCategory category)); 66 MOCK_METHOD1(GetWifiCategoryRecord, WifiCategory(const std::string bssid)); 67 MOCK_METHOD1(GetScanInfoListInner, void(std::vector<WifiScanInfo> &results)); 68 MOCK_METHOD1(SetStaScene, void(const int &scene)); 69 MOCK_METHOD1(SetStaSceneForbidCount, void(int count)); 70 MOCK_METHOD0(GetStaSceneForbidCount, int()); 71 MOCK_METHOD1(SetMovingFreezeScaned, void(bool scanned)); 72 MOCK_METHOD0(GetMovingFreezeScaned, bool()); 73 MOCK_METHOD1(SetAbnormalApps, void(const std::vector<std::string> &abnormalAppList)); 74 MOCK_METHOD1(SetStaCurrentTime, void(time_t time)); 75 MOCK_METHOD0(GetStaCurrentTime, time_t()); 76 }; 77 } // namespace OHOS 78 } // namespace Wifi 79 #endif