Merge "wifi: Fix for VtsHalWifiSupplicantV1_0TargetTest failures"

This commit is contained in:
Sunil Ravi 2020-02-12 23:17:13 +00:00 committed by Android (Google) Code Review
commit 2350a89e78
2 changed files with 35 additions and 1 deletions

View file

@ -46,6 +46,8 @@ cc_test {
"VtsHalWifiSupplicantV1_0TargetTestUtil",
"android.hardware.wifi.supplicant@1.0",
"android.hardware.wifi.supplicant@1.1",
"android.hardware.wifi.supplicant@1.2",
"android.hardware.wifi.supplicant@1.3",
"android.hardware.wifi@1.0",
"libgmock",
"libwifi-system",

View file

@ -19,6 +19,7 @@
#include <VtsCoreUtil.h>
#include <android/hardware/wifi/1.0/IWifi.h>
#include <android/hardware/wifi/supplicant/1.0/ISupplicantStaNetwork.h>
#include <android/hardware/wifi/supplicant/1.3/ISupplicantStaNetwork.h>
#include <gtest/gtest.h>
#include <hidl/GtestPrinter.h>
#include <hidl/ServiceManagement.h>
@ -93,6 +94,11 @@ class SupplicantStaNetworkHidlTest
EXPECT_TRUE(turnOnExcessiveLogging(supplicant_));
sta_network_ = createSupplicantStaNetwork(supplicant_);
ASSERT_NE(sta_network_.get(), nullptr);
/* variable used to check if the underlying HAL version is 1.3 or
* higher. This is to skip tests which are using deprecated methods.
*/
v1_3 = ::android::hardware::wifi::supplicant::V1_3::
ISupplicantStaNetwork::castFrom(sta_network_);
ssid_.assign(kTestSsidStr, kTestSsidStr + strlen(kTestSsidStr));
}
@ -114,6 +120,8 @@ class SupplicantStaNetworkHidlTest
});
}
sp<::android::hardware::wifi::supplicant::V1_3::ISupplicantStaNetwork>
v1_3 = nullptr;
bool isP2pOn_ = false;
sp<ISupplicant> supplicant_;
// ISupplicantStaNetwork object used for all tests in this fixture.
@ -221,6 +229,9 @@ TEST_P(SupplicantStaNetworkHidlTest, SetGetBssid) {
* SetGetKeyMgmt
*/
TEST_P(SupplicantStaNetworkHidlTest, SetGetKeyMgmt) {
if (v1_3 != nullptr) {
GTEST_SKIP() << "Skipping test since HAL is 1.3 or higher";
}
sta_network_->setKeyMgmt(kTestKeyMgmt, [](const SupplicantStatus& status) {
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
});
@ -235,6 +246,9 @@ TEST_P(SupplicantStaNetworkHidlTest, SetGetKeyMgmt) {
* SetGetProto
*/
TEST_P(SupplicantStaNetworkHidlTest, SetGetProto) {
if (v1_3 != nullptr) {
GTEST_SKIP() << "Skipping test since HAL is 1.3 or higher";
}
sta_network_->setProto(kTestProto, [](const SupplicantStatus& status) {
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
});
@ -262,6 +276,9 @@ TEST_P(SupplicantStaNetworkHidlTest, SetGetAuthAlg) {
* SetGetGroupCipher
*/
TEST_P(SupplicantStaNetworkHidlTest, SetGetGroupCipher) {
if (v1_3 != nullptr) {
GTEST_SKIP() << "Skipping test since HAL is 1.3 or higher";
}
sta_network_->setGroupCipher(
kTestGroupCipher, [](const SupplicantStatus& status) {
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
@ -277,6 +294,9 @@ TEST_P(SupplicantStaNetworkHidlTest, SetGetGroupCipher) {
* SetGetPairwiseCipher
*/
TEST_P(SupplicantStaNetworkHidlTest, SetGetPairwiseCipher) {
if (v1_3 != nullptr) {
GTEST_SKIP() << "Skipping test since HAL is 1.3 or higher";
}
sta_network_->setPairwiseCipher(
kTestPairwiseCipher, [](const SupplicantStatus& status) {
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
@ -627,6 +647,9 @@ TEST_P(SupplicantStaNetworkHidlTest, SetGetEapEngineID) {
* Enable
*/
TEST_P(SupplicantStaNetworkHidlTest, Enable) {
if (v1_3 != nullptr) {
GTEST_SKIP() << "Skipping test since HAL is 1.3 or higher";
}
// wpa_supplicant doesn't perform any connection initiation
// unless atleast the Ssid and Ket mgmt params are set.
sta_network_->setSsid(ssid_, [](const SupplicantStatus& status) {
@ -654,6 +677,9 @@ TEST_P(SupplicantStaNetworkHidlTest, Enable) {
* Disable
*/
TEST_P(SupplicantStaNetworkHidlTest, Disable) {
if (v1_3 != nullptr) {
GTEST_SKIP() << "Skipping test since HAL is 1.3 or higher";
}
// wpa_supplicant doesn't perform any connection initiation
// unless atleast the Ssid and Ket mgmt params are set.
sta_network_->setSsid(ssid_, [](const SupplicantStatus& status) {
@ -677,6 +703,9 @@ TEST_P(SupplicantStaNetworkHidlTest, Disable) {
* Select.
*/
TEST_P(SupplicantStaNetworkHidlTest, Select) {
if (v1_3 != nullptr) {
GTEST_SKIP() << "Skipping test since HAL is 1.3 or higher";
}
// wpa_supplicant doesn't perform any connection initiation
// unless atleast the Ssid and Ket mgmt params are set.
sta_network_->setSsid(ssid_, [](const SupplicantStatus& status) {
@ -788,6 +817,9 @@ TEST_P(SupplicantStaNetworkHidlTest, SetProactiveKeyCaching) {
* GetWpsNfcConfigurationToken
*/
TEST_P(SupplicantStaNetworkHidlTest, GetWpsNfcConfigurationToken) {
if (v1_3 != nullptr) {
GTEST_SKIP() << "Skipping test since HAL is 1.3 or higher";
}
ASSERT_EQ(SupplicantStatusCode::SUCCESS,
HIDL_INVOKE(sta_network_, setSsid, ssid_).code);
ASSERT_EQ(SupplicantStatusCode::SUCCESS,
@ -808,4 +840,4 @@ INSTANTIATE_TEST_CASE_P(
android::hardware::getAllHalInstanceNames(IWifi::descriptor)),
testing::ValuesIn(android::hardware::getAllHalInstanceNames(
ISupplicant::descriptor))),
android::hardware::PrintInstanceTupleNameToString<>);
android::hardware::PrintInstanceTupleNameToString<>);