diff options
Diffstat (limited to 'wifi')
4 files changed, 115 insertions, 165 deletions
diff --git a/wifi/1.0/vts/functional/wifi_hidl_test_utils.cpp b/wifi/1.0/vts/functional/wifi_hidl_test_utils.cpp index e6e61cf8b7..02f8209e5b 100644 --- a/wifi/1.0/vts/functional/wifi_hidl_test_utils.cpp +++ b/wifi/1.0/vts/functional/wifi_hidl_test_utils.cpp @@ -66,7 +66,7 @@ bool findAnyModeSupportingIfaceType( bool configureChipToSupportIfaceTypeInternal(const sp<IWifiChip>& wifi_chip, IfaceType type, ChipModeId* configured_mode_id) { - if (!configured_mode_id) { + if (!configured_mode_id || !wifi_chip.get()) { return false; } const auto& status_and_modes = HIDL_INVOKE(wifi_chip, getAvailableModes); diff --git a/wifi/1.4/vts/functional/wifi_hidl_test_utils_1_4.h b/wifi/1.4/vts/functional/wifi_hidl_test_utils_1_4.h index a2c58154a1..ca7b57a47c 100644 --- a/wifi/1.4/vts/functional/wifi_hidl_test_utils_1_4.h +++ b/wifi/1.4/vts/functional/wifi_hidl_test_utils_1_4.h @@ -28,6 +28,6 @@ // These helper functions should be modified to return vectors if we support // multiple instances. android::sp<android::hardware::wifi::V1_4::IWifiChip> getWifiChip_1_4( - const std::string& instance_name); + const std::string& instance_name); android::sp<android::hardware::wifi::V1_4::IWifiApIface> getWifiApIface_1_4( - const std::string& instance_name); + const std::string& instance_name); diff --git a/wifi/1.6/vts/functional/wifi_nan_iface_hidl_test.cpp b/wifi/1.6/vts/functional/wifi_nan_iface_hidl_test.cpp index 7bcc6d3a06..37c55e75df 100644 --- a/wifi/1.6/vts/functional/wifi_nan_iface_hidl_test.cpp +++ b/wifi/1.6/vts/functional/wifi_nan_iface_hidl_test.cpp @@ -68,17 +68,10 @@ class WifiNanIfaceHidlTest : public ::testing::TestWithParam<std::string> { virtual void TearDown() override { stopWifi(GetInstanceName()); } - /* Used as a mechanism to inform the test about data/event callback */ - inline void notify() { - std::unique_lock<std::mutex> lock(mtx_); - count_++; - cv_.notify_one(); - } enum CallbackType { - INVALID = -2, ANY_CALLBACK = -1, - + INVALID = 0, NOTIFY_CAPABILITIES_RESPONSE = 0, NOTIFY_ENABLE_RESPONSE, NOTIFY_CONFIG_RESPONSE, @@ -114,8 +107,14 @@ class WifiNanIfaceHidlTest : public ::testing::TestWithParam<std::string> { EVENT_DATA_PATH_CONFIRM_1_6, }; + /* Used as a mechanism to inform the test about data/event callback */ + inline void notify(CallbackType callbackType) { + std::unique_lock<std::mutex> lock(mtx_); + callbackEventBitMap |= (0x1 << callbackType); + cv_.notify_one(); + } /* Test code calls this function to wait for data/event callback */ - /* Must set callbackType = INVALID before call this function */ + /* Must set callbackEventBitMap = INVALID before call this function */ inline std::cv_status wait(CallbackType waitForCallbackType) { std::unique_lock<std::mutex> lock(mtx_); @@ -124,15 +123,11 @@ class WifiNanIfaceHidlTest : public ::testing::TestWithParam<std::string> { std::cv_status status = std::cv_status::no_timeout; auto now = std::chrono::system_clock::now(); - while (count_ == 0) { + while (!(callbackEventBitMap & (0x1 << waitForCallbackType))) { status = cv_.wait_until(lock, now + std::chrono::seconds(TIMEOUT_PERIOD)); - if (status == std::cv_status::timeout) return status; - if (waitForCallbackType != ANY_CALLBACK && callbackType != INVALID && - callbackType != waitForCallbackType) { - count_--; - } + if (status == std::cv_status::timeout) + return status; } - count_--; return status; } @@ -148,340 +143,276 @@ class WifiNanIfaceHidlTest : public ::testing::TestWithParam<std::string> { Return<void> notifyCapabilitiesResponse( uint16_t id, const WifiNanStatus& status, const ::android::hardware::wifi::V1_0::NanCapabilities& capabilities) override { - parent_.callbackType = NOTIFY_CAPABILITIES_RESPONSE; - parent_.id = id; parent_.status = status; parent_.capabilities = capabilities; - parent_.notify(); + parent_.notify(NOTIFY_CAPABILITIES_RESPONSE); return Void(); } Return<void> notifyCapabilitiesResponse_1_5( uint16_t id, const WifiNanStatus& status, const ::android::hardware::wifi::V1_5::NanCapabilities& capabilities) override { - parent_.callbackType = NOTIFY_CAPABILITIES_RESPONSE_1_5; - parent_.id = id; parent_.status = status; parent_.capabilities_1_5 = capabilities; - parent_.notify(); + parent_.notify(NOTIFY_CAPABILITIES_RESPONSE_1_5); return Void(); } Return<void> notifyEnableResponse(uint16_t id, const WifiNanStatus& status) override { - parent_.callbackType = NOTIFY_ENABLE_RESPONSE; - parent_.id = id; parent_.status = status; - parent_.notify(); + parent_.notify(NOTIFY_ENABLE_RESPONSE); return Void(); } Return<void> notifyConfigResponse(uint16_t id, const WifiNanStatus& status) override { - parent_.callbackType = NOTIFY_CONFIG_RESPONSE; - parent_.id = id; parent_.status = status; - parent_.notify(); + parent_.notify(NOTIFY_CONFIG_RESPONSE); return Void(); } Return<void> notifyDisableResponse(uint16_t id, const WifiNanStatus& status) override { - parent_.callbackType = NOTIFY_DISABLE_RESPONSE; - parent_.id = id; parent_.status = status; - parent_.notify(); + parent_.notify(NOTIFY_DISABLE_RESPONSE); return Void(); } Return<void> notifyStartPublishResponse(uint16_t id, const WifiNanStatus& status, uint8_t sessionId) override { - parent_.callbackType = NOTIFY_START_PUBLISH_RESPONSE; - parent_.id = id; parent_.status = status; parent_.sessionId = sessionId; - parent_.notify(); + parent_.notify(NOTIFY_START_PUBLISH_RESPONSE); return Void(); } Return<void> notifyStopPublishResponse(uint16_t id, const WifiNanStatus& status) override { - parent_.callbackType = NOTIFY_STOP_PUBLISH_RESPONSE; - parent_.id = id; parent_.status = status; - parent_.notify(); + parent_.notify(NOTIFY_STOP_PUBLISH_RESPONSE); return Void(); } Return<void> notifyStartSubscribeResponse(uint16_t id, const WifiNanStatus& status, uint8_t sessionId) override { - parent_.callbackType = NOTIFY_START_SUBSCRIBE_RESPONSE; - parent_.id = id; parent_.status = status; parent_.sessionId = sessionId; - parent_.notify(); + parent_.notify(NOTIFY_START_SUBSCRIBE_RESPONSE); return Void(); } Return<void> notifyStopSubscribeResponse(uint16_t id, const WifiNanStatus& status) override { - parent_.callbackType = NOTIFY_STOP_SUBSCRIBE_RESPONSE; - parent_.id = id; parent_.status = status; - parent_.notify(); + parent_.notify(NOTIFY_STOP_SUBSCRIBE_RESPONSE); return Void(); } Return<void> notifyTransmitFollowupResponse(uint16_t id, const WifiNanStatus& status) override { - parent_.callbackType = NOTIFY_TRANSMIT_FOLLOWUP_RESPONSE; - parent_.id = id; parent_.status = status; - parent_.notify(); + parent_.notify(NOTIFY_TRANSMIT_FOLLOWUP_RESPONSE); return Void(); } Return<void> notifyCreateDataInterfaceResponse(uint16_t id, const WifiNanStatus& status) override { - parent_.callbackType = NOTIFY_CREATE_DATA_INTERFACE_RESPONSE; - parent_.id = id; parent_.status = status; - parent_.notify(); + parent_.notify(NOTIFY_CREATE_DATA_INTERFACE_RESPONSE); return Void(); } Return<void> notifyDeleteDataInterfaceResponse(uint16_t id, const WifiNanStatus& status) override { - parent_.callbackType = NOTIFY_DELETE_DATA_INTERFACE_RESPONSE; - parent_.id = id; parent_.status = status; - parent_.notify(); + parent_.notify(NOTIFY_DELETE_DATA_INTERFACE_RESPONSE); return Void(); } Return<void> notifyInitiateDataPathResponse(uint16_t id, const WifiNanStatus& status, uint32_t ndpInstanceId) override { - parent_.callbackType = NOTIFY_INITIATE_DATA_PATH_RESPONSE; - parent_.id = id; parent_.status = status; parent_.ndpInstanceId = ndpInstanceId; - parent_.notify(); + parent_.notify(NOTIFY_INITIATE_DATA_PATH_RESPONSE); return Void(); } Return<void> notifyRespondToDataPathIndicationResponse( uint16_t id, const WifiNanStatus& status) override { - parent_.callbackType = NOTIFY_RESPOND_TO_DATA_PATH_INDICATION_RESPONSE; - parent_.id = id; parent_.status = status; - parent_.notify(); + parent_.notify(NOTIFY_RESPOND_TO_DATA_PATH_INDICATION_RESPONSE); return Void(); } Return<void> notifyTerminateDataPathResponse(uint16_t id, const WifiNanStatus& status) override { - parent_.callbackType = NOTIFY_TERMINATE_DATA_PATH_RESPONSE; - parent_.id = id; parent_.status = status; - parent_.notify(); + parent_.notify(NOTIFY_TERMINATE_DATA_PATH_RESPONSE); return Void(); } Return<void> eventClusterEvent(const NanClusterEventInd& event) override { - parent_.callbackType = EVENT_CLUSTER_EVENT; - parent_.nanClusterEventInd = event; - parent_.notify(); + parent_.notify(EVENT_CLUSTER_EVENT); return Void(); } Return<void> eventDisabled(const WifiNanStatus& status) override { - parent_.callbackType = EVENT_DISABLED; - parent_.status = status; - parent_.notify(); + parent_.notify(EVENT_DISABLED); return Void(); } Return<void> eventPublishTerminated(uint8_t sessionId, const WifiNanStatus& status) override { - parent_.callbackType = EVENT_PUBLISH_TERMINATED; - parent_.sessionId = sessionId; parent_.status = status; - parent_.notify(); + parent_.notify(EVENT_PUBLISH_TERMINATED); return Void(); } Return<void> eventSubscribeTerminated(uint8_t sessionId, const WifiNanStatus& status) override { - parent_.callbackType = EVENT_SUBSCRIBE_TERMINATED; - parent_.sessionId = sessionId; parent_.status = status; - parent_.notify(); + parent_.notify(EVENT_SUBSCRIBE_TERMINATED); return Void(); } Return<void> eventMatch( const ::android::hardware::wifi::V1_0::NanMatchInd& event) override { - parent_.callbackType = EVENT_MATCH; - parent_.nanMatchInd = event; - parent_.notify(); + parent_.notify(EVENT_MATCH); return Void(); } Return<void> eventMatchExpired(uint8_t discoverySessionId, uint32_t peerId) override { - parent_.callbackType = EVENT_MATCH_EXPIRED; - parent_.sessionId = discoverySessionId; parent_.peerId = peerId; - parent_.notify(); + parent_.notify(EVENT_MATCH_EXPIRED); return Void(); } Return<void> eventFollowupReceived(const NanFollowupReceivedInd& event) override { - parent_.callbackType = EVENT_FOLLOWUP_RECEIVED; - parent_.nanFollowupReceivedInd = event; - parent_.notify(); + parent_.notify(EVENT_FOLLOWUP_RECEIVED); return Void(); } Return<void> eventTransmitFollowup(uint16_t id, const WifiNanStatus& status) override { - parent_.callbackType = EVENT_TRANSMIT_FOLLOWUP; - parent_.id = id; parent_.status = status; - parent_.notify(); + parent_.notify(EVENT_TRANSMIT_FOLLOWUP); return Void(); } Return<void> eventDataPathRequest(const NanDataPathRequestInd& event) override { - parent_.callbackType = EVENT_DATA_PATH_REQUEST; - parent_.nanDataPathRequestInd = event; - parent_.notify(); + parent_.notify(EVENT_DATA_PATH_REQUEST); return Void(); } Return<void> eventDataPathConfirm( const ::android::hardware::wifi::V1_0::NanDataPathConfirmInd& event) override { - parent_.callbackType = EVENT_DATA_PATH_CONFIRM; - parent_.nanDataPathConfirmInd = event; - parent_.notify(); + parent_.notify(EVENT_DATA_PATH_CONFIRM); return Void(); } Return<void> eventDataPathTerminated(uint32_t ndpInstanceId) override { - parent_.callbackType = EVENT_DATA_PATH_TERMINATED; - parent_.ndpInstanceId = ndpInstanceId; - parent_.notify(); + parent_.notify(EVENT_DATA_PATH_TERMINATED); return Void(); } Return<void> eventDataPathConfirm_1_2( const ::android::hardware::wifi::V1_2::NanDataPathConfirmInd& event) override { - parent_.callbackType = EVENT_DATA_PATH_CONFIRM_1_2; - parent_.nanDataPathConfirmInd_1_2 = event; - parent_.notify(); + parent_.notify(EVENT_DATA_PATH_CONFIRM_1_2); return Void(); } Return<void> eventDataPathScheduleUpdate( const ::android::hardware::wifi::V1_2::NanDataPathScheduleUpdateInd& event) override { - parent_.callbackType = EVENT_DATA_PATH_SCHEDULE_UPDATE; - parent_.nanDataPathScheduleUpdateInd_1_2 = event; - parent_.notify(); + parent_.notify(EVENT_DATA_PATH_SCHEDULE_UPDATE); return Void(); } Return<void> eventMatch_1_6( const ::android::hardware::wifi::V1_6::NanMatchInd& event) override { - parent_.callbackType = EVENT_MATCH_1_6; - parent_.nanMatchInd_1_6 = event; - parent_.notify(); + parent_.notify(EVENT_MATCH_1_6); return Void(); } Return<void> notifyCapabilitiesResponse_1_6( uint16_t id, const WifiNanStatus& status, const ::android::hardware::wifi::V1_6::NanCapabilities& capabilities) override { - parent_.callbackType = NOTIFY_CAPABILITIES_RESPONSE_1_6; - parent_.id = id; parent_.status = status; parent_.capabilities_1_6 = capabilities; - parent_.notify(); + parent_.notify(NOTIFY_CAPABILITIES_RESPONSE_1_6); return Void(); } Return<void> eventDataPathScheduleUpdate_1_6( const ::android::hardware::wifi::V1_6::NanDataPathScheduleUpdateInd& event) override { - parent_.callbackType = EVENT_DATA_PATH_SCHEDULE_UPDATE_1_6; - parent_.nanDataPathScheduleUpdateInd_1_6 = event; - parent_.notify(); + parent_.notify(EVENT_DATA_PATH_SCHEDULE_UPDATE_1_6); return Void(); } Return<void> eventDataPathConfirm_1_6( const ::android::hardware::wifi::V1_6::NanDataPathConfirmInd& event) override { - parent_.callbackType = EVENT_DATA_PATH_CONFIRM_1_6; - parent_.nanDataPathConfirmInd_1_6 = event; - parent_.notify(); + parent_.notify(EVENT_DATA_PATH_CONFIRM_1_6); return Void(); } }; @@ -490,7 +421,6 @@ class WifiNanIfaceHidlTest : public ::testing::TestWithParam<std::string> { // synchronization objects std::mutex mtx_; std::condition_variable cv_; - int count_ = 0; protected: android::sp<::android::hardware::wifi::V1_6::IWifiNanIface> iwifiNanIface; @@ -498,7 +428,7 @@ class WifiNanIfaceHidlTest : public ::testing::TestWithParam<std::string> { // Data from IWifiNanIfaceEventCallback callbacks: this is the collection of // all arguments to all callbacks. They are set by the callback // (notifications or events) and can be retrieved by tests. - CallbackType callbackType; + uint32_t callbackEventBitMap; uint16_t id; WifiNanStatus status; uint8_t sessionId; @@ -535,7 +465,7 @@ TEST_P(WifiNanIfaceHidlTest, Create) { */ TEST_P(WifiNanIfaceHidlTest, enableRequest_1_6InvalidArgs) { uint16_t inputCmdId = 10; - callbackType = INVALID; + callbackEventBitMap = INVALID; ::android::hardware::wifi::V1_4::NanEnableRequest nanEnableRequest = {}; ::android::hardware::wifi::V1_6::NanConfigRequestSupplemental nanConfigRequestSupp = {}; const auto& halStatus = HIDL_INVOKE(iwifiNanIface, enableRequest_1_6, inputCmdId, @@ -545,7 +475,7 @@ TEST_P(WifiNanIfaceHidlTest, enableRequest_1_6InvalidArgs) { // wait for a callback ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_ENABLE_RESPONSE)); - ASSERT_EQ(NOTIFY_ENABLE_RESPONSE, callbackType); + ASSERT_EQ(0x1 << NOTIFY_ENABLE_RESPONSE, callbackEventBitMap & (0x1 << NOTIFY_ENABLE_RESPONSE)); ASSERT_EQ(id, inputCmdId); ASSERT_EQ(status.status, NanStatusType::INVALID_ARGS); } @@ -572,7 +502,7 @@ TEST_P(WifiNanIfaceHidlTest, enableRequest_1_6ShimInvalidArgs) { */ TEST_P(WifiNanIfaceHidlTest, configRequest_1_6InvalidArgs) { uint16_t inputCmdId = 10; - callbackType = INVALID; + callbackEventBitMap = INVALID; ::android::hardware::wifi::V1_4::NanConfigRequest nanConfigRequest = {}; ::android::hardware::wifi::V1_6::NanConfigRequestSupplemental nanConfigRequestSupp = {}; const auto& halStatus = HIDL_INVOKE(iwifiNanIface, configRequest_1_6, inputCmdId, @@ -583,7 +513,7 @@ TEST_P(WifiNanIfaceHidlTest, configRequest_1_6InvalidArgs) { // wait for a callback ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_CONFIG_RESPONSE)); - ASSERT_EQ(NOTIFY_CONFIG_RESPONSE, callbackType); + ASSERT_EQ(0x1 << NOTIFY_CONFIG_RESPONSE, callbackEventBitMap & (0x1 << NOTIFY_CONFIG_RESPONSE)); ASSERT_EQ(id, inputCmdId); ASSERT_EQ(status.status, NanStatusType::INVALID_ARGS); } @@ -610,12 +540,12 @@ TEST_P(WifiNanIfaceHidlTest, configRequest_1_6ShimInvalidArgs) { */ TEST_P(WifiNanIfaceHidlTest, notifyCapabilitiesResponse_1_6) { uint16_t inputCmdId = 10; - callbackType = INVALID; + callbackEventBitMap = INVALID; const auto& halStatus = HIDL_INVOKE(iwifiNanIface, getCapabilitiesRequest_1_5, inputCmdId).code; ASSERT_EQ(WifiStatusCode::SUCCESS, halStatus); // wait for a callback ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_CAPABILITIES_RESPONSE_1_6)); - ASSERT_EQ(NOTIFY_CAPABILITIES_RESPONSE_1_6, callbackType); + ASSERT_EQ(0x1 << NOTIFY_CAPABILITIES_RESPONSE_1_6, callbackEventBitMap & (0x1 << NOTIFY_CAPABILITIES_RESPONSE_1_6)); ASSERT_EQ(id, inputCmdId); ASSERT_EQ(status.status, NanStatusType::SUCCESS); @@ -711,7 +641,7 @@ TEST_P(WifiNanIfaceHidlTest, startPublishRequest_1_6) { nanConfigRequestSupp.V1_5.V1_2.numberOfSpatialStreamsInDiscovery = 0; nanConfigRequestSupp.V1_5.V1_2.enableDiscoveryWindowEarlyTermination = false; - callbackType = INVALID; + callbackEventBitMap = INVALID; const auto& halStatus = HIDL_INVOKE(iwifiNanIface, enableRequest_1_6, inputCmdId, req, nanConfigRequestSupp); @@ -720,7 +650,7 @@ TEST_P(WifiNanIfaceHidlTest, startPublishRequest_1_6) { // wait for a callback ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_ENABLE_RESPONSE)); - ASSERT_EQ(NOTIFY_ENABLE_RESPONSE, callbackType); + ASSERT_EQ(0x1 << NOTIFY_ENABLE_RESPONSE, callbackEventBitMap & (0x1 << NOTIFY_ENABLE_RESPONSE)); ASSERT_EQ(id, inputCmdId); ASSERT_EQ(status.status, NanStatusType::SUCCESS); } @@ -749,7 +679,7 @@ TEST_P(WifiNanIfaceHidlTest, startPublishRequest_1_6) { // wait for a callback ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_START_PUBLISH_RESPONSE)); - ASSERT_EQ(NOTIFY_START_PUBLISH_RESPONSE, callbackType); + ASSERT_EQ(0x1 << NOTIFY_START_PUBLISH_RESPONSE, callbackEventBitMap & (0x1 << NOTIFY_START_PUBLISH_RESPONSE)); ASSERT_EQ(id, inputCmdId + 1); ASSERT_EQ(status.status, NanStatusType::SUCCESS); } @@ -760,7 +690,7 @@ TEST_P(WifiNanIfaceHidlTest, startPublishRequest_1_6) { */ TEST_P(WifiNanIfaceHidlTest, respondToDataPathIndicationRequest_1_6ShimInvalidArgs) { uint16_t inputCmdId = 10; - callbackType = INVALID; + callbackEventBitMap = INVALID; ::android::hardware::wifi::V1_6::NanRespondToDataPathIndicationRequest nanRespondToDataPathIndicationRequest = {}; nanRespondToDataPathIndicationRequest.ifaceName = "AwareinterfaceNameTooLong"; @@ -777,7 +707,7 @@ TEST_P(WifiNanIfaceHidlTest, respondToDataPathIndicationRequest_1_6ShimInvalidAr */ TEST_P(WifiNanIfaceHidlTest, initiateDataPathRequest_1_6ShimInvalidArgs) { uint16_t inputCmdId = 10; - callbackType = INVALID; + callbackEventBitMap = INVALID; ::android::hardware::wifi::V1_6::NanInitiateDataPathRequest nanInitiateDataPathRequest = {}; nanInitiateDataPathRequest.ifaceName = "AwareinterfaceNameTooLong"; const auto& halStatus = HIDL_INVOKE(iwifiNanIface, initiateDataPathRequest_1_6, inputCmdId, diff --git a/wifi/hostapd/1.2/vts/functional/hostapd_hidl_test.cpp b/wifi/hostapd/1.2/vts/functional/hostapd_hidl_test.cpp index 2fade4dc6b..5c59819e82 100644 --- a/wifi/hostapd/1.2/vts/functional/hostapd_hidl_test.cpp +++ b/wifi/hostapd/1.2/vts/functional/hostapd_hidl_test.cpp @@ -122,7 +122,8 @@ class HostapdHidlTest IHostapd::IfaceParams getIfaceParamsWithAcs(std::string iface_name) { // First get the settings for WithoutAcs and then make changes - IHostapd::IfaceParams iface_params_1_2 = getIfaceParamsWithoutAcs(iface_name); + IHostapd::IfaceParams iface_params_1_2 = + getIfaceParamsWithoutAcs(iface_name); iface_params_1_2.V1_1.V1_0.channelParams.enableAcs = true; iface_params_1_2.V1_1.V1_0.channelParams.acsShouldExcludeDfs = true; iface_params_1_2.V1_1.V1_0.channelParams.channel = 0; @@ -132,8 +133,10 @@ class HostapdHidlTest return iface_params_1_2; } - IHostapd::IfaceParams getIfaceParamsWithAcsAndFreqRange(std::string iface_name) { - IHostapd::IfaceParams iface_params_1_2 = getIfaceParamsWithAcs(iface_name); + IHostapd::IfaceParams getIfaceParamsWithAcsAndFreqRange( + std::string iface_name) { + IHostapd::IfaceParams iface_params_1_2 = + getIfaceParamsWithAcs(iface_name); ::android::hardware::wifi::hostapd::V1_2::IHostapd::AcsFrequencyRange acsFrequencyRange; acsFrequencyRange.start = 2412; @@ -147,8 +150,10 @@ class HostapdHidlTest return iface_params_1_2; } - IHostapd::IfaceParams getIfaceParamsWithAcsAndInvalidFreqRange(std::string iface_name) { - IHostapd::IfaceParams iface_params_1_2 = getIfaceParamsWithAcsAndFreqRange(iface_name); + IHostapd::IfaceParams getIfaceParamsWithAcsAndInvalidFreqRange( + std::string iface_name) { + IHostapd::IfaceParams iface_params_1_2 = + getIfaceParamsWithAcsAndFreqRange(iface_name); iface_params_1_2.channelParams.acsChannelFreqRangesMhz[0].start = 222; iface_params_1_2.channelParams.acsChannelFreqRangesMhz[0].end = 999; return iface_params_1_2; @@ -210,8 +215,10 @@ class HostapdHidlTest return nw_params_1_2; } - IHostapd::IfaceParams getIfaceParamsWithInvalidChannel(std::string iface_name) { - IHostapd::IfaceParams iface_params_1_2 = getIfaceParamsWithoutAcs(iface_name); + IHostapd::IfaceParams getIfaceParamsWithInvalidChannel( + std::string iface_name) { + IHostapd::IfaceParams iface_params_1_2 = + getIfaceParamsWithoutAcs(iface_name); iface_params_1_2.V1_1.V1_0.channelParams.channel = kIfaceInvalidChannel; return iface_params_1_2; } @@ -237,8 +244,8 @@ TEST_P(HostapdHidlTest, AddPskAccessPointWithAcs) { if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; std::string ifname = setupApIfaceIfNeededAndGetName(); - auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithAcs(ifname), - getPskNwParams()); + auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, + getIfaceParamsWithAcs(ifname), getPskNwParams()); EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code); } @@ -252,7 +259,8 @@ TEST_P(HostapdHidlTest, AddPskAccessPointWithAcsAndFreqRange) { GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; std::string ifname = setupApIfaceIfNeededAndGetName(); auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, - getIfaceParamsWithAcsAndFreqRange(ifname), getPskNwParams()); + getIfaceParamsWithAcsAndFreqRange(ifname), + getPskNwParams()); EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code); } @@ -266,7 +274,8 @@ TEST_P(HostapdHidlTest, AddPskAccessPointWithAcsAndInvalidFreqRange) { GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; std::string ifname = setupApIfaceIfNeededAndGetName(); auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, - getIfaceParamsWithAcsAndInvalidFreqRange(ifname), getPskNwParams()); + getIfaceParamsWithAcsAndInvalidFreqRange(ifname), + getPskNwParams()); EXPECT_NE(HostapdStatusCode::SUCCESS, status.code); } @@ -279,8 +288,8 @@ TEST_P(HostapdHidlTest, AddOpenAccessPointWithAcs) { if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; std::string ifname = setupApIfaceIfNeededAndGetName(); - auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithAcs(ifname), - getOpenNwParams()); + auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, + getIfaceParamsWithAcs(ifname), getOpenNwParams()); EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code); } @@ -292,8 +301,9 @@ TEST_P(HostapdHidlTest, AddPskAccessPointWithoutAcs) { if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; std::string ifname = setupApIfaceIfNeededAndGetName(); - auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname), - getPskNwParams()); + auto status = + HIDL_INVOKE(hostapd_, addAccessPoint_1_2, + getIfaceParamsWithoutAcs(ifname), getPskNwParams()); EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code); } @@ -305,8 +315,9 @@ TEST_P(HostapdHidlTest, AddOpenAccessPointWithoutAcs) { if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; std::string ifname = setupApIfaceIfNeededAndGetName(); - auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname), - getOpenNwParams()); + auto status = + HIDL_INVOKE(hostapd_, addAccessPoint_1_2, + getIfaceParamsWithoutAcs(ifname), getOpenNwParams()); EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code); } @@ -319,7 +330,8 @@ TEST_P(HostapdHidlTest, AddSaeTransitionAccessPointWithoutAcs) { if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; std::string ifname = setupApIfaceIfNeededAndGetName(); - auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname), + auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, + getIfaceParamsWithoutAcs(ifname), getSaeTransitionNwParams()); EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code); } @@ -333,8 +345,9 @@ TEST_P(HostapdHidlTest, AddSAEAccessPointWithoutAcs) { if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; std::string ifname = setupApIfaceIfNeededAndGetName(); - auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname), - getSaeNwParams()); + auto status = + HIDL_INVOKE(hostapd_, addAccessPoint_1_2, + getIfaceParamsWithoutAcs(ifname), getSaeNwParams()); EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code); } @@ -347,8 +360,9 @@ TEST_P(HostapdHidlTest, RemoveAccessPointWithAcs) { if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; std::string ifname = setupApIfaceIfNeededAndGetName(); - auto status_1_2 = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithAcs(ifname), - getPskNwParams()); + auto status_1_2 = + HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithAcs(ifname), + getPskNwParams()); EXPECT_EQ(HostapdStatusCode::SUCCESS, status_1_2.code); auto status = HIDL_INVOKE(hostapd_, removeAccessPoint, ifname); EXPECT_EQ( @@ -364,8 +378,9 @@ TEST_P(HostapdHidlTest, RemoveAccessPointWithoutAcs) { if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; std::string ifname = setupApIfaceIfNeededAndGetName(); - auto status_1_2 = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname), - getPskNwParams()); + auto status_1_2 = + HIDL_INVOKE(hostapd_, addAccessPoint_1_2, + getIfaceParamsWithoutAcs(ifname), getPskNwParams()); EXPECT_EQ(HostapdStatusCode::SUCCESS, status_1_2.code); auto status = HIDL_INVOKE(hostapd_, removeAccessPoint, ifname); EXPECT_EQ( @@ -381,8 +396,9 @@ TEST_P(HostapdHidlTest, AddPskAccessPointWithInvalidChannel) { if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; std::string ifname = setupApIfaceIfNeededAndGetName(); - auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, - getIfaceParamsWithInvalidChannel(ifname), getPskNwParams()); + auto status = + HIDL_INVOKE(hostapd_, addAccessPoint_1_2, + getIfaceParamsWithInvalidChannel(ifname), getPskNwParams()); EXPECT_NE(HostapdStatusCode::SUCCESS, status.code); } @@ -394,8 +410,9 @@ TEST_P(HostapdHidlTest, AddInvalidPskAccessPointWithoutAcs) { if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; std::string ifname = setupApIfaceIfNeededAndGetName(); - auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname), - getInvalidPskNwParams()); + auto status = + HIDL_INVOKE(hostapd_, addAccessPoint_1_2, + getIfaceParamsWithoutAcs(ifname), getInvalidPskNwParams()); EXPECT_NE(HostapdStatusCode::SUCCESS, status.code); } @@ -408,7 +425,8 @@ TEST_P(HostapdHidlTest, AddInvalidSaeTransitionAccessPointWithoutAcs) { if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; std::string ifname = setupApIfaceIfNeededAndGetName(); - auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname), + auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, + getIfaceParamsWithoutAcs(ifname), getInvalidSaeTransitionNwParams()); EXPECT_NE(HostapdStatusCode::SUCCESS, status.code); } @@ -422,8 +440,9 @@ TEST_P(HostapdHidlTest, AddInvalidSaeAccessPointWithoutAcs) { if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; std::string ifname = setupApIfaceIfNeededAndGetName(); - auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname), - getInvalidSaeNwParams()); + auto status = + HIDL_INVOKE(hostapd_, addAccessPoint_1_2, + getIfaceParamsWithoutAcs(ifname), getInvalidSaeNwParams()); EXPECT_NE(HostapdStatusCode::SUCCESS, status.code); } @@ -433,8 +452,8 @@ TEST_P(HostapdHidlTest, AddInvalidSaeAccessPointWithoutAcs) { */ TEST_P(HostapdHidlTest, DisconnectClientWhenIfaceNotAvailable) { std::string ifname = setupApIfaceIfNeededAndGetName(); - auto status = HIDL_INVOKE(hostapd_, forceClientDisconnect, ifname, kTestZeroMacAddr, - kTestDisconnectReasonCode); + auto status = HIDL_INVOKE(hostapd_, forceClientDisconnect, ifname, + kTestZeroMacAddr, kTestDisconnectReasonCode); EXPECT_EQ(HostapdStatusCode::FAILURE_IFACE_UNKNOWN, status.code); } @@ -446,12 +465,13 @@ TEST_P(HostapdHidlTest, DisconnectClientWhenIfacAvailable) { if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; std::string ifname = setupApIfaceIfNeededAndGetName(); - auto status_1_2 = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname), - getOpenNwParams()); + auto status_1_2 = + HIDL_INVOKE(hostapd_, addAccessPoint_1_2, + getIfaceParamsWithoutAcs(ifname), getOpenNwParams()); EXPECT_EQ(HostapdStatusCode::SUCCESS, status_1_2.code); - status_1_2 = HIDL_INVOKE(hostapd_, forceClientDisconnect, ifname, kTestZeroMacAddr, - kTestDisconnectReasonCode); + status_1_2 = HIDL_INVOKE(hostapd_, forceClientDisconnect, ifname, + kTestZeroMacAddr, kTestDisconnectReasonCode); EXPECT_EQ(HostapdStatusCode::FAILURE_CLIENT_UNKNOWN, status_1_2.code); } |