mirror of
https://gitee.com/openharmony/communication_wifi.git
synced 2024-11-27 01:01:03 +00:00
TDD
Signed-off-by: xionglei <xionglei3@huawei.com>
This commit is contained in:
parent
56ffb12aed
commit
434958c9a0
@ -17,7 +17,6 @@ group("unittest") {
|
||||
deps = []
|
||||
|
||||
deps += [
|
||||
|
||||
"wifi_standard/ipc_framework/cRPC/unittest:crpc_unittest",
|
||||
"wifi_standard/native:native_unittest",
|
||||
"wifi_standard/non_mock:wifi_non_mock_unittest",
|
||||
@ -34,6 +33,7 @@ group("unittest") {
|
||||
"wifi_standard/wifi_framework/wifi_manage/wifi_sta:wifi_selfcure_unittest",
|
||||
"wifi_standard/wifi_framework/wifi_manage/wifi_sta:wifi_sta_unittest",
|
||||
"wifi_standard/wifi_framework/wifi_manage/wifi_sta_new:wifi_sta_new_unittest",
|
||||
"wifi_standard/wifi_framework/wifi_manage/wifi_sub_manage:wifi_sub_manage_unittest",
|
||||
"wifi_standard/wifi_framework/wifi_toolkit/unittest:toolkit_unittest",
|
||||
"wifi_standard/wifi_hal/unittest:wifi_hal_unittest",
|
||||
"wifi_utils/unittest:utils_unittest",
|
||||
|
@ -204,6 +204,7 @@ public:
|
||||
virtual void MergeWifiCloneConfig(std::string &cloneData) = 0;
|
||||
virtual bool GetScanAlwaysState(int instId) = 0;
|
||||
virtual bool GetSupportHwPnoFlag(int instId = 0) = 0;
|
||||
virtual int SetAcceptUnvalidated(int networkId, bool state) = 0;
|
||||
};
|
||||
|
||||
class WifiSettings : public MockWifiSettings {
|
||||
@ -376,6 +377,7 @@ public:
|
||||
MOCK_METHOD1(MergeWifiCloneConfig, void(std::string &cloneData));
|
||||
MOCK_METHOD1(GetScanAlwaysState, bool(int instId));
|
||||
MOCK_METHOD1(GetSupportHwPnoFlag, bool(int instId));
|
||||
MOCK_METHOD2(SetAcceptUnvalidated, int(int networkId, bool state));
|
||||
};
|
||||
} // namespace Wifi
|
||||
} // namespace OHOS
|
||||
|
@ -54,6 +54,9 @@ public:
|
||||
virtual void DealStoreScanInfoEvent(std::vector<InterScanInfo> &results, int instId = 0) = 0;
|
||||
virtual void PushServiceCloseMsg(WifiCloseServiceCode code, int instId = 0);
|
||||
virtual void AutoStartEnhanceService(void) = 0;
|
||||
#ifdef FEATURE_HPF_SUPPORT
|
||||
virtual void InstallPacketFilterProgram(int event = 0, int instId = 0) = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
class WifiManager : public MockWifiManager {
|
||||
@ -70,6 +73,9 @@ public:
|
||||
MOCK_METHOD2(DealStoreScanInfoEvent, void(std::vector<InterScanInfo> &results, int));
|
||||
MOCK_METHOD2(PushServiceCloseMsg, void(WifiCloseServiceCode, int));
|
||||
MOCK_METHOD0(AutoStartEnhanceService, void());
|
||||
#ifdef FEATURE_HPF_SUPPORT
|
||||
MOCK_METHOD2(InstallPacketFilterProgram, void(int event, int instId));
|
||||
#endif
|
||||
std::unique_ptr<WifiStaManager>& GetWifiStaManager();
|
||||
std::unique_ptr<WifiScanManager>& GetWifiScanManager();
|
||||
std::unique_ptr<WifiTogglerManager>& GetWifiTogglerManager();
|
||||
|
@ -0,0 +1,183 @@
|
||||
# Copyright (C) 2024-2024 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//build/test.gni")
|
||||
import("//foundation/communication/wifi/wifi/wifi.gni")
|
||||
module_output_path = "wifi/wifi_sub_manage_unittest"
|
||||
defines = []
|
||||
|
||||
config("module_private_config") {
|
||||
visibility = [ ":*" ]
|
||||
include_dirs = [ "$WIFI_ROOT_DIR/test/wifi_standard/wifi_framework/wifi_manage/wifi_sub_manage" ]
|
||||
}
|
||||
|
||||
ohos_unittest("wifi_sub_manage_unittest") {
|
||||
module_out_path = module_output_path
|
||||
sources = [
|
||||
"$WIFI_ROOT_DIR/frameworks/native/src/wifi_p2p_msg.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/app_network_speed_limit/app_network_speed_limit_service.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/app_network_speed_limit/speed_limit_configs_writer.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_app_state_aware.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_auth_center.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_country_code/wifi_country_code_manager.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_country_code/wifi_country_code_policy.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_datashare_utils.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_internal_event_dispatcher.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_net_agent.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_net_observer.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_netlink.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_notification_util.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_permission_helper.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_permission_utils.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_protect.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_protect_manager.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_system_ability_listerner.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_system_timer.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_controller/concrete_clientmode_manager.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_controller/concrete_manager_state_machine.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_controller/multi_sta_manager.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_controller/multi_sta_state_machine.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_controller/softap_manager.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_controller/softap_manager_state_machine.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_controller/wifi_controller_state_machine.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_controller/wifi_service_scheduler.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_self_cure/ip_qos_monitor.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_sub_manage/wifi_common_service_manager.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_sub_manage/wifi_event_subscriber_manager.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_sub_manage/wifi_hotspot_manager.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_sub_manage/wifi_location_mode_observer.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_sub_manage/wifi_p2p_manager.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_sub_manage/wifi_scan_manager.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_sub_manage/wifi_sta_manager.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_sub_manage/wifi_toggler_manager.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/net_helper/base_address.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/net_helper/ip_tools.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/net_helper/ipv6_address.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/net_helper/mac_address.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/utils/wifi_common_event_helper.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/utils/wifi_global_func.cpp",
|
||||
"$WIFI_ROOT_DIR/test/wifi_standard/wifi_framework/wifi_manage/unittest/Mock/mock_wifi_settings.cpp",
|
||||
"$WIFI_ROOT_DIR/test/wifi_standard/wifi_framework/wifi_manage/wifi_scan/Mock/mock_wifi_manager.cpp",
|
||||
"$WIFI_ROOT_DIR/test/wifi_standard/wifi_framework/wifi_manage/wifi_sta_sa/mock/mock_wifi_service_manager.cpp",
|
||||
"$WIFI_ROOT_DIR/test/wifi_standard/wifi_framework/wifi_toolkit/unittest/Mock/mock_wifi_config_center.cpp",
|
||||
"wifi_scan_manager_test.cpp",
|
||||
"wifi_sta_manager_test.cpp",
|
||||
"wifi_toggler_manager_test.cpp",
|
||||
]
|
||||
|
||||
if (defined(global_parts_info) && defined(global_parts_info.msdp_movement)) {
|
||||
sources += [
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_sub_manage/wifi_msdp_state_listener.cpp",
|
||||
"wifi_msdp_state_listener_test.cpp",
|
||||
]
|
||||
}
|
||||
|
||||
include_dirs = [
|
||||
"$WIFI_ROOT_DIR/utils/inc",
|
||||
"$WIFI_ROOT_DIR/test/wifi_standard/wifi_framework/wifi_manage/wifi_scan/Mock",
|
||||
"$WIFI_ROOT_DIR/base/utils",
|
||||
"$WIFI_ROOT_DIR/interfaces/inner_api",
|
||||
"$WIFI_ROOT_DIR/frameworks/native/interfaces",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/include",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/log",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/net_helper",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/utils",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/config",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/app_network_speed_limit",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_common",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_controller",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/common",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/hal_device_manage",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/wifi_hal_interface",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/idl_client",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/idl_client/idl_interface",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta_sa",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_scan",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_scan_sa",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_self_cure",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_pro",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_sub_manage",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_ap",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_ap_sa",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_p2p",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_p2p/hid2d",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_p2p_sa",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/include",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_country_code",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/wifi_asset",
|
||||
"$WIFI_ROOT_DIR/test/wifi_standard/wifi_framework/wifi_manage/unittest/Mock",
|
||||
"$WIFI_ROOT_DIR/test/wifi_standard/wifi_framework/wifi_toolkit/unittest/Mock",
|
||||
]
|
||||
|
||||
deps = [
|
||||
"$WIFI_ROOT_DIR/base:wifi_base",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_native:wifi_native",
|
||||
"$WIFI_ROOT_DIR/utils:wifi_utils",
|
||||
]
|
||||
|
||||
external_deps = [
|
||||
"ability_base:want",
|
||||
"ability_base:zuri",
|
||||
"ability_runtime:ability_manager",
|
||||
"ability_runtime:app_manager",
|
||||
"ability_runtime:extension_manager",
|
||||
"ability_runtime:wantagent_innerkits",
|
||||
"access_token:libaccesstoken_sdk",
|
||||
"access_token:libtokenid_sdk",
|
||||
"bundle_framework:appexecfwk_base",
|
||||
"bundle_framework:appexecfwk_core",
|
||||
"c_utils:utils",
|
||||
"cellular_data:tel_cellular_data_api",
|
||||
"core_service:tel_core_service_api",
|
||||
"data_share:datashare_consumer",
|
||||
"dhcp:dhcp_sdk",
|
||||
"googletest:gmock_main",
|
||||
"googletest:gtest_main",
|
||||
"hilog:libhilog",
|
||||
"init:libbegetutil",
|
||||
"ipc:ipc_single",
|
||||
"jsoncpp:jsoncpp",
|
||||
"libxml2:libxml2",
|
||||
"netmanager_base:net_conn_manager_if",
|
||||
"netmanager_base:net_native_manager_if",
|
||||
"netmanager_base:net_stats_manager_if",
|
||||
"power_manager:powermgr_client",
|
||||
"samgr:samgr_proxy",
|
||||
"time_service:time_client",
|
||||
]
|
||||
|
||||
ldflags = [
|
||||
"-fPIC",
|
||||
"--coverage",
|
||||
"-Wl,-E",
|
||||
]
|
||||
|
||||
defines += [
|
||||
"private=public",
|
||||
"FEATURE_AP_SUPPORT",
|
||||
"FEATURE_STA_SUPPORT",
|
||||
"STA_INSTANCE_MAX_NUM=$wifi_feature_with_sta_num",
|
||||
"AP_INSTANCE_MAX_NUM=$wifi_feature_with_ap_num",
|
||||
"FEATURE_SELF_CURE_SUPPORT",
|
||||
"SUPPORT_RANDOM_MAC_ADDR",
|
||||
]
|
||||
|
||||
if (defined(global_parts_info) && defined(global_parts_info.msdp_movement)) {
|
||||
external_deps += [ "movement:movement_client" ]
|
||||
defines += [ "HAS_MOVEMENT_PART" ]
|
||||
}
|
||||
part_name = "wifi"
|
||||
subsystem_name = "communication"
|
||||
}
|
@ -152,6 +152,8 @@ public:
|
||||
const std::string &randomAddr) = 0;
|
||||
virtual std::string GetP2pIfaceName() = 0;
|
||||
virtual int GetScanGenieState() const = 0;
|
||||
virtual int Init() = 0;
|
||||
virtual void SetFreezeModeState(int state) = 0;
|
||||
};
|
||||
|
||||
class WifiConfigCenter : public MockWifiConfigCenter {
|
||||
@ -284,6 +286,8 @@ public:
|
||||
const std::string &randomAddr));
|
||||
MOCK_METHOD0(GetP2pIfaceName, std::string());
|
||||
MOCK_CONST_METHOD0(GetScanGenieState, int());
|
||||
MOCK_METHOD0(Init, int());
|
||||
MOCK_METHOD1(SetFreezeModeState, void(int state));
|
||||
private:
|
||||
WifiConfigCenter();
|
||||
std::unique_ptr<WifiScanConfig> wifiScanConfig = nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user