1 /*
2  * Copyright (C) 2022 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 MOCK_WIFI_LEGACY_HAL_H_
18 #define MOCK_WIFI_LEGACY_HAL_H_
19 
20 #include <gmock/gmock.h>
21 
22 #include "wifi_legacy_hal.h"
23 
24 namespace aidl {
25 namespace android {
26 namespace hardware {
27 namespace wifi {
28 namespace legacy_hal {
29 
30 class MockWifiLegacyHal : public WifiLegacyHal {
31   public:
32     MockWifiLegacyHal(const std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool,
33                       const wifi_hal_fn& fn, bool is_primary);
34     MOCK_METHOD0(initialize, wifi_error());
35     MOCK_METHOD0(start, wifi_error());
36     MOCK_METHOD2(stop,
37                  wifi_error(std::unique_lock<std::recursive_mutex>*, const std::function<void()>&));
38     MOCK_METHOD2(setDfsFlag, wifi_error(const std::string&, bool));
39     MOCK_METHOD2(registerRadioModeChangeCallbackHandler,
40                  wifi_error(const std::string&, const on_radio_mode_change_callback&));
41     MOCK_METHOD1(getFirmwareVersion,
42                  std::pair<wifi_error, std::string>(const std::string& iface_name));
43     MOCK_METHOD1(getDriverVersion,
44                  std::pair<wifi_error, std::string>(const std::string& iface_name));
45 
46     MOCK_METHOD2(selectTxPowerScenario,
47                  wifi_error(const std::string& iface_name, wifi_power_scenario scenario));
48     MOCK_METHOD1(resetTxPowerScenario, wifi_error(const std::string& iface_name));
49     MOCK_METHOD2(nanRegisterCallbackHandlers,
50                  wifi_error(const std::string&, const NanCallbackHandlers&));
51     MOCK_METHOD2(nanDisableRequest, wifi_error(const std::string&, transaction_id));
52     MOCK_METHOD3(nanDataInterfaceDelete,
53                  wifi_error(const std::string&, transaction_id, const std::string&));
54     MOCK_METHOD2(createVirtualInterface,
55                  wifi_error(const std::string& ifname, wifi_interface_type iftype));
56     MOCK_METHOD1(deleteVirtualInterface, wifi_error(const std::string& ifname));
57     MOCK_METHOD0(waitForDriverReady, wifi_error());
58     MOCK_METHOD2(getSupportedIfaceName, wifi_error(uint32_t, std::string&));
59     MOCK_METHOD1(registerSubsystemRestartCallbackHandler,
60                  wifi_error(const on_subsystem_restart_callback&));
61     MOCK_METHOD1(getSupportedFeatureSet, std::pair<wifi_error, uint64_t>(const std::string&));
62 };
63 }  // namespace legacy_hal
64 }  // namespace wifi
65 }  // namespace hardware
66 }  // namespace android
67 }  // namespace aidl
68 
69 #endif  // MOCK_WIFI_LEGACY_HAL_H_
70