Loading wifi/1.0/vts/functional/Android.bp +3 −3 Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ cc_test { "android.hardware.wifi@1.3", "libwifi-system-iface" ], 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 Loading @@ -70,7 +70,7 @@ cc_test { "android.hardware.wifi@1.0", "libwifi-system-iface" ], test_suites: ["general-tests"], test_suites: ["general-tests", "vts-core"], } // These tests are split out so that they can be conditioned on presence of Loading @@ -88,5 +88,5 @@ cc_test { "android.hardware.wifi@1.0", "libwifi-system-iface" ], test_suites: ["general-tests"], test_suites: ["general-tests", "vts-core"], } wifi/1.0/vts/functional/VtsHalWifiV1_0TargetTest.cpp +4 −30 Original line number Diff line number Diff line Loading @@ -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; No newline at end of file wifi/1.0/vts/functional/wifi_ap_iface_hidl_test.cpp +21 −14 Original line number Diff line number Diff line Loading @@ -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(); } }; /* Loading @@ -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); Loading @@ -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, Loading @@ -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); No newline at end of file wifi/1.0/vts/functional/wifi_chip_hidl_ap_test.cpp +21 −9 Original line number Diff line number Diff line Loading @@ -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" Loading @@ -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; Loading @@ -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. Loading Loading @@ -72,6 +75,9 @@ class WifiChipHidlApTest : public ::testing::VtsHalHidlTargetTestBase { } sp<IWifiChip> wifi_chip_; private: std::string GetInstanceName() { return GetParam(); } }; /* Loading @@ -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; Loading @@ -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 = Loading Loading @@ -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; Loading @@ -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; Loading @@ -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); No newline at end of file wifi/1.0/vts/functional/wifi_chip_hidl_nan_test.cpp +21 −9 Original line number Diff line number Diff line Loading @@ -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" Loading @@ -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; Loading @@ -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. Loading Loading @@ -72,6 +75,9 @@ class WifiChipHidlNanTest : public ::testing::VtsHalHidlTargetTestBase { } sp<IWifiChip> wifi_chip_; private: std::string GetInstanceName() { return GetParam(); } }; /* Loading @@ -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; Loading @@ -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 = Loading Loading @@ -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; Loading @@ -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; Loading @@ -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); No newline at end of file Loading
wifi/1.0/vts/functional/Android.bp +3 −3 Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ cc_test { "android.hardware.wifi@1.3", "libwifi-system-iface" ], 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 Loading @@ -70,7 +70,7 @@ cc_test { "android.hardware.wifi@1.0", "libwifi-system-iface" ], test_suites: ["general-tests"], test_suites: ["general-tests", "vts-core"], } // These tests are split out so that they can be conditioned on presence of Loading @@ -88,5 +88,5 @@ cc_test { "android.hardware.wifi@1.0", "libwifi-system-iface" ], test_suites: ["general-tests"], test_suites: ["general-tests", "vts-core"], }
wifi/1.0/vts/functional/VtsHalWifiV1_0TargetTest.cpp +4 −30 Original line number Diff line number Diff line Loading @@ -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; No newline at end of file
wifi/1.0/vts/functional/wifi_ap_iface_hidl_test.cpp +21 −14 Original line number Diff line number Diff line Loading @@ -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(); } }; /* Loading @@ -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); Loading @@ -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, Loading @@ -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); No newline at end of file
wifi/1.0/vts/functional/wifi_chip_hidl_ap_test.cpp +21 −9 Original line number Diff line number Diff line Loading @@ -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" Loading @@ -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; Loading @@ -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. Loading Loading @@ -72,6 +75,9 @@ class WifiChipHidlApTest : public ::testing::VtsHalHidlTargetTestBase { } sp<IWifiChip> wifi_chip_; private: std::string GetInstanceName() { return GetParam(); } }; /* Loading @@ -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; Loading @@ -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 = Loading Loading @@ -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; Loading @@ -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; Loading @@ -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); No newline at end of file
wifi/1.0/vts/functional/wifi_chip_hidl_nan_test.cpp +21 −9 Original line number Diff line number Diff line Loading @@ -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" Loading @@ -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; Loading @@ -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. Loading Loading @@ -72,6 +75,9 @@ class WifiChipHidlNanTest : public ::testing::VtsHalHidlTargetTestBase { } sp<IWifiChip> wifi_chip_; private: std::string GetInstanceName() { return GetParam(); } }; /* Loading @@ -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; Loading @@ -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 = Loading Loading @@ -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; Loading @@ -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; Loading @@ -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); No newline at end of file