mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:50:18 +00:00
Convert VtsHalWifiV1_*Target to be parameterized test
Bug: 142397658 Bug: 142304083 Test: atest \ VtsHalWifiV1_0TargetTest \ VtsHalWifiNanV1_0TargetTest \ VtsHalWifiApV1_0TargetTest \ VtsHalWifiV1_1TargetTest \ VtsHalWifiV1_2TargetTest \ VtsHalWifiNanV1_2TargetTest \ VtsHalWifiV1_3TargetTest \ VtsHalWifiApV1_4TargetTest Change-Id: I05bf1c4cff378a99c015ac514eefb49debb8b1af
This commit is contained in:
@@ -50,7 +50,7 @@ cc_test {
|
||||
"android.hardware.wifi@1.2",
|
||||
"android.hardware.wifi@1.3",
|
||||
],
|
||||
test_suites: ["general-tests"],
|
||||
test_suites: ["general-tests", "vts-core"],
|
||||
}
|
||||
|
||||
// These tests are split out so that they can be conditioned on presence of the
|
||||
@@ -67,7 +67,7 @@ cc_test {
|
||||
"VtsHalWifiV1_0TargetTestUtil",
|
||||
"android.hardware.wifi@1.0",
|
||||
],
|
||||
test_suites: ["general-tests"],
|
||||
test_suites: ["general-tests", "vts-core"],
|
||||
}
|
||||
|
||||
// These tests are split out so that they can be conditioned on presence of
|
||||
@@ -84,5 +84,5 @@ cc_test {
|
||||
"VtsHalWifiV1_0TargetTestUtil",
|
||||
"android.hardware.wifi@1.0",
|
||||
],
|
||||
test_suites: ["general-tests"],
|
||||
test_suites: ["general-tests", "vts-core"],
|
||||
}
|
||||
|
||||
@@ -14,34 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <VtsHalHidlTargetTestEnvBase.h>
|
||||
|
||||
#include "wifi_hidl_test_utils.h"
|
||||
|
||||
class WifiVtsHidlEnvironment_1_0 : public WifiHidlEnvironment {
|
||||
public:
|
||||
// get the test environment singleton
|
||||
static WifiVtsHidlEnvironment_1_0* Instance() {
|
||||
static WifiVtsHidlEnvironment_1_0* instance =
|
||||
new WifiVtsHidlEnvironment_1_0;
|
||||
return instance;
|
||||
}
|
||||
|
||||
virtual void registerTestServices() override {
|
||||
registerTestService<android::hardware::wifi::V1_0::IWifi>();
|
||||
}
|
||||
|
||||
private:
|
||||
WifiVtsHidlEnvironment_1_0() {}
|
||||
};
|
||||
|
||||
WifiHidlEnvironment* gEnv = WifiVtsHidlEnvironment_1_0::Instance();
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
::testing::AddGlobalTestEnvironment(gEnv);
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
gEnv->init(&argc, argv);
|
||||
int status = RUN_ALL_TESTS();
|
||||
LOG(INFO) << "Test result = " << status;
|
||||
return status;
|
||||
}
|
||||
// TODO(b/143892896): Remove this file after wifi_hidl_test_utils.cpp is
|
||||
// updated.
|
||||
::testing::VtsHalHidlTargetTestEnvBase* gEnv = nullptr;
|
||||
@@ -16,35 +16,37 @@
|
||||
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include <android/hardware/wifi/1.0/IWifi.h>
|
||||
#include <android/hardware/wifi/1.0/IWifiApIface.h>
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <hidl/GtestPrinter.h>
|
||||
#include <hidl/ServiceManagement.h>
|
||||
|
||||
#include "wifi_hidl_call_util.h"
|
||||
#include "wifi_hidl_test_utils.h"
|
||||
|
||||
using ::android::sp;
|
||||
using ::android::hardware::wifi::V1_0::IfaceType;
|
||||
using ::android::hardware::wifi::V1_0::IWifi;
|
||||
using ::android::hardware::wifi::V1_0::IWifiApIface;
|
||||
using ::android::hardware::wifi::V1_0::WifiBand;
|
||||
using ::android::hardware::wifi::V1_0::WifiStatusCode;
|
||||
using ::android::sp;
|
||||
|
||||
/**
|
||||
* Fixture to use for all AP Iface HIDL interface tests.
|
||||
*/
|
||||
class WifiApIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
class WifiApIfaceHidlTest : public ::testing::TestWithParam<std::string> {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
wifi_ap_iface_ = getWifiApIface();
|
||||
wifi_ap_iface_ = getWifiApIface(GetInstanceName());
|
||||
ASSERT_NE(nullptr, wifi_ap_iface_.get());
|
||||
}
|
||||
|
||||
virtual void TearDown() override {
|
||||
stopWifi();
|
||||
}
|
||||
virtual void TearDown() override { stopWifi(GetInstanceName()); }
|
||||
|
||||
protected:
|
||||
sp<IWifiApIface> wifi_ap_iface_;
|
||||
std::string GetInstanceName() { return GetParam(); }
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -52,16 +54,15 @@ class WifiApIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
* Ensures that an instance of the IWifiApIface proxy object is
|
||||
* successfully created.
|
||||
*/
|
||||
TEST(WifiApIfaceHidlTestNoFixture, Create) {
|
||||
EXPECT_NE(nullptr, getWifiApIface().get());
|
||||
stopWifi();
|
||||
TEST_P(WifiApIfaceHidlTest, Create) {
|
||||
// The creation of a proxy object is tested as part of SetUp method.
|
||||
}
|
||||
|
||||
/*
|
||||
* GetType:
|
||||
* Ensures that the correct interface type is returned for AP interface.
|
||||
*/
|
||||
TEST_F(WifiApIfaceHidlTest, GetType) {
|
||||
TEST_P(WifiApIfaceHidlTest, GetType) {
|
||||
const auto& status_and_type = HIDL_INVOKE(wifi_ap_iface_, getType);
|
||||
EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_type.first.code);
|
||||
EXPECT_EQ(IfaceType::AP, status_and_type.second);
|
||||
@@ -72,7 +73,7 @@ TEST_F(WifiApIfaceHidlTest, GetType) {
|
||||
* Ensures that a call to set the country code will return with a success
|
||||
* status code.
|
||||
*/
|
||||
TEST_F(WifiApIfaceHidlTest, SetCountryCode) {
|
||||
TEST_P(WifiApIfaceHidlTest, SetCountryCode) {
|
||||
const android::hardware::hidl_array<int8_t, 2> kCountryCode{
|
||||
std::array<int8_t, 2>{{0x55, 0x53}}};
|
||||
EXPECT_EQ(WifiStatusCode::SUCCESS,
|
||||
@@ -83,9 +84,15 @@ TEST_F(WifiApIfaceHidlTest, SetCountryCode) {
|
||||
* GetValidFrequenciesForBand:
|
||||
* Ensures that we can retrieve valid frequencies for 2.4 GHz band.
|
||||
*/
|
||||
TEST_F(WifiApIfaceHidlTest, GetValidFrequenciesForBand) {
|
||||
TEST_P(WifiApIfaceHidlTest, GetValidFrequenciesForBand) {
|
||||
const auto& status_and_freqs = HIDL_INVOKE(
|
||||
wifi_ap_iface_, getValidFrequenciesForBand, WifiBand::BAND_24GHZ);
|
||||
EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_freqs.first.code);
|
||||
EXPECT_GT(status_and_freqs.second.size(), 0u);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
PerInstance, WifiApIfaceHidlTest,
|
||||
testing::ValuesIn(
|
||||
android::hardware::getAllHalInstanceNames(IWifi::descriptor)),
|
||||
android::hardware::PrintInstanceNameToString);
|
||||
@@ -16,9 +16,11 @@
|
||||
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include <android/hardware/wifi/1.0/IWifi.h>
|
||||
#include <android/hardware/wifi/1.0/IWifiChip.h>
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <hidl/GtestPrinter.h>
|
||||
#include <hidl/ServiceManagement.h>
|
||||
|
||||
#include "wifi_hidl_call_util.h"
|
||||
#include "wifi_hidl_test_utils.h"
|
||||
@@ -26,6 +28,7 @@
|
||||
using ::android::sp;
|
||||
using ::android::hardware::wifi::V1_0::ChipModeId;
|
||||
using ::android::hardware::wifi::V1_0::IfaceType;
|
||||
using ::android::hardware::wifi::V1_0::IWifi;
|
||||
using ::android::hardware::wifi::V1_0::IWifiApIface;
|
||||
using ::android::hardware::wifi::V1_0::IWifiChip;
|
||||
using ::android::hardware::wifi::V1_0::IWifiIface;
|
||||
@@ -35,14 +38,14 @@ using ::android::hardware::wifi::V1_0::WifiStatusCode;
|
||||
/**
|
||||
* Fixture for IWifiChip tests that are conditioned on SoftAP support.
|
||||
*/
|
||||
class WifiChipHidlApTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
class WifiChipHidlApTest : public ::testing::TestWithParam<std::string> {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
wifi_chip_ = getWifiChip();
|
||||
wifi_chip_ = getWifiChip(GetInstanceName());
|
||||
ASSERT_NE(nullptr, wifi_chip_.get());
|
||||
}
|
||||
|
||||
virtual void TearDown() override { stopWifi(); }
|
||||
virtual void TearDown() override { stopWifi(GetInstanceName()); }
|
||||
|
||||
protected:
|
||||
// Helper function to configure the Chip in one of the supported modes.
|
||||
@@ -72,6 +75,9 @@ class WifiChipHidlApTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
}
|
||||
|
||||
sp<IWifiChip> wifi_chip_;
|
||||
|
||||
private:
|
||||
std::string GetInstanceName() { return GetParam(); }
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -79,7 +85,7 @@ class WifiChipHidlApTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
* Configures the chip in AP mode and ensures that at least 1 iface creation
|
||||
* succeeds.
|
||||
*/
|
||||
TEST_F(WifiChipHidlApTest, CreateApIface) {
|
||||
TEST_P(WifiChipHidlApTest, CreateApIface) {
|
||||
configureChipForIfaceType(IfaceType::AP, true);
|
||||
|
||||
sp<IWifiApIface> iface;
|
||||
@@ -93,7 +99,7 @@ TEST_F(WifiChipHidlApTest, CreateApIface) {
|
||||
* before creating the iface. Then, create the iface and ensure that
|
||||
* iface name is returned via the list.
|
||||
*/
|
||||
TEST_F(WifiChipHidlApTest, GetApIfaceNames) {
|
||||
TEST_P(WifiChipHidlApTest, GetApIfaceNames) {
|
||||
configureChipForIfaceType(IfaceType::AP, true);
|
||||
|
||||
const auto& status_and_iface_names1 =
|
||||
@@ -125,7 +131,7 @@ TEST_F(WifiChipHidlApTest, GetApIfaceNames) {
|
||||
* the iface object using the correct name and ensure any other name
|
||||
* doesn't retrieve an iface object.
|
||||
*/
|
||||
TEST_F(WifiChipHidlApTest, GetApIface) {
|
||||
TEST_P(WifiChipHidlApTest, GetApIface) {
|
||||
configureChipForIfaceType(IfaceType::AP, true);
|
||||
|
||||
sp<IWifiApIface> ap_iface;
|
||||
@@ -151,7 +157,7 @@ TEST_F(WifiChipHidlApTest, GetApIface) {
|
||||
* the iface object using the correct name and ensure any other name
|
||||
* doesn't remove the iface.
|
||||
*/
|
||||
TEST_F(WifiChipHidlApTest, RemoveApIface) {
|
||||
TEST_P(WifiChipHidlApTest, RemoveApIface) {
|
||||
configureChipForIfaceType(IfaceType::AP, true);
|
||||
|
||||
sp<IWifiApIface> ap_iface;
|
||||
@@ -166,3 +172,9 @@ TEST_F(WifiChipHidlApTest, RemoveApIface) {
|
||||
// No such iface exists now. So, this should return failure.
|
||||
EXPECT_EQ(WifiStatusCode::ERROR_INVALID_ARGS, removeApIface(iface_name));
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
PerInstance, WifiChipHidlApTest,
|
||||
testing::ValuesIn(
|
||||
android::hardware::getAllHalInstanceNames(IWifi::descriptor)),
|
||||
android::hardware::PrintInstanceNameToString);
|
||||
@@ -16,9 +16,11 @@
|
||||
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include <android/hardware/wifi/1.0/IWifi.h>
|
||||
#include <android/hardware/wifi/1.0/IWifiChip.h>
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <hidl/GtestPrinter.h>
|
||||
#include <hidl/ServiceManagement.h>
|
||||
|
||||
#include "wifi_hidl_call_util.h"
|
||||
#include "wifi_hidl_test_utils.h"
|
||||
@@ -26,6 +28,7 @@
|
||||
using ::android::sp;
|
||||
using ::android::hardware::wifi::V1_0::ChipModeId;
|
||||
using ::android::hardware::wifi::V1_0::IfaceType;
|
||||
using ::android::hardware::wifi::V1_0::IWifi;
|
||||
using ::android::hardware::wifi::V1_0::IWifiChip;
|
||||
using ::android::hardware::wifi::V1_0::IWifiIface;
|
||||
using ::android::hardware::wifi::V1_0::IWifiNanIface;
|
||||
@@ -35,14 +38,14 @@ using ::android::hardware::wifi::V1_0::WifiStatusCode;
|
||||
/**
|
||||
* Fixture for IWifiChip tests that are conditioned on NAN support.
|
||||
*/
|
||||
class WifiChipHidlNanTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
class WifiChipHidlNanTest : public ::testing::TestWithParam<std::string> {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
wifi_chip_ = getWifiChip();
|
||||
wifi_chip_ = getWifiChip(GetInstanceName());
|
||||
ASSERT_NE(nullptr, wifi_chip_.get());
|
||||
}
|
||||
|
||||
virtual void TearDown() override { stopWifi(); }
|
||||
virtual void TearDown() override { stopWifi(GetInstanceName()); }
|
||||
|
||||
protected:
|
||||
// Helper function to configure the Chip in one of the supported modes.
|
||||
@@ -72,6 +75,9 @@ class WifiChipHidlNanTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
}
|
||||
|
||||
sp<IWifiChip> wifi_chip_;
|
||||
|
||||
private:
|
||||
std::string GetInstanceName() { return GetParam(); }
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -79,7 +85,7 @@ class WifiChipHidlNanTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
* Configures the chip in NAN mode and ensures that at least 1 iface creation
|
||||
* succeeds.
|
||||
*/
|
||||
TEST_F(WifiChipHidlNanTest, CreateNanIface) {
|
||||
TEST_P(WifiChipHidlNanTest, CreateNanIface) {
|
||||
configureChipForIfaceType(IfaceType::NAN, true);
|
||||
|
||||
sp<IWifiNanIface> iface;
|
||||
@@ -93,7 +99,7 @@ TEST_F(WifiChipHidlNanTest, CreateNanIface) {
|
||||
* before creating the iface. Then, create the iface and ensure that
|
||||
* iface name is returned via the list.
|
||||
*/
|
||||
TEST_F(WifiChipHidlNanTest, GetNanIfaceNames) {
|
||||
TEST_P(WifiChipHidlNanTest, GetNanIfaceNames) {
|
||||
configureChipForIfaceType(IfaceType::NAN, true);
|
||||
|
||||
const auto& status_and_iface_names1 =
|
||||
@@ -125,7 +131,7 @@ TEST_F(WifiChipHidlNanTest, GetNanIfaceNames) {
|
||||
* the iface object using the correct name and ensure any other name
|
||||
* doesn't retrieve an iface object.
|
||||
*/
|
||||
TEST_F(WifiChipHidlNanTest, GetNanIface) {
|
||||
TEST_P(WifiChipHidlNanTest, GetNanIface) {
|
||||
configureChipForIfaceType(IfaceType::NAN, true);
|
||||
|
||||
sp<IWifiNanIface> nan_iface;
|
||||
@@ -151,7 +157,7 @@ TEST_F(WifiChipHidlNanTest, GetNanIface) {
|
||||
* the iface object using the correct name and ensure any other name
|
||||
* doesn't remove the iface.
|
||||
*/
|
||||
TEST_F(WifiChipHidlNanTest, RemoveNanIface) {
|
||||
TEST_P(WifiChipHidlNanTest, RemoveNanIface) {
|
||||
configureChipForIfaceType(IfaceType::NAN, true);
|
||||
|
||||
sp<IWifiNanIface> nan_iface;
|
||||
@@ -167,3 +173,9 @@ TEST_F(WifiChipHidlNanTest, RemoveNanIface) {
|
||||
// No such iface exists now. So, this should return failure.
|
||||
EXPECT_EQ(WifiStatusCode::ERROR_INVALID_ARGS, removeNanIface(iface_name));
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
PerInstance, WifiChipHidlNanTest,
|
||||
testing::ValuesIn(
|
||||
android::hardware::getAllHalInstanceNames(IWifi::descriptor)),
|
||||
android::hardware::PrintInstanceNameToString);
|
||||
@@ -16,10 +16,12 @@
|
||||
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include <android/hardware/wifi/1.0/IWifi.h>
|
||||
#include <android/hardware/wifi/1.0/IWifiChip.h>
|
||||
#include <android/hardware/wifi/1.3/IWifiChip.h>
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <hidl/GtestPrinter.h>
|
||||
#include <hidl/ServiceManagement.h>
|
||||
|
||||
#include "wifi_hidl_call_util.h"
|
||||
#include "wifi_hidl_test_utils.h"
|
||||
@@ -27,19 +29,20 @@
|
||||
using ::android::sp;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::wifi::V1_0::IfaceType;
|
||||
using ::android::hardware::wifi::V1_0::ChipId;
|
||||
using ::android::hardware::wifi::V1_0::ChipModeId;
|
||||
using ::android::hardware::wifi::V1_0::WifiDebugRingBufferStatus;
|
||||
using ::android::hardware::wifi::V1_0::WifiDebugRingBufferVerboseLevel;
|
||||
using ::android::hardware::wifi::V1_0::WifiDebugHostWakeReasonStats;
|
||||
using ::android::hardware::wifi::V1_0::WifiStatus;
|
||||
using ::android::hardware::wifi::V1_0::WifiStatusCode;
|
||||
using ::android::hardware::wifi::V1_0::IfaceType;
|
||||
using ::android::hardware::wifi::V1_0::IWifi;
|
||||
using ::android::hardware::wifi::V1_0::IWifiChip;
|
||||
using ::android::hardware::wifi::V1_0::IWifiIface;
|
||||
using ::android::hardware::wifi::V1_0::IWifiP2pIface;
|
||||
using ::android::hardware::wifi::V1_0::IWifiRttController;
|
||||
using ::android::hardware::wifi::V1_0::IWifiStaIface;
|
||||
using ::android::hardware::wifi::V1_0::WifiDebugHostWakeReasonStats;
|
||||
using ::android::hardware::wifi::V1_0::WifiDebugRingBufferStatus;
|
||||
using ::android::hardware::wifi::V1_0::WifiDebugRingBufferVerboseLevel;
|
||||
using ::android::hardware::wifi::V1_0::WifiStatus;
|
||||
using ::android::hardware::wifi::V1_0::WifiStatusCode;
|
||||
|
||||
extern WifiHidlEnvironment* gEnv;
|
||||
|
||||
@@ -67,14 +70,14 @@ bool hasAnyRingBufferCapabilities(uint32_t caps) {
|
||||
* Tests that require SoftAP or NAN support should go into WifiChipHidlApTest or
|
||||
* WifiChipHidlNanTest respectively.
|
||||
*/
|
||||
class WifiChipHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
class WifiChipHidlTest : public ::testing::TestWithParam<std::string> {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
wifi_chip_ = getWifiChip();
|
||||
wifi_chip_ = getWifiChip(GetInstanceName());
|
||||
ASSERT_NE(nullptr, wifi_chip_.get());
|
||||
}
|
||||
|
||||
virtual void TearDown() override { stopWifi(); }
|
||||
virtual void TearDown() override { stopWifi(GetInstanceName()); }
|
||||
|
||||
protected:
|
||||
// Helper function to configure the Chip in one of the supported modes.
|
||||
@@ -136,6 +139,9 @@ class WifiChipHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
}
|
||||
|
||||
sp<IWifiChip> wifi_chip_;
|
||||
|
||||
protected:
|
||||
std::string GetInstanceName() { return GetParam(); }
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -143,15 +149,14 @@ class WifiChipHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
* Ensures that an instance of the IWifiChip proxy object is
|
||||
* successfully created.
|
||||
*/
|
||||
TEST(WifiChipHidlTestNoFixture, Create) {
|
||||
EXPECT_NE(nullptr, getWifiChip().get());
|
||||
stopWifi();
|
||||
TEST_P(WifiChipHidlTest, Create) {
|
||||
// The creation of a proxy object is tested as part of SetUp method.
|
||||
}
|
||||
|
||||
/*
|
||||
* GetId:
|
||||
*/
|
||||
TEST_F(WifiChipHidlTest, GetId) {
|
||||
TEST_P(WifiChipHidlTest, GetId) {
|
||||
EXPECT_EQ(WifiStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(wifi_chip_, getId).first.code);
|
||||
}
|
||||
@@ -159,7 +164,7 @@ TEST_F(WifiChipHidlTest, GetId) {
|
||||
/*
|
||||
* GetAvailableMode:
|
||||
*/
|
||||
TEST_F(WifiChipHidlTest, GetAvailableModes) {
|
||||
TEST_P(WifiChipHidlTest, GetAvailableModes) {
|
||||
const auto& status_and_modes = HIDL_INVOKE(wifi_chip_, getAvailableModes);
|
||||
EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_modes.first.code);
|
||||
EXPECT_LT(0u, status_and_modes.second.size());
|
||||
@@ -168,17 +173,17 @@ TEST_F(WifiChipHidlTest, GetAvailableModes) {
|
||||
/*
|
||||
* ConfigureChip:
|
||||
*/
|
||||
TEST_F(WifiChipHidlTest, ConfigureChip) {
|
||||
TEST_P(WifiChipHidlTest, ConfigureChip) {
|
||||
const auto& status_and_modes = HIDL_INVOKE(wifi_chip_, getAvailableModes);
|
||||
EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_modes.first.code);
|
||||
EXPECT_LT(0u, status_and_modes.second.size());
|
||||
for (const auto& mode : status_and_modes.second) {
|
||||
// configureChip() requires to be called with a fresh IWifiChip object.
|
||||
wifi_chip_ = getWifiChip();
|
||||
wifi_chip_ = getWifiChip(GetInstanceName());
|
||||
ASSERT_NE(nullptr, wifi_chip_.get());
|
||||
EXPECT_EQ(WifiStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(wifi_chip_, configureChip, mode.id).code);
|
||||
stopWifi();
|
||||
stopWifi(GetInstanceName());
|
||||
// Sleep for 5 milliseconds between each wifi state toggle.
|
||||
usleep(5000);
|
||||
}
|
||||
@@ -187,7 +192,7 @@ TEST_F(WifiChipHidlTest, ConfigureChip) {
|
||||
/*
|
||||
* GetCapabilities:
|
||||
*/
|
||||
TEST_F(WifiChipHidlTest, GetCapabilities) {
|
||||
TEST_P(WifiChipHidlTest, GetCapabilities) {
|
||||
configureChipForIfaceType(IfaceType::STA, true);
|
||||
const auto& status_and_caps = HIDL_INVOKE(wifi_chip_, getCapabilities);
|
||||
if (status_and_caps.first.code != WifiStatusCode::SUCCESS) {
|
||||
@@ -200,7 +205,7 @@ TEST_F(WifiChipHidlTest, GetCapabilities) {
|
||||
/*
|
||||
* GetMode:
|
||||
*/
|
||||
TEST_F(WifiChipHidlTest, GetMode) {
|
||||
TEST_P(WifiChipHidlTest, GetMode) {
|
||||
ChipModeId chip_mode_id = configureChipForIfaceType(IfaceType::STA, true);
|
||||
const auto& status_and_mode = HIDL_INVOKE(wifi_chip_, getMode);
|
||||
EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_mode.first.code);
|
||||
@@ -210,7 +215,7 @@ TEST_F(WifiChipHidlTest, GetMode) {
|
||||
/*
|
||||
* RequestChipDebugInfo:
|
||||
*/
|
||||
TEST_F(WifiChipHidlTest, RequestChipDebugInfo) {
|
||||
TEST_P(WifiChipHidlTest, RequestChipDebugInfo) {
|
||||
configureChipForIfaceType(IfaceType::STA, true);
|
||||
const auto& status_and_chip_info =
|
||||
HIDL_INVOKE(wifi_chip_, requestChipDebugInfo);
|
||||
@@ -222,7 +227,7 @@ TEST_F(WifiChipHidlTest, RequestChipDebugInfo) {
|
||||
/*
|
||||
* RequestFirmwareDebugDump
|
||||
*/
|
||||
TEST_F(WifiChipHidlTest, RequestFirmwareDebugDump) {
|
||||
TEST_P(WifiChipHidlTest, RequestFirmwareDebugDump) {
|
||||
uint32_t caps = configureChipForStaIfaceAndGetCapabilities();
|
||||
const auto& status_and_firmware_dump =
|
||||
HIDL_INVOKE(wifi_chip_, requestFirmwareDebugDump);
|
||||
@@ -237,7 +242,7 @@ TEST_F(WifiChipHidlTest, RequestFirmwareDebugDump) {
|
||||
/*
|
||||
* RequestDriverDebugDump
|
||||
*/
|
||||
TEST_F(WifiChipHidlTest, RequestDriverDebugDump) {
|
||||
TEST_P(WifiChipHidlTest, RequestDriverDebugDump) {
|
||||
uint32_t caps = configureChipForStaIfaceAndGetCapabilities();
|
||||
const auto& status_and_driver_dump =
|
||||
HIDL_INVOKE(wifi_chip_, requestDriverDebugDump);
|
||||
@@ -254,7 +259,7 @@ TEST_F(WifiChipHidlTest, RequestDriverDebugDump) {
|
||||
/*
|
||||
* GetDebugRingBuffersStatus
|
||||
*/
|
||||
TEST_F(WifiChipHidlTest, GetDebugRingBuffersStatus) {
|
||||
TEST_P(WifiChipHidlTest, GetDebugRingBuffersStatus) {
|
||||
uint32_t caps = configureChipForStaIfaceAndGetCapabilities();
|
||||
const auto& status_and_ring_buffer_status =
|
||||
HIDL_INVOKE(wifi_chip_, getDebugRingBuffersStatus);
|
||||
@@ -273,7 +278,7 @@ TEST_F(WifiChipHidlTest, GetDebugRingBuffersStatus) {
|
||||
/*
|
||||
* StartLoggingToDebugRingBuffer
|
||||
*/
|
||||
TEST_F(WifiChipHidlTest, StartLoggingToDebugRingBuffer) {
|
||||
TEST_P(WifiChipHidlTest, StartLoggingToDebugRingBuffer) {
|
||||
uint32_t caps = configureChipForStaIfaceAndGetCapabilities();
|
||||
std::string ring_name;
|
||||
const auto& status_and_ring_buffer_status =
|
||||
@@ -301,7 +306,7 @@ TEST_F(WifiChipHidlTest, StartLoggingToDebugRingBuffer) {
|
||||
/*
|
||||
* ForceDumpToDebugRingBuffer
|
||||
*/
|
||||
TEST_F(WifiChipHidlTest, ForceDumpToDebugRingBuffer) {
|
||||
TEST_P(WifiChipHidlTest, ForceDumpToDebugRingBuffer) {
|
||||
uint32_t caps = configureChipForStaIfaceAndGetCapabilities();
|
||||
std::string ring_name;
|
||||
const auto& status_and_ring_buffer_status =
|
||||
@@ -327,7 +332,7 @@ TEST_F(WifiChipHidlTest, ForceDumpToDebugRingBuffer) {
|
||||
/*
|
||||
* GetDebugHostWakeReasonStats
|
||||
*/
|
||||
TEST_F(WifiChipHidlTest, GetDebugHostWakeReasonStats) {
|
||||
TEST_P(WifiChipHidlTest, GetDebugHostWakeReasonStats) {
|
||||
uint32_t caps = configureChipForStaIfaceAndGetCapabilities();
|
||||
const auto& status_and_debug_wake_reason =
|
||||
HIDL_INVOKE(wifi_chip_, getDebugHostWakeReasonStats);
|
||||
@@ -345,7 +350,7 @@ TEST_F(WifiChipHidlTest, GetDebugHostWakeReasonStats) {
|
||||
* Configures the chip in P2P mode and ensures that at least 1 iface creation
|
||||
* succeeds.
|
||||
*/
|
||||
TEST_F(WifiChipHidlTest, CreateP2pIface) {
|
||||
TEST_P(WifiChipHidlTest, CreateP2pIface) {
|
||||
configureChipForIfaceType(IfaceType::P2P, true);
|
||||
|
||||
sp<IWifiP2pIface> iface;
|
||||
@@ -359,7 +364,7 @@ TEST_F(WifiChipHidlTest, CreateP2pIface) {
|
||||
* before creating the iface. Then, create the iface and ensure that
|
||||
* iface name is returned via the list.
|
||||
*/
|
||||
TEST_F(WifiChipHidlTest, GetP2pIfaceNames) {
|
||||
TEST_P(WifiChipHidlTest, GetP2pIfaceNames) {
|
||||
configureChipForIfaceType(IfaceType::P2P, true);
|
||||
|
||||
const auto& status_and_iface_names1 =
|
||||
@@ -391,7 +396,7 @@ TEST_F(WifiChipHidlTest, GetP2pIfaceNames) {
|
||||
* the iface object using the correct name and ensure any other name
|
||||
* doesn't retrieve an iface object.
|
||||
*/
|
||||
TEST_F(WifiChipHidlTest, GetP2pIface) {
|
||||
TEST_P(WifiChipHidlTest, GetP2pIface) {
|
||||
configureChipForIfaceType(IfaceType::P2P, true);
|
||||
|
||||
sp<IWifiP2pIface> p2p_iface;
|
||||
@@ -417,7 +422,7 @@ TEST_F(WifiChipHidlTest, GetP2pIface) {
|
||||
* the iface object using the correct name and ensure any other name
|
||||
* doesn't remove the iface.
|
||||
*/
|
||||
TEST_F(WifiChipHidlTest, RemoveP2pIface) {
|
||||
TEST_P(WifiChipHidlTest, RemoveP2pIface) {
|
||||
configureChipForIfaceType(IfaceType::P2P, true);
|
||||
|
||||
sp<IWifiP2pIface> p2p_iface;
|
||||
@@ -438,7 +443,7 @@ TEST_F(WifiChipHidlTest, RemoveP2pIface) {
|
||||
* Configures the chip in STA mode and ensures that at least 1 iface creation
|
||||
* succeeds.
|
||||
*/
|
||||
TEST_F(WifiChipHidlTest, CreateStaIface) {
|
||||
TEST_P(WifiChipHidlTest, CreateStaIface) {
|
||||
configureChipForIfaceType(IfaceType::STA, true);
|
||||
|
||||
sp<IWifiStaIface> iface;
|
||||
@@ -452,7 +457,7 @@ TEST_F(WifiChipHidlTest, CreateStaIface) {
|
||||
* before creating the iface. Then, create the iface and ensure that
|
||||
* iface name is returned via the list.
|
||||
*/
|
||||
TEST_F(WifiChipHidlTest, GetStaIfaceNames) {
|
||||
TEST_P(WifiChipHidlTest, GetStaIfaceNames) {
|
||||
configureChipForIfaceType(IfaceType::STA, true);
|
||||
|
||||
const auto& status_and_iface_names1 =
|
||||
@@ -484,7 +489,7 @@ TEST_F(WifiChipHidlTest, GetStaIfaceNames) {
|
||||
* the iface object using the correct name and ensure any other name
|
||||
* doesn't retrieve an iface object.
|
||||
*/
|
||||
TEST_F(WifiChipHidlTest, GetStaIface) {
|
||||
TEST_P(WifiChipHidlTest, GetStaIface) {
|
||||
configureChipForIfaceType(IfaceType::STA, true);
|
||||
|
||||
sp<IWifiStaIface> sta_iface;
|
||||
@@ -510,7 +515,7 @@ TEST_F(WifiChipHidlTest, GetStaIface) {
|
||||
* the iface object using the correct name and ensure any other name
|
||||
* doesn't remove the iface.
|
||||
*/
|
||||
TEST_F(WifiChipHidlTest, RemoveStaIface) {
|
||||
TEST_P(WifiChipHidlTest, RemoveStaIface) {
|
||||
configureChipForIfaceType(IfaceType::STA, true);
|
||||
|
||||
sp<IWifiStaIface> sta_iface;
|
||||
@@ -529,7 +534,7 @@ TEST_F(WifiChipHidlTest, RemoveStaIface) {
|
||||
/*
|
||||
* CreateRttController
|
||||
*/
|
||||
TEST_F(WifiChipHidlTest, CreateRttController) {
|
||||
TEST_P(WifiChipHidlTest, CreateRttController) {
|
||||
configureChipForIfaceType(IfaceType::STA, true);
|
||||
|
||||
sp<IWifiStaIface> iface;
|
||||
@@ -541,3 +546,9 @@ TEST_F(WifiChipHidlTest, CreateRttController) {
|
||||
EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_rtt_controller.first.code);
|
||||
EXPECT_NE(nullptr, status_and_rtt_controller.second.get());
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
PerInstance, WifiChipHidlTest,
|
||||
testing::ValuesIn(
|
||||
android::hardware::getAllHalInstanceNames(IWifi::descriptor)),
|
||||
android::hardware::PrintInstanceNameToString);
|
||||
@@ -18,7 +18,9 @@
|
||||
|
||||
#include <android/hardware/wifi/1.0/IWifi.h>
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <hidl/GtestPrinter.h>
|
||||
#include <hidl/ServiceManagement.h>
|
||||
|
||||
#include "wifi_hidl_test_utils.h"
|
||||
|
||||
@@ -28,13 +30,14 @@ using ::android::sp;
|
||||
/**
|
||||
* Fixture to use for all root Wifi HIDL interface tests.
|
||||
*/
|
||||
class WifiHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
class WifiHidlTest : public ::testing::TestWithParam<std::string> {
|
||||
public:
|
||||
virtual void SetUp() override {}
|
||||
|
||||
virtual void TearDown() override { stopWifi(); }
|
||||
virtual void TearDown() override { stopWifi(GetInstanceName()); }
|
||||
|
||||
protected:
|
||||
std::string GetInstanceName() { return GetParam(); }
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -42,7 +45,12 @@ class WifiHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
* Ensures that an instance of the IWifi proxy object is
|
||||
* successfully created.
|
||||
*/
|
||||
TEST(WifiHidlTestNoFixture, Create) {
|
||||
EXPECT_NE(nullptr, getWifi().get());
|
||||
stopWifi();
|
||||
TEST_P(WifiHidlTest, Create) {
|
||||
// The creation of a proxy object is tested as part of SetUp method.
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
PerInstance, WifiHidlTest,
|
||||
testing::ValuesIn(
|
||||
android::hardware::getAllHalInstanceNames(IWifi::descriptor)),
|
||||
android::hardware::PrintInstanceNameToString);
|
||||
@@ -196,7 +196,7 @@ sp<IWifiRttController> getWifiRttController(const std::string& instance_name) {
|
||||
if (!wifi_chip.get()) {
|
||||
return nullptr;
|
||||
}
|
||||
sp<IWifiStaIface> wifi_sta_iface = getWifiStaIface();
|
||||
sp<IWifiStaIface> wifi_sta_iface = getWifiStaIface(instance_name);
|
||||
if (!wifi_sta_iface.get()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -16,10 +16,12 @@
|
||||
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include <android/hardware/wifi/1.0/IWifi.h>
|
||||
#include <android/hardware/wifi/1.0/IWifiNanIface.h>
|
||||
#include <android/hardware/wifi/1.0/IWifiNanIfaceEventCallback.h>
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <hidl/GtestPrinter.h>
|
||||
#include <hidl/ServiceManagement.h>
|
||||
#include <chrono>
|
||||
#include <condition_variable>
|
||||
#include <mutex>
|
||||
@@ -29,27 +31,28 @@
|
||||
|
||||
using namespace ::android::hardware::wifi::V1_0;
|
||||
|
||||
using ::android::sp;
|
||||
using ::android::hardware::Return;
|
||||
using ::android::hardware::Void;
|
||||
using ::android::sp;
|
||||
using ::android::hardware::wifi::V1_0::IWifi;
|
||||
|
||||
#define TIMEOUT_PERIOD 10
|
||||
|
||||
/**
|
||||
* Fixture to use for all NAN Iface HIDL interface tests.
|
||||
*/
|
||||
class WifiNanIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
public:
|
||||
class WifiNanIfaceHidlTest : public ::testing::TestWithParam<std::string> {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
iwifiNanIface = getWifiNanIface();
|
||||
ASSERT_NE(nullptr, iwifiNanIface.get());
|
||||
ASSERT_EQ(WifiStatusCode::SUCCESS, HIDL_INVOKE(iwifiNanIface, registerEventCallback,
|
||||
new WifiNanIfaceEventCallback(*this)).code);
|
||||
iwifiNanIface = getWifiNanIface(GetInstanceName());
|
||||
ASSERT_NE(nullptr, iwifiNanIface.get());
|
||||
ASSERT_EQ(WifiStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(iwifiNanIface, registerEventCallback,
|
||||
new WifiNanIfaceEventCallback(*this))
|
||||
.code);
|
||||
}
|
||||
|
||||
virtual void TearDown() override {
|
||||
stopWifi();
|
||||
}
|
||||
virtual void TearDown() override { stopWifi(GetInstanceName()); }
|
||||
|
||||
/* Used as a mechanism to inform the test about data/event callback */
|
||||
inline void notify() {
|
||||
@@ -438,6 +441,8 @@ class WifiNanIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
NanFollowupReceivedInd nanFollowupReceivedInd;
|
||||
NanDataPathRequestInd nanDataPathRequestInd;
|
||||
NanDataPathConfirmInd nanDataPathConfirmInd;
|
||||
|
||||
std::string GetInstanceName() { return GetParam(); }
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -445,9 +450,8 @@ class WifiNanIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
* Ensures that an instance of the IWifiNanIface proxy object is
|
||||
* successfully created.
|
||||
*/
|
||||
TEST(WifiNanIfaceHidlTestNoFixture, Create) {
|
||||
ASSERT_NE(nullptr, getWifiNanIface().get());
|
||||
stopWifi();
|
||||
TEST_P(WifiNanIfaceHidlTest, Create) {
|
||||
// The creation of a proxy object is tested as part of SetUp method.
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -455,41 +459,51 @@ TEST(WifiNanIfaceHidlTestNoFixture, Create) {
|
||||
* Ensure that API calls fail with ERROR_WIFI_IFACE_INVALID when using an interface once wifi
|
||||
* is disabled.
|
||||
*/
|
||||
TEST(WifiNanIfaceHidlTestNoFixture, FailOnIfaceInvalid) {
|
||||
android::sp<IWifiNanIface> iwifiNanIface = getWifiNanIface();
|
||||
ASSERT_NE(nullptr, iwifiNanIface.get());
|
||||
stopWifi();
|
||||
sleep(5); // make sure that all chips/interfaces are invalidated
|
||||
ASSERT_EQ(WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
HIDL_INVOKE(iwifiNanIface, getCapabilitiesRequest, 0).code);
|
||||
TEST_P(WifiNanIfaceHidlTest, FailOnIfaceInvalid) {
|
||||
stopWifi(GetInstanceName());
|
||||
android::sp<IWifiNanIface> iwifiNanIface =
|
||||
getWifiNanIface(GetInstanceName());
|
||||
ASSERT_NE(nullptr, iwifiNanIface.get());
|
||||
stopWifi(GetInstanceName());
|
||||
sleep(5); // make sure that all chips/interfaces are invalidated
|
||||
ASSERT_EQ(WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
HIDL_INVOKE(iwifiNanIface, getCapabilitiesRequest, 0).code);
|
||||
}
|
||||
|
||||
/*
|
||||
* getCapabilitiesRequest: validate that returns capabilities.
|
||||
*/
|
||||
TEST_F(WifiNanIfaceHidlTest, getCapabilitiesRequest) {
|
||||
uint16_t inputCmdId = 10;
|
||||
callbackType = INVALID;
|
||||
ASSERT_EQ(WifiStatusCode::SUCCESS,
|
||||
TEST_P(WifiNanIfaceHidlTest, getCapabilitiesRequest) {
|
||||
uint16_t inputCmdId = 10;
|
||||
callbackType = INVALID;
|
||||
ASSERT_EQ(
|
||||
WifiStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(iwifiNanIface, getCapabilitiesRequest, inputCmdId).code);
|
||||
// wait for a callback
|
||||
ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_CAPABILITIES_RESPONSE));
|
||||
ASSERT_EQ(NOTIFY_CAPABILITIES_RESPONSE, callbackType);
|
||||
ASSERT_EQ(id, inputCmdId);
|
||||
// wait for a callback
|
||||
ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_CAPABILITIES_RESPONSE));
|
||||
ASSERT_EQ(NOTIFY_CAPABILITIES_RESPONSE, callbackType);
|
||||
ASSERT_EQ(id, inputCmdId);
|
||||
|
||||
// check for reasonable capability values
|
||||
EXPECT_GT(capabilities.maxConcurrentClusters, (unsigned int) 0);
|
||||
EXPECT_GT(capabilities.maxPublishes, (unsigned int) 0);
|
||||
EXPECT_GT(capabilities.maxSubscribes, (unsigned int) 0);
|
||||
EXPECT_EQ(capabilities.maxServiceNameLen, (unsigned int) 255);
|
||||
EXPECT_EQ(capabilities.maxMatchFilterLen, (unsigned int) 255);
|
||||
EXPECT_GT(capabilities.maxTotalMatchFilterLen, (unsigned int) 255);
|
||||
EXPECT_EQ(capabilities.maxServiceSpecificInfoLen, (unsigned int) 255);
|
||||
EXPECT_GE(capabilities.maxExtendedServiceSpecificInfoLen, (unsigned int) 255);
|
||||
EXPECT_GT(capabilities.maxNdiInterfaces, (unsigned int) 0);
|
||||
EXPECT_GT(capabilities.maxNdpSessions, (unsigned int) 0);
|
||||
EXPECT_GT(capabilities.maxAppInfoLen, (unsigned int) 0);
|
||||
EXPECT_GT(capabilities.maxQueuedTransmitFollowupMsgs, (unsigned int) 0);
|
||||
EXPECT_GT(capabilities.maxSubscribeInterfaceAddresses, (unsigned int) 0);
|
||||
EXPECT_NE(capabilities.supportedCipherSuites, (unsigned int) 0);
|
||||
// check for reasonable capability values
|
||||
EXPECT_GT(capabilities.maxConcurrentClusters, (unsigned int)0);
|
||||
EXPECT_GT(capabilities.maxPublishes, (unsigned int)0);
|
||||
EXPECT_GT(capabilities.maxSubscribes, (unsigned int)0);
|
||||
EXPECT_EQ(capabilities.maxServiceNameLen, (unsigned int)255);
|
||||
EXPECT_EQ(capabilities.maxMatchFilterLen, (unsigned int)255);
|
||||
EXPECT_GT(capabilities.maxTotalMatchFilterLen, (unsigned int)255);
|
||||
EXPECT_EQ(capabilities.maxServiceSpecificInfoLen, (unsigned int)255);
|
||||
EXPECT_GE(capabilities.maxExtendedServiceSpecificInfoLen,
|
||||
(unsigned int)255);
|
||||
EXPECT_GT(capabilities.maxNdiInterfaces, (unsigned int)0);
|
||||
EXPECT_GT(capabilities.maxNdpSessions, (unsigned int)0);
|
||||
EXPECT_GT(capabilities.maxAppInfoLen, (unsigned int)0);
|
||||
EXPECT_GT(capabilities.maxQueuedTransmitFollowupMsgs, (unsigned int)0);
|
||||
EXPECT_GT(capabilities.maxSubscribeInterfaceAddresses, (unsigned int)0);
|
||||
EXPECT_NE(capabilities.supportedCipherSuites, (unsigned int)0);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
PerInstance, WifiNanIfaceHidlTest,
|
||||
testing::ValuesIn(
|
||||
android::hardware::getAllHalInstanceNames(IWifi::descriptor)),
|
||||
android::hardware::PrintInstanceNameToString);
|
||||
@@ -16,25 +16,29 @@
|
||||
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include <android/hardware/wifi/1.0/IWifi.h>
|
||||
#include <android/hardware/wifi/1.0/IWifiP2pIface.h>
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <hidl/GtestPrinter.h>
|
||||
#include <hidl/ServiceManagement.h>
|
||||
|
||||
#include "wifi_hidl_test_utils.h"
|
||||
|
||||
using ::android::hardware::wifi::V1_0::IWifiP2pIface;
|
||||
using ::android::sp;
|
||||
using ::android::hardware::wifi::V1_0::IWifi;
|
||||
using ::android::hardware::wifi::V1_0::IWifiP2pIface;
|
||||
|
||||
/**
|
||||
* Fixture to use for all P2P Iface HIDL interface tests.
|
||||
*/
|
||||
class WifiP2pIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
class WifiP2pIfaceHidlTest : public ::testing::TestWithParam<std::string> {
|
||||
public:
|
||||
virtual void SetUp() override {}
|
||||
|
||||
virtual void TearDown() override { stopWifi(); }
|
||||
virtual void TearDown() override { stopWifi(GetInstanceName()); }
|
||||
|
||||
protected:
|
||||
std::string GetInstanceName() { return GetParam(); }
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -42,7 +46,13 @@ class WifiP2pIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
* Ensures that an instance of the IWifiP2pIface proxy object is
|
||||
* successfully created.
|
||||
*/
|
||||
TEST(WifiP2pIfaceHidlTestNoFixture, Create) {
|
||||
EXPECT_NE(nullptr, getWifiP2pIface().get());
|
||||
stopWifi();
|
||||
TEST_P(WifiP2pIfaceHidlTest, Create) {
|
||||
stopWifi(GetInstanceName());
|
||||
EXPECT_NE(nullptr, getWifiP2pIface(GetInstanceName()).get());
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
PerInstance, WifiP2pIfaceHidlTest,
|
||||
testing::ValuesIn(
|
||||
android::hardware::getAllHalInstanceNames(IWifi::descriptor)),
|
||||
android::hardware::PrintInstanceNameToString);
|
||||
@@ -16,25 +16,29 @@
|
||||
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include <android/hardware/wifi/1.0/IWifi.h>
|
||||
#include <android/hardware/wifi/1.0/IWifiRttController.h>
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <hidl/GtestPrinter.h>
|
||||
#include <hidl/ServiceManagement.h>
|
||||
|
||||
#include "wifi_hidl_test_utils.h"
|
||||
|
||||
using ::android::hardware::wifi::V1_0::IWifiRttController;
|
||||
using ::android::sp;
|
||||
using ::android::hardware::wifi::V1_0::IWifi;
|
||||
using ::android::hardware::wifi::V1_0::IWifiRttController;
|
||||
|
||||
/**
|
||||
* Fixture to use for all RTT controller HIDL interface tests.
|
||||
*/
|
||||
class WifiRttControllerHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
class WifiRttControllerHidlTest : public ::testing::TestWithParam<std::string> {
|
||||
public:
|
||||
virtual void SetUp() override {}
|
||||
|
||||
virtual void TearDown() override { stopWifi(); }
|
||||
virtual void TearDown() override { stopWifi(GetInstanceName()); }
|
||||
|
||||
protected:
|
||||
std::string GetInstanceName() { return GetParam(); }
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -42,7 +46,13 @@ class WifiRttControllerHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
* Ensures that an instance of the IWifiRttController proxy object is
|
||||
* successfully created.
|
||||
*/
|
||||
TEST(WifiRttControllerHidlTestNoFixture, Create) {
|
||||
EXPECT_NE(nullptr, getWifiRttController().get());
|
||||
stopWifi();
|
||||
TEST_P(WifiRttControllerHidlTest, Create) {
|
||||
stopWifi(GetInstanceName());
|
||||
EXPECT_NE(nullptr, getWifiRttController(GetInstanceName()).get());
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
PerInstance, WifiRttControllerHidlTest,
|
||||
testing::ValuesIn(
|
||||
android::hardware::getAllHalInstanceNames(IWifi::descriptor)),
|
||||
android::hardware::PrintInstanceNameToString);
|
||||
@@ -16,10 +16,12 @@
|
||||
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include <android/hardware/wifi/1.0/IWifi.h>
|
||||
#include <android/hardware/wifi/1.0/IWifiStaIface.h>
|
||||
#include <android/hardware/wifi/1.3/IWifiStaIface.h>
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <hidl/GtestPrinter.h>
|
||||
#include <hidl/ServiceManagement.h>
|
||||
|
||||
#include "wifi_hidl_call_util.h"
|
||||
#include "wifi_hidl_test_utils.h"
|
||||
@@ -28,6 +30,7 @@ using ::android::sp;
|
||||
using ::android::hardware::wifi::V1_0::Bssid;
|
||||
using ::android::hardware::wifi::V1_0::CommandId;
|
||||
using ::android::hardware::wifi::V1_0::IfaceType;
|
||||
using ::android::hardware::wifi::V1_0::IWifi;
|
||||
using ::android::hardware::wifi::V1_0::IWifiStaIface;
|
||||
using ::android::hardware::wifi::V1_0::Rssi;
|
||||
using ::android::hardware::wifi::V1_0::Ssid;
|
||||
@@ -41,14 +44,14 @@ using ::android::hardware::wifi::V1_0::WifiStatusCode;
|
||||
/**
|
||||
* Fixture to use for all STA Iface HIDL interface tests.
|
||||
*/
|
||||
class WifiStaIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
class WifiStaIfaceHidlTest : public ::testing::TestWithParam<std::string> {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
wifi_sta_iface_ = getWifiStaIface();
|
||||
wifi_sta_iface_ = getWifiStaIface(GetInstanceName());
|
||||
ASSERT_NE(nullptr, wifi_sta_iface_.get());
|
||||
}
|
||||
|
||||
virtual void TearDown() override { stopWifi(); }
|
||||
virtual void TearDown() override { stopWifi(GetInstanceName()); }
|
||||
|
||||
protected:
|
||||
bool isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask cap_mask) {
|
||||
@@ -59,6 +62,7 @@ class WifiStaIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
}
|
||||
|
||||
sp<IWifiStaIface> wifi_sta_iface_;
|
||||
std::string GetInstanceName() { return GetParam(); }
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -66,15 +70,14 @@ class WifiStaIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
* Ensures that an instance of the IWifiStaIface proxy object is
|
||||
* successfully created.
|
||||
*/
|
||||
TEST(WifiStaIfaceHidlTestNoFixture, Create) {
|
||||
EXPECT_NE(nullptr, getWifiStaIface().get());
|
||||
stopWifi();
|
||||
TEST_P(WifiStaIfaceHidlTest, Create) {
|
||||
// The creation of a proxy object is tested as part of SetUp method.
|
||||
}
|
||||
|
||||
/*
|
||||
* GetCapabilities:
|
||||
*/
|
||||
TEST_F(WifiStaIfaceHidlTest, GetCapabilities) {
|
||||
TEST_P(WifiStaIfaceHidlTest, GetCapabilities) {
|
||||
const auto& status_and_caps = HIDL_INVOKE(wifi_sta_iface_, getCapabilities);
|
||||
EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_caps.first.code);
|
||||
EXPECT_GT(status_and_caps.second, 0u);
|
||||
@@ -84,7 +87,7 @@ TEST_F(WifiStaIfaceHidlTest, GetCapabilities) {
|
||||
* GetType:
|
||||
* Ensures that the correct interface type is returned for station interface.
|
||||
*/
|
||||
TEST_F(WifiStaIfaceHidlTest, GetType) {
|
||||
TEST_P(WifiStaIfaceHidlTest, GetType) {
|
||||
const auto& status_and_type = HIDL_INVOKE(wifi_sta_iface_, getType);
|
||||
EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_type.first.code);
|
||||
EXPECT_EQ(IfaceType::STA, status_and_type.second);
|
||||
@@ -94,7 +97,7 @@ TEST_F(WifiStaIfaceHidlTest, GetType) {
|
||||
* GetApfPacketFilterCapabilities:
|
||||
* Ensures that we can retrieve APF packet filter capabilites.
|
||||
*/
|
||||
TEST_F(WifiStaIfaceHidlTest, GetApfPacketFilterCapabilities) {
|
||||
TEST_P(WifiStaIfaceHidlTest, GetApfPacketFilterCapabilities) {
|
||||
if (!isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask::APF)) {
|
||||
// No-op if APF packet filer is not supported.
|
||||
return;
|
||||
@@ -109,7 +112,7 @@ TEST_F(WifiStaIfaceHidlTest, GetApfPacketFilterCapabilities) {
|
||||
* GetBackgroundScanCapabilities:
|
||||
* Ensures that we can retrieve background scan capabilities.
|
||||
*/
|
||||
TEST_F(WifiStaIfaceHidlTest, GetBackgroundScanCapabilities) {
|
||||
TEST_P(WifiStaIfaceHidlTest, GetBackgroundScanCapabilities) {
|
||||
if (!isCapabilitySupported(
|
||||
IWifiStaIface::StaIfaceCapabilityMask::BACKGROUND_SCAN)) {
|
||||
// No-op if background scan is not supported.
|
||||
@@ -125,7 +128,7 @@ TEST_F(WifiStaIfaceHidlTest, GetBackgroundScanCapabilities) {
|
||||
* GetValidFrequenciesForBand:
|
||||
* Ensures that we can retrieve valid frequencies for 2.4 GHz band.
|
||||
*/
|
||||
TEST_F(WifiStaIfaceHidlTest, GetValidFrequenciesForBand) {
|
||||
TEST_P(WifiStaIfaceHidlTest, GetValidFrequenciesForBand) {
|
||||
const auto& status_and_freqs = HIDL_INVOKE(
|
||||
wifi_sta_iface_, getValidFrequenciesForBand, WifiBand::BAND_24GHZ);
|
||||
EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_freqs.first.code);
|
||||
@@ -137,7 +140,7 @@ TEST_F(WifiStaIfaceHidlTest, GetValidFrequenciesForBand) {
|
||||
* Ensures that calls to enable, disable, and retrieve link layer stats
|
||||
* will return a success status code.
|
||||
*/
|
||||
TEST_F(WifiStaIfaceHidlTest, LinkLayerStatsCollection) {
|
||||
TEST_P(WifiStaIfaceHidlTest, LinkLayerStatsCollection) {
|
||||
if (!isCapabilitySupported(
|
||||
IWifiStaIface::StaIfaceCapabilityMask::LINK_LAYER_STATS)) {
|
||||
// No-op if link layer stats is not supported.
|
||||
@@ -172,7 +175,7 @@ TEST_F(WifiStaIfaceHidlTest, LinkLayerStatsCollection) {
|
||||
* Ensures that calls to disable RSSI monitoring will return an error status
|
||||
* code if RSSI monitoring is not enabled.
|
||||
*/
|
||||
TEST_F(WifiStaIfaceHidlTest, RSSIMonitoring) {
|
||||
TEST_P(WifiStaIfaceHidlTest, RSSIMonitoring) {
|
||||
if (!isCapabilitySupported(
|
||||
IWifiStaIface::StaIfaceCapabilityMask::RSSI_MONITOR)) {
|
||||
// No-op if RSSI monitor is not supported.
|
||||
@@ -197,7 +200,7 @@ TEST_F(WifiStaIfaceHidlTest, RSSIMonitoring) {
|
||||
* Ensures that calls to configure and enable roaming will return a success
|
||||
* status code.
|
||||
*/
|
||||
TEST_F(WifiStaIfaceHidlTest, RoamingControl) {
|
||||
TEST_P(WifiStaIfaceHidlTest, RoamingControl) {
|
||||
if (!isCapabilitySupported(
|
||||
IWifiStaIface::StaIfaceCapabilityMask::CONTROL_ROAMING)) {
|
||||
// No-op if roaming control is not supported.
|
||||
@@ -242,9 +245,9 @@ TEST_F(WifiStaIfaceHidlTest, RoamingControl) {
|
||||
* Ensures that calls to enable neighbor discovery offload will return a success
|
||||
* status code.
|
||||
*/
|
||||
TEST_F(WifiStaIfaceHidlTest, EnableNDOffload) {
|
||||
if (!isCapabilitySupported(
|
||||
IWifiStaIface::StaIfaceCapabilityMask::ND_OFFLOAD)) {
|
||||
TEST_P(WifiStaIfaceHidlTest, EnableNDOffload) {
|
||||
if (!isCapabilitySupported(
|
||||
IWifiStaIface::StaIfaceCapabilityMask::ND_OFFLOAD)) {
|
||||
// No-op if nd offload is not supported.
|
||||
return;
|
||||
}
|
||||
@@ -257,7 +260,7 @@ TEST_F(WifiStaIfaceHidlTest, EnableNDOffload) {
|
||||
* Ensures that calls to set scanning MAC OUI will return a success status
|
||||
* code.
|
||||
*/
|
||||
TEST_F(WifiStaIfaceHidlTest, SetScanningMacOui) {
|
||||
TEST_P(WifiStaIfaceHidlTest, SetScanningMacOui) {
|
||||
if (!isCapabilitySupported(
|
||||
IWifiStaIface::StaIfaceCapabilityMask::SCAN_RAND)) {
|
||||
// No-op if SetScanningMacOui is not supported.
|
||||
@@ -274,9 +277,9 @@ TEST_F(WifiStaIfaceHidlTest, SetScanningMacOui) {
|
||||
* Ensures that calls to start packet fate monitoring and retrieve TX/RX
|
||||
* packets will return a success status code.
|
||||
*/
|
||||
TEST_F(WifiStaIfaceHidlTest, PacketFateMonitoring) {
|
||||
if (!isCapabilitySupported(
|
||||
IWifiStaIface::StaIfaceCapabilityMask::DEBUG_PACKET_FATE)) {
|
||||
TEST_P(WifiStaIfaceHidlTest, PacketFateMonitoring) {
|
||||
if (!isCapabilitySupported(
|
||||
IWifiStaIface::StaIfaceCapabilityMask::DEBUG_PACKET_FATE)) {
|
||||
// No-op if packet fate monitor is not supported.
|
||||
return;
|
||||
}
|
||||
@@ -291,3 +294,9 @@ TEST_F(WifiStaIfaceHidlTest, PacketFateMonitoring) {
|
||||
EXPECT_EQ(WifiStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(wifi_sta_iface_, getDebugRxPacketFates).first.code);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
PerInstance, WifiStaIfaceHidlTest,
|
||||
testing::ValuesIn(
|
||||
android::hardware::getAllHalInstanceNames(IWifi::descriptor)),
|
||||
android::hardware::PrintInstanceNameToString);
|
||||
@@ -27,5 +27,5 @@ cc_test {
|
||||
"android.hardware.wifi@1.2",
|
||||
"android.hardware.wifi@1.3",
|
||||
],
|
||||
test_suites: ["general-tests"],
|
||||
test_suites: ["general-tests", "vts-core"],
|
||||
}
|
||||
|
||||
@@ -14,34 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <android/hardware/wifi/1.1/IWifi.h>
|
||||
#include <VtsHalHidlTargetTestEnvBase.h>
|
||||
|
||||
#include "wifi_hidl_test_utils.h"
|
||||
|
||||
class WifiHidlEnvironment_1_1 : public WifiHidlEnvironment {
|
||||
public:
|
||||
// get the test environment singleton
|
||||
static WifiHidlEnvironment_1_1* Instance() {
|
||||
static WifiHidlEnvironment_1_1* instance = new WifiHidlEnvironment_1_1;
|
||||
return instance;
|
||||
}
|
||||
|
||||
virtual void registerTestServices() override {
|
||||
registerTestService<android::hardware::wifi::V1_1::IWifi>();
|
||||
}
|
||||
|
||||
private:
|
||||
WifiHidlEnvironment_1_1() {}
|
||||
};
|
||||
|
||||
WifiHidlEnvironment* gEnv = WifiHidlEnvironment_1_1::Instance();
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
::testing::AddGlobalTestEnvironment(gEnv);
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
gEnv->init(&argc, argv);
|
||||
int status = RUN_ALL_TESTS();
|
||||
LOG(INFO) << "Test result = " << status;
|
||||
return status;
|
||||
}
|
||||
// TODO(b/143892896): Remove this file after wifi_hidl_test_utils.cpp is
|
||||
// updated.
|
||||
::testing::VtsHalHidlTargetTestEnvBase* gEnv = nullptr;
|
||||
|
||||
@@ -19,8 +19,9 @@
|
||||
#include <android/hardware/wifi/1.1/IWifi.h>
|
||||
#include <android/hardware/wifi/1.1/IWifiChip.h>
|
||||
#include <android/hardware/wifi/1.3/IWifiChip.h>
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <hidl/GtestPrinter.h>
|
||||
#include <hidl/ServiceManagement.h>
|
||||
|
||||
#include "wifi_hidl_call_util.h"
|
||||
#include "wifi_hidl_test_utils.h"
|
||||
@@ -45,14 +46,14 @@ constexpr IWifiChip::TxPowerScenario kFakePowerScenario =
|
||||
/**
|
||||
* Fixture to use for all Wifi chip HIDL interface tests.
|
||||
*/
|
||||
class WifiChipHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
class WifiChipHidlTest : public ::testing::TestWithParam<std::string> {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
wifi_chip_ = IWifiChip::castFrom(getWifiChip());
|
||||
wifi_chip_ = IWifiChip::castFrom(getWifiChip(GetInstanceName()));
|
||||
ASSERT_NE(nullptr, wifi_chip_.get());
|
||||
}
|
||||
|
||||
virtual void TearDown() override { stopWifi(); }
|
||||
virtual void TearDown() override { stopWifi(GetInstanceName()); }
|
||||
|
||||
protected:
|
||||
uint32_t configureChipForStaIfaceAndGetCapabilities() {
|
||||
@@ -77,12 +78,15 @@ class WifiChipHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
}
|
||||
|
||||
sp<IWifiChip> wifi_chip_;
|
||||
|
||||
private:
|
||||
std::string GetInstanceName() { return GetParam(); }
|
||||
};
|
||||
|
||||
/*
|
||||
* SelectTxPowerScenario
|
||||
*/
|
||||
TEST_F(WifiChipHidlTest, SelectTxPowerScenario) {
|
||||
TEST_P(WifiChipHidlTest, SelectTxPowerScenario) {
|
||||
uint32_t caps = configureChipForStaIfaceAndGetCapabilities();
|
||||
const auto& status =
|
||||
HIDL_INVOKE(wifi_chip_, selectTxPowerScenario, kFakePowerScenario);
|
||||
@@ -96,7 +100,7 @@ TEST_F(WifiChipHidlTest, SelectTxPowerScenario) {
|
||||
/*
|
||||
* ResetTxPowerScenario
|
||||
*/
|
||||
TEST_F(WifiChipHidlTest, ResetTxPowerScenario) {
|
||||
TEST_P(WifiChipHidlTest, ResetTxPowerScenario) {
|
||||
uint32_t caps = configureChipForStaIfaceAndGetCapabilities();
|
||||
const auto& status =
|
||||
HIDL_INVOKE(wifi_chip_, resetTxPowerScenario);
|
||||
@@ -106,3 +110,9 @@ TEST_F(WifiChipHidlTest, ResetTxPowerScenario) {
|
||||
EXPECT_EQ(WifiStatusCode::ERROR_NOT_SUPPORTED, status.code);
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
PerInstance, WifiChipHidlTest,
|
||||
testing::ValuesIn(
|
||||
android::hardware::getAllHalInstanceNames(IWifi::descriptor)),
|
||||
android::hardware::PrintInstanceNameToString);
|
||||
@@ -29,7 +29,8 @@ cc_test {
|
||||
"android.hardware.wifi@1.2",
|
||||
"android.hardware.wifi@1.3",
|
||||
],
|
||||
test_suites: ["general-tests"],
|
||||
disable_framework: true,
|
||||
test_suites: ["general-tests", "vts-core"],
|
||||
}
|
||||
|
||||
cc_test {
|
||||
@@ -45,5 +46,6 @@ cc_test {
|
||||
"android.hardware.wifi@1.1",
|
||||
"android.hardware.wifi@1.2",
|
||||
],
|
||||
test_suites: ["general-tests"],
|
||||
disable_framework: true,
|
||||
test_suites: ["general-tests", "vts-core"],
|
||||
}
|
||||
|
||||
@@ -14,35 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <android/hardware/wifi/1.2/IWifi.h>
|
||||
#include <VtsHalHidlTargetTestEnvBase.h>
|
||||
|
||||
#include "wifi_hidl_test_utils.h"
|
||||
|
||||
using ::android::hardware::wifi::V1_2::IWifi;
|
||||
|
||||
// Test environment for Wifi HIDL HAL.
|
||||
class WifiHidlEnvironment_1_2 : public WifiHidlEnvironment {
|
||||
public:
|
||||
// get the test environment singleton
|
||||
static WifiHidlEnvironment_1_2* Instance() {
|
||||
static WifiHidlEnvironment_1_2* instance = new WifiHidlEnvironment_1_2;
|
||||
return instance;
|
||||
}
|
||||
|
||||
virtual void registerTestServices() override { registerTestService<IWifi>(); }
|
||||
|
||||
private:
|
||||
WifiHidlEnvironment_1_2() {}
|
||||
};
|
||||
|
||||
WifiHidlEnvironment_1_2* gEnv = WifiHidlEnvironment_1_2::Instance();
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
::testing::AddGlobalTestEnvironment(gEnv);
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
gEnv->init(&argc, argv);
|
||||
int status = RUN_ALL_TESTS();
|
||||
LOG(INFO) << "Test result = " << status;
|
||||
return status;
|
||||
}
|
||||
// TODO(b/143892896): Remove this file after wifi_hidl_test_utils.cpp is
|
||||
// updated.
|
||||
::testing::VtsHalHidlTargetTestEnvBase* gEnv = nullptr;
|
||||
@@ -16,12 +16,14 @@
|
||||
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include <android/hardware/wifi/1.2/IWifi.h>
|
||||
#include <android/hardware/wifi/1.2/IWifiChip.h>
|
||||
#include <android/hardware/wifi/1.2/IWifiChipEventCallback.h>
|
||||
#include <android/hardware/wifi/1.3/IWifiChip.h>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <hidl/GtestPrinter.h>
|
||||
#include <hidl/ServiceManagement.h>
|
||||
#include <VtsHalHidlTargetCallbackBase.h>
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
|
||||
#include "wifi_hidl_call_util.h"
|
||||
#include "wifi_hidl_test_utils.h"
|
||||
@@ -50,14 +52,14 @@ constexpr IWifiChip::TxPowerScenario kPowerScenarioVoiceCall =
|
||||
/**
|
||||
* Fixture to use for all Wifi chip HIDL interface tests.
|
||||
*/
|
||||
class WifiChipHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
class WifiChipHidlTest : public ::testing::TestWithParam<std::string> {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
wifi_chip_ = IWifiChip::castFrom(getWifiChip());
|
||||
wifi_chip_ = IWifiChip::castFrom(getWifiChip(GetInstanceName()));
|
||||
ASSERT_NE(nullptr, wifi_chip_.get());
|
||||
}
|
||||
|
||||
virtual void TearDown() override { stopWifi(); }
|
||||
virtual void TearDown() override { stopWifi(GetInstanceName()); }
|
||||
|
||||
// A simple test implementation of WifiChipEventCallback.
|
||||
class WifiChipEventCallback
|
||||
@@ -123,6 +125,9 @@ class WifiChipHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
}
|
||||
|
||||
sp<IWifiChip> wifi_chip_;
|
||||
|
||||
private:
|
||||
std::string GetInstanceName() { return GetParam(); }
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -130,7 +135,7 @@ class WifiChipHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
* This test case tests the selectTxPowerScenario_1_2() API with SAR scenarios
|
||||
* newly defined in 1.2
|
||||
*/
|
||||
TEST_F(WifiChipHidlTest, SelectTxPowerScenario_1_2_body) {
|
||||
TEST_P(WifiChipHidlTest, SelectTxPowerScenario_1_2_body) {
|
||||
uint32_t caps = configureChipForStaIfaceAndGetCapabilities();
|
||||
const auto& status =
|
||||
HIDL_INVOKE(wifi_chip_, selectTxPowerScenario_1_2, kPowerScenarioBody);
|
||||
@@ -147,7 +152,7 @@ TEST_F(WifiChipHidlTest, SelectTxPowerScenario_1_2_body) {
|
||||
* This test case tests the selectTxPowerScenario_1_2() API with previously
|
||||
* defined SAR scenarios
|
||||
*/
|
||||
TEST_F(WifiChipHidlTest, SelectTxPowerScenario_1_2_voiceCall) {
|
||||
TEST_P(WifiChipHidlTest, SelectTxPowerScenario_1_2_voiceCall) {
|
||||
uint32_t caps = configureChipForStaIfaceAndGetCapabilities();
|
||||
const auto& status =
|
||||
HIDL_INVOKE(wifi_chip_, selectTxPowerScenario_1_2, kPowerScenarioVoiceCall);
|
||||
@@ -167,9 +172,15 @@ TEST_F(WifiChipHidlTest, SelectTxPowerScenario_1_2_voiceCall) {
|
||||
* since event is triggered internally in the HAL implementation, and can not be
|
||||
* triggered from the test case
|
||||
*/
|
||||
TEST_F(WifiChipHidlTest, registerEventCallback_1_2) {
|
||||
TEST_P(WifiChipHidlTest, registerEventCallback_1_2) {
|
||||
sp<WifiChipEventCallback> wifiChipEventCallback = new WifiChipEventCallback();
|
||||
const auto& status =
|
||||
HIDL_INVOKE(wifi_chip_, registerEventCallback_1_2, wifiChipEventCallback);
|
||||
EXPECT_EQ(WifiStatusCode::SUCCESS, status.code);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
PerInstance, WifiChipHidlTest,
|
||||
testing::ValuesIn(android::hardware::getAllHalInstanceNames(
|
||||
::android::hardware::wifi::V1_2::IWifi::descriptor)),
|
||||
android::hardware::PrintInstanceNameToString);
|
||||
@@ -16,10 +16,12 @@
|
||||
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include <android/hardware/wifi/1.2/IWifi.h>
|
||||
#include <android/hardware/wifi/1.2/IWifiNanIface.h>
|
||||
#include <android/hardware/wifi/1.2/IWifiNanIfaceEventCallback.h>
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <hidl/GtestPrinter.h>
|
||||
#include <hidl/ServiceManagement.h>
|
||||
#include <chrono>
|
||||
#include <condition_variable>
|
||||
#include <mutex>
|
||||
@@ -36,19 +38,19 @@ using ::android::sp;
|
||||
|
||||
#define TIMEOUT_PERIOD 10
|
||||
|
||||
android::sp<android::hardware::wifi::V1_2::IWifiNanIface>
|
||||
getWifiNanIface_1_2() {
|
||||
android::sp<android::hardware::wifi::V1_2::IWifiNanIface> getWifiNanIface_1_2(
|
||||
const std::string& instance_name) {
|
||||
return android::hardware::wifi::V1_2::IWifiNanIface::castFrom(
|
||||
getWifiNanIface());
|
||||
getWifiNanIface(instance_name));
|
||||
}
|
||||
|
||||
/**
|
||||
* Fixture to use for all NAN Iface HIDL interface tests.
|
||||
*/
|
||||
class WifiNanIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
class WifiNanIfaceHidlTest : public ::testing::TestWithParam<std::string> {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
iwifiNanIface = getWifiNanIface_1_2();
|
||||
iwifiNanIface = getWifiNanIface_1_2(GetInstanceName());
|
||||
ASSERT_NE(nullptr, iwifiNanIface.get());
|
||||
ASSERT_EQ(WifiStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(iwifiNanIface, registerEventCallback_1_2,
|
||||
@@ -56,7 +58,7 @@ class WifiNanIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
.code);
|
||||
}
|
||||
|
||||
virtual void TearDown() override { stopWifi(); }
|
||||
virtual void TearDown() override { stopWifi(GetInstanceName()); }
|
||||
|
||||
/* Used as a mechanism to inform the test about data/event callback */
|
||||
inline void notify() {
|
||||
@@ -458,6 +460,8 @@ class WifiNanIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
::android::hardware::wifi::V1_2::NanDataPathConfirmInd
|
||||
nanDataPathConfirmInd_1_2;
|
||||
NanDataPathScheduleUpdateInd nanDataPathScheduleUpdateInd;
|
||||
|
||||
std::string GetInstanceName() { return GetParam(); }
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -465,15 +469,14 @@ class WifiNanIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
* Ensures that an instance of the IWifiNanIface proxy object is
|
||||
* successfully created.
|
||||
*/
|
||||
TEST(WifiNanIfaceHidlTestNoFixture, Create) {
|
||||
ASSERT_NE(nullptr, getWifiNanIface_1_2().get());
|
||||
stopWifi();
|
||||
TEST_P(WifiNanIfaceHidlTest, Create) {
|
||||
// The creation of a proxy object is tested as part of SetUp method.
|
||||
}
|
||||
|
||||
/*
|
||||
* enableRequest_1_2InvalidArgs: validate that fails with invalid arguments
|
||||
*/
|
||||
TEST_F(WifiNanIfaceHidlTest, enableRequest_1_2InvalidArgs) {
|
||||
TEST_P(WifiNanIfaceHidlTest, enableRequest_1_2InvalidArgs) {
|
||||
uint16_t inputCmdId = 10;
|
||||
callbackType = INVALID;
|
||||
NanEnableRequest nanEnableRequest = {};
|
||||
@@ -493,7 +496,7 @@ TEST_F(WifiNanIfaceHidlTest, enableRequest_1_2InvalidArgs) {
|
||||
* enableRequest_1_2ShimInvalidArgs: validate that fails with invalid arguments
|
||||
* to the shim
|
||||
*/
|
||||
TEST_F(WifiNanIfaceHidlTest, enableRequest_1_2ShimInvalidArgs) {
|
||||
TEST_P(WifiNanIfaceHidlTest, enableRequest_1_2ShimInvalidArgs) {
|
||||
uint16_t inputCmdId = 10;
|
||||
NanEnableRequest nanEnableRequest = {};
|
||||
nanEnableRequest.configParams.numberOfPublishServiceIdsInBeacon =
|
||||
@@ -508,7 +511,7 @@ TEST_F(WifiNanIfaceHidlTest, enableRequest_1_2ShimInvalidArgs) {
|
||||
/*
|
||||
* configRequest_1_2InvalidArgs: validate that fails with invalid arguments
|
||||
*/
|
||||
TEST_F(WifiNanIfaceHidlTest, configRequest_1_2InvalidArgs) {
|
||||
TEST_P(WifiNanIfaceHidlTest, configRequest_1_2InvalidArgs) {
|
||||
uint16_t inputCmdId = 10;
|
||||
callbackType = INVALID;
|
||||
NanConfigRequest nanConfigRequest = {};
|
||||
@@ -528,7 +531,7 @@ TEST_F(WifiNanIfaceHidlTest, configRequest_1_2InvalidArgs) {
|
||||
* configRequest_1_2ShimInvalidArgs: validate that fails with invalid arguments
|
||||
* to the shim
|
||||
*/
|
||||
TEST_F(WifiNanIfaceHidlTest, configRequest_1_2ShimInvalidArgs) {
|
||||
TEST_P(WifiNanIfaceHidlTest, configRequest_1_2ShimInvalidArgs) {
|
||||
uint16_t inputCmdId = 10;
|
||||
NanConfigRequest nanConfigRequest = {};
|
||||
nanConfigRequest.numberOfPublishServiceIdsInBeacon = 128; // must be <= 127
|
||||
@@ -538,3 +541,9 @@ TEST_F(WifiNanIfaceHidlTest, configRequest_1_2ShimInvalidArgs) {
|
||||
nanConfigRequest, nanConfigRequestSupp)
|
||||
.code);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
PerInstance, WifiNanIfaceHidlTest,
|
||||
testing::ValuesIn(android::hardware::getAllHalInstanceNames(
|
||||
::android::hardware::wifi::V1_2::IWifi::descriptor)),
|
||||
android::hardware::PrintInstanceNameToString);
|
||||
@@ -19,9 +19,11 @@
|
||||
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include <android/hardware/wifi/1.2/IWifi.h>
|
||||
#include <android/hardware/wifi/1.2/IWifiStaIface.h>
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <hidl/GtestPrinter.h>
|
||||
#include <hidl/ServiceManagement.h>
|
||||
|
||||
#include "wifi_hidl_call_util.h"
|
||||
#include "wifi_hidl_test_utils.h"
|
||||
@@ -34,14 +36,15 @@ using ::android::hardware::wifi::V1_2::IWifiStaIface;
|
||||
/**
|
||||
* Fixture to use for all STA Iface HIDL interface tests.
|
||||
*/
|
||||
class WifiStaIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
class WifiStaIfaceHidlTest : public ::testing::TestWithParam<std::string> {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
wifi_sta_iface_ = IWifiStaIface::castFrom(getWifiStaIface());
|
||||
wifi_sta_iface_ =
|
||||
IWifiStaIface::castFrom(getWifiStaIface(GetInstanceName()));
|
||||
ASSERT_NE(nullptr, wifi_sta_iface_.get());
|
||||
}
|
||||
|
||||
virtual void TearDown() override { stopWifi(); }
|
||||
virtual void TearDown() override { stopWifi(GetInstanceName()); }
|
||||
|
||||
protected:
|
||||
bool isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask cap_mask) {
|
||||
@@ -52,6 +55,9 @@ class WifiStaIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
}
|
||||
|
||||
sp<IWifiStaIface> wifi_sta_iface_;
|
||||
|
||||
private:
|
||||
std::string GetInstanceName() { return GetParam(); }
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -59,7 +65,7 @@ class WifiStaIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
* Ensures that calls to set MAC address will return a success status
|
||||
* code.
|
||||
*/
|
||||
TEST_F(WifiStaIfaceHidlTest, SetMacAddress) {
|
||||
TEST_P(WifiStaIfaceHidlTest, SetMacAddress) {
|
||||
const android::hardware::hidl_array<uint8_t, 6> kMac{
|
||||
std::array<uint8_t, 6>{{0x12, 0x22, 0x33, 0x52, 0x10, 0x41}}};
|
||||
EXPECT_EQ(WifiStatusCode::SUCCESS,
|
||||
@@ -76,7 +82,7 @@ TEST_F(WifiStaIfaceHidlTest, SetMacAddress) {
|
||||
* TODO: We can't execute APF opcodes from this test because there's no way
|
||||
* to loop test packets through the wifi firmware (b/73804303#comment29).
|
||||
*/
|
||||
TEST_F(WifiStaIfaceHidlTest, DISABLED_ReadApfPacketFilterData) {
|
||||
TEST_P(WifiStaIfaceHidlTest, DISABLED_ReadApfPacketFilterData) {
|
||||
if (!isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask::APF)) {
|
||||
// Disable test if APF packet filer is not supported.
|
||||
LOG(WARNING) << "TEST SKIPPED: APF packet filtering not supported";
|
||||
@@ -107,3 +113,9 @@ TEST_F(WifiStaIfaceHidlTest, DISABLED_ReadApfPacketFilterData) {
|
||||
|
||||
EXPECT_EQ(status_and_data.second, data);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
PerInstance, WifiStaIfaceHidlTest,
|
||||
testing::ValuesIn(android::hardware::getAllHalInstanceNames(
|
||||
::android::hardware::wifi::V1_2::IWifi::descriptor)),
|
||||
android::hardware::PrintInstanceNameToString);
|
||||
@@ -29,4 +29,6 @@ cc_test {
|
||||
"android.hardware.wifi@1.2",
|
||||
"android.hardware.wifi@1.3",
|
||||
],
|
||||
disable_framework: true,
|
||||
test_suites: ["general-tests", "vts-core"],
|
||||
}
|
||||
|
||||
@@ -14,37 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <android/hardware/wifi/1.3/IWifi.h>
|
||||
#include <VtsHalHidlTargetTestEnvBase.h>
|
||||
|
||||
#include "wifi_hidl_test_utils.h"
|
||||
|
||||
using ::android::hardware::wifi::V1_3::IWifi;
|
||||
|
||||
// Test environment for Wifi HIDL HAL.
|
||||
class WifiHidlEnvironment_1_3 : public WifiHidlEnvironment {
|
||||
public:
|
||||
// get the test environment singleton
|
||||
static WifiHidlEnvironment_1_3* Instance() {
|
||||
static WifiHidlEnvironment_1_3* instance = new WifiHidlEnvironment_1_3;
|
||||
return instance;
|
||||
}
|
||||
|
||||
virtual void registerTestServices() override {
|
||||
registerTestService<android::hardware::wifi::V1_3::IWifi>();
|
||||
}
|
||||
|
||||
private:
|
||||
WifiHidlEnvironment_1_3() {}
|
||||
};
|
||||
|
||||
WifiHidlEnvironment_1_3* gEnv = WifiHidlEnvironment_1_3::Instance();
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
::testing::AddGlobalTestEnvironment(gEnv);
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
gEnv->init(&argc, argv);
|
||||
int status = RUN_ALL_TESTS();
|
||||
LOG(INFO) << "Test result = " << status;
|
||||
return status;
|
||||
}
|
||||
// TODO(b/143892896): Remove this file after wifi_hidl_test_utils.cpp is
|
||||
// updated.
|
||||
::testing::VtsHalHidlTargetTestEnvBase* gEnv = nullptr;
|
||||
@@ -16,9 +16,11 @@
|
||||
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include <android/hardware/wifi/1.3/IWifi.h>
|
||||
#include <android/hardware/wifi/1.3/IWifiChip.h>
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <hidl/GtestPrinter.h>
|
||||
#include <hidl/ServiceManagement.h>
|
||||
|
||||
#include "wifi_hidl_call_util.h"
|
||||
#include "wifi_hidl_test_utils.h"
|
||||
@@ -39,14 +41,14 @@ constexpr IWifiChip::LatencyMode kLatencyModeLow = IWifiChip::LatencyMode::LOW;
|
||||
/**
|
||||
* Fixture to use for all Wifi chip HIDL interface tests.
|
||||
*/
|
||||
class WifiChipHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
class WifiChipHidlTest : public ::testing::TestWithParam<std::string> {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
wifi_chip_ = IWifiChip::castFrom(getWifiChip());
|
||||
wifi_chip_ = IWifiChip::castFrom(getWifiChip(GetInstanceName()));
|
||||
ASSERT_NE(nullptr, wifi_chip_.get());
|
||||
}
|
||||
|
||||
virtual void TearDown() override { stopWifi(); }
|
||||
virtual void TearDown() override { stopWifi(GetInstanceName()); }
|
||||
|
||||
protected:
|
||||
// Helper function to configure the Chip in one of the supported modes.
|
||||
@@ -70,6 +72,9 @@ class WifiChipHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
}
|
||||
|
||||
sp<IWifiChip> wifi_chip_;
|
||||
|
||||
private:
|
||||
std::string GetInstanceName() { return GetParam(); }
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -77,7 +82,7 @@ class WifiChipHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
* This test case tests the setLatencyMode() API with
|
||||
* Latency mode NORMAL
|
||||
*/
|
||||
TEST_F(WifiChipHidlTest, SetLatencyMode_normal) {
|
||||
TEST_P(WifiChipHidlTest, SetLatencyMode_normal) {
|
||||
uint32_t caps = configureChipForStaIfaceAndGetCapabilities();
|
||||
const auto& status =
|
||||
HIDL_INVOKE(wifi_chip_, setLatencyMode, kLatencyModeNormal);
|
||||
@@ -92,7 +97,7 @@ TEST_F(WifiChipHidlTest, SetLatencyMode_normal) {
|
||||
* SetLatencyMode_low
|
||||
* This test case tests the setLatencyMode() API with Latency mode LOW
|
||||
*/
|
||||
TEST_F(WifiChipHidlTest, SetLatencyMode_low) {
|
||||
TEST_P(WifiChipHidlTest, SetLatencyMode_low) {
|
||||
uint32_t caps = configureChipForStaIfaceAndGetCapabilities();
|
||||
const auto& status =
|
||||
HIDL_INVOKE(wifi_chip_, setLatencyMode, kLatencyModeLow);
|
||||
@@ -106,7 +111,7 @@ TEST_F(WifiChipHidlTest, SetLatencyMode_low) {
|
||||
/*
|
||||
* GetCapabilities_1_3
|
||||
*/
|
||||
TEST_F(WifiChipHidlTest, GetCapabilities_1_3) {
|
||||
TEST_P(WifiChipHidlTest, GetCapabilities_1_3) {
|
||||
configureChipForIfaceType(IfaceType::STA, true);
|
||||
const auto& status_and_caps = HIDL_INVOKE(wifi_chip_, getCapabilities_1_3);
|
||||
if (status_and_caps.first.code != WifiStatusCode::SUCCESS) {
|
||||
@@ -116,3 +121,9 @@ TEST_F(WifiChipHidlTest, GetCapabilities_1_3) {
|
||||
}
|
||||
EXPECT_NE(0u, status_and_caps.second);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
PerInstance, WifiChipHidlTest,
|
||||
testing::ValuesIn(android::hardware::getAllHalInstanceNames(
|
||||
::android::hardware::wifi::V1_3::IWifi::descriptor)),
|
||||
android::hardware::PrintInstanceNameToString);
|
||||
@@ -19,9 +19,11 @@
|
||||
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include <android/hardware/wifi/1.3/IWifi.h>
|
||||
#include <android/hardware/wifi/1.3/IWifiStaIface.h>
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <hidl/GtestPrinter.h>
|
||||
#include <hidl/ServiceManagement.h>
|
||||
|
||||
#include "wifi_hidl_call_util.h"
|
||||
#include "wifi_hidl_test_utils.h"
|
||||
@@ -35,14 +37,15 @@ using ::android::hardware::wifi::V1_3::IWifiStaIface;
|
||||
/**
|
||||
* Fixture to use for all STA Iface HIDL interface tests.
|
||||
*/
|
||||
class WifiStaIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
class WifiStaIfaceHidlTest : public ::testing::TestWithParam<std::string> {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
wifi_sta_iface_ = IWifiStaIface::castFrom(getWifiStaIface());
|
||||
wifi_sta_iface_ =
|
||||
IWifiStaIface::castFrom(getWifiStaIface(GetInstanceName()));
|
||||
ASSERT_NE(nullptr, wifi_sta_iface_.get());
|
||||
}
|
||||
|
||||
virtual void TearDown() override { stopWifi(); }
|
||||
virtual void TearDown() override { stopWifi(GetInstanceName()); }
|
||||
|
||||
protected:
|
||||
bool isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask cap_mask) {
|
||||
@@ -53,6 +56,9 @@ class WifiStaIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
}
|
||||
|
||||
sp<IWifiStaIface> wifi_sta_iface_;
|
||||
|
||||
private:
|
||||
std::string GetInstanceName() { return GetParam(); }
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -60,7 +66,7 @@ class WifiStaIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
* Ensures that calls to get factory MAC address will retrieve a non-zero MAC
|
||||
* and return a success status code.
|
||||
*/
|
||||
TEST_F(WifiStaIfaceHidlTest, GetFactoryMacAddress) {
|
||||
TEST_P(WifiStaIfaceHidlTest, GetFactoryMacAddress) {
|
||||
std::pair<WifiStatus, hidl_array<uint8_t, 6> > status_and_mac =
|
||||
HIDL_INVOKE(wifi_sta_iface_, getFactoryMacAddress);
|
||||
EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_mac.first.code);
|
||||
@@ -73,7 +79,7 @@ TEST_F(WifiStaIfaceHidlTest, GetFactoryMacAddress) {
|
||||
* Ensures that calls to get link layer stats V1_3 will retrieve a non-empty
|
||||
* StaLinkLayerStats after link layer stats collection is enabled.
|
||||
*/
|
||||
TEST_F(WifiStaIfaceHidlTest, GetLinkLayerStats_1_3) {
|
||||
TEST_P(WifiStaIfaceHidlTest, GetLinkLayerStats_1_3) {
|
||||
if (!isCapabilitySupported(
|
||||
IWifiStaIface::StaIfaceCapabilityMask::LINK_LAYER_STATS)) {
|
||||
// No-op if link layer stats is not supported.
|
||||
@@ -94,3 +100,9 @@ TEST_F(WifiStaIfaceHidlTest, GetLinkLayerStats_1_3) {
|
||||
WifiStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(wifi_sta_iface_, disableLinkLayerStatsCollection).code);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
PerInstance, WifiStaIfaceHidlTest,
|
||||
testing::ValuesIn(android::hardware::getAllHalInstanceNames(
|
||||
::android::hardware::wifi::V1_3::IWifi::descriptor)),
|
||||
android::hardware::PrintInstanceNameToString);
|
||||
@@ -30,4 +30,5 @@ cc_test {
|
||||
"android.hardware.wifi@1.3",
|
||||
"android.hardware.wifi@1.4",
|
||||
],
|
||||
test_suites: ["general-tests", "vts-core"],
|
||||
}
|
||||
|
||||
@@ -14,37 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <android/hardware/wifi/1.4/IWifi.h>
|
||||
#include <VtsHalHidlTargetTestEnvBase.h>
|
||||
|
||||
#include "wifi_hidl_test_utils.h"
|
||||
|
||||
using ::android::hardware::wifi::V1_4::IWifi;
|
||||
|
||||
// Test environment for Wifi HIDL HAL.
|
||||
class WifiHidlEnvironment_1_4 : public WifiHidlEnvironment {
|
||||
public:
|
||||
// get the test environment singleton
|
||||
static WifiHidlEnvironment_1_4* Instance() {
|
||||
static WifiHidlEnvironment_1_4* instance = new WifiHidlEnvironment_1_4;
|
||||
return instance;
|
||||
}
|
||||
|
||||
virtual void registerTestServices() override {
|
||||
registerTestService<android::hardware::wifi::V1_4::IWifi>();
|
||||
}
|
||||
|
||||
private:
|
||||
WifiHidlEnvironment_1_4() {}
|
||||
};
|
||||
|
||||
WifiHidlEnvironment_1_4* gEnv = WifiHidlEnvironment_1_4::Instance();
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
::testing::AddGlobalTestEnvironment(gEnv);
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
gEnv->init(&argc, argv);
|
||||
int status = RUN_ALL_TESTS();
|
||||
LOG(INFO) << "Test result = " << status;
|
||||
return status;
|
||||
}
|
||||
// TODO(b/143892896): Remove this file after wifi_hidl_test_utils.cpp is
|
||||
// updated.
|
||||
::testing::VtsHalHidlTargetTestEnvBase* gEnv = nullptr;
|
||||
@@ -14,9 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <android/hardware/wifi/1.4/IWifi.h>
|
||||
#include <android/hardware/wifi/1.4/IWifiApIface.h>
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <hidl/GtestPrinter.h>
|
||||
#include <hidl/ServiceManagement.h>
|
||||
|
||||
#include "wifi_hidl_call_util.h"
|
||||
#include "wifi_hidl_test_utils.h"
|
||||
@@ -25,6 +27,7 @@ using ::android::sp;
|
||||
using ::android::hardware::hidl_array;
|
||||
using ::android::hardware::wifi::V1_0::WifiStatus;
|
||||
using ::android::hardware::wifi::V1_0::WifiStatusCode;
|
||||
using ::android::hardware::wifi::V1_4::IWifi;
|
||||
using ::android::hardware::wifi::V1_4::IWifiApIface;
|
||||
|
||||
extern WifiHidlEnvironment* gEnv;
|
||||
@@ -32,19 +35,21 @@ extern WifiHidlEnvironment* gEnv;
|
||||
/**
|
||||
* Fixture to use for all STA Iface HIDL interface tests.
|
||||
*/
|
||||
class WifiApIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
class WifiApIfaceHidlTest : public ::testing::TestWithParam<std::string> {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
wifi_ap_iface_ = IWifiApIface::castFrom(getWifiApIface());
|
||||
wifi_ap_iface_ =
|
||||
IWifiApIface::castFrom(getWifiApIface(GetInstanceName()));
|
||||
ASSERT_NE(nullptr, wifi_ap_iface_.get());
|
||||
}
|
||||
|
||||
virtual void TearDown() override {
|
||||
stopWifi();
|
||||
}
|
||||
virtual void TearDown() override { stopWifi(GetInstanceName()); }
|
||||
|
||||
protected:
|
||||
sp<IWifiApIface> wifi_ap_iface_;
|
||||
|
||||
private:
|
||||
std::string GetInstanceName() { return GetParam(); }
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -52,7 +57,7 @@ class WifiApIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
* Ensures that calls to set MAC address will return a success status
|
||||
* code.
|
||||
*/
|
||||
TEST_F(WifiApIfaceHidlTest, SetMacAddress) {
|
||||
TEST_P(WifiApIfaceHidlTest, SetMacAddress) {
|
||||
const hidl_array<uint8_t, 6> kMac{{0x12, 0x22, 0x33, 0x52, 0x10, 0x41}};
|
||||
EXPECT_EQ(WifiStatusCode::SUCCESS,
|
||||
HIDL_INVOKE(wifi_ap_iface_, setMacAddress, kMac).code);
|
||||
@@ -63,10 +68,16 @@ TEST_F(WifiApIfaceHidlTest, SetMacAddress) {
|
||||
* Ensures that calls to get factory MAC address will retrieve a non-zero MAC
|
||||
* and return a success status code.
|
||||
*/
|
||||
TEST_F(WifiApIfaceHidlTest, GetFactoryMacAddress) {
|
||||
TEST_P(WifiApIfaceHidlTest, GetFactoryMacAddress) {
|
||||
std::pair<WifiStatus, hidl_array<uint8_t, 6> > status_and_mac =
|
||||
HIDL_INVOKE(wifi_ap_iface_, getFactoryMacAddress);
|
||||
EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_mac.first.code);
|
||||
hidl_array<uint8_t, 6> all_zero{};
|
||||
EXPECT_NE(all_zero, status_and_mac.second);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
PerInstance, WifiApIfaceHidlTest,
|
||||
testing::ValuesIn(
|
||||
android::hardware::getAllHalInstanceNames(IWifi::descriptor)),
|
||||
android::hardware::PrintInstanceNameToString);
|
||||
Reference in New Issue
Block a user