Loading wifi/1.0/vts/functional/wifi_ap_iface_hidl_test.cpp +11 −1 Original line number Diff line number Diff line Loading @@ -29,17 +29,23 @@ using ::android::hardware::wifi::V1_0::WifiBand; using ::android::hardware::wifi::V1_0::WifiStatusCode; using ::android::sp; extern WifiHidlEnvironment* gEnv; /** * Fixture to use for all AP Iface HIDL interface tests. */ class WifiApIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase { public: virtual void SetUp() override { if (!gEnv->isSoftApOn) return; wifi_ap_iface_ = getWifiApIface(); ASSERT_NE(nullptr, wifi_ap_iface_.get()); } virtual void TearDown() override { stopWifi(); } virtual void TearDown() override { if (!gEnv->isSoftApOn) return; stopWifi(); } protected: sp<IWifiApIface> wifi_ap_iface_; Loading @@ -51,6 +57,7 @@ class WifiApIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase { * successfully created. */ TEST(WifiApIfaceHidlTestNoFixture, Create) { if (!gEnv->isSoftApOn) return; EXPECT_NE(nullptr, getWifiApIface().get()); stopWifi(); } Loading @@ -60,6 +67,7 @@ TEST(WifiApIfaceHidlTestNoFixture, Create) { * Ensures that the correct interface type is returned for AP interface. */ TEST_F(WifiApIfaceHidlTest, GetType) { if (!gEnv->isSoftApOn) return; 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 @@ -71,6 +79,7 @@ TEST_F(WifiApIfaceHidlTest, GetType) { * status code. */ TEST_F(WifiApIfaceHidlTest, SetCountryCode) { if (!gEnv->isSoftApOn) return; const android::hardware::hidl_array<int8_t, 2> kCountryCode{ std::array<int8_t, 2>{{0x55, 0x53}}}; EXPECT_EQ(WifiStatusCode::SUCCESS, Loading @@ -82,6 +91,7 @@ TEST_F(WifiApIfaceHidlTest, SetCountryCode) { * Ensures that we can retrieve valid frequencies for 2.4 GHz band. */ TEST_F(WifiApIfaceHidlTest, GetValidFrequenciesForBand) { if (!gEnv->isSoftApOn) return; const auto& status_and_freqs = HIDL_INVOKE( wifi_ap_iface_, getValidFrequenciesForBand, WifiBand::BAND_24GHZ); EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_freqs.first.code); Loading wifi/1.0/vts/functional/wifi_chip_hidl_test.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -365,6 +365,7 @@ TEST_F(WifiChipHidlTest, GetDebugHostWakeReasonStats) { * succeeds. The 2nd iface creation should be rejected. */ TEST_F(WifiChipHidlTest, CreateApIface) { if (!gEnv->isSoftApOn) return; configureChipForIfaceType(IfaceType::AP, true); sp<IWifiApIface> iface; Loading @@ -381,6 +382,7 @@ TEST_F(WifiChipHidlTest, CreateApIface) { * iface name is returned via the list. */ TEST_F(WifiChipHidlTest, GetApIfaceNames) { if (!gEnv->isSoftApOn) return; configureChipForIfaceType(IfaceType::AP, true); const auto& status_and_iface_names1 = Loading Loading @@ -413,6 +415,7 @@ TEST_F(WifiChipHidlTest, GetApIfaceNames) { * doesn't retrieve an iface object. */ TEST_F(WifiChipHidlTest, GetApIface) { if (!gEnv->isSoftApOn) return; configureChipForIfaceType(IfaceType::AP, true); sp<IWifiApIface> ap_iface; Loading @@ -439,6 +442,7 @@ TEST_F(WifiChipHidlTest, GetApIface) { * doesn't remove the iface. */ TEST_F(WifiChipHidlTest, RemoveApIface) { if (!gEnv->isSoftApOn) return; configureChipForIfaceType(IfaceType::AP, true); sp<IWifiApIface> ap_iface; Loading wifi/1.0/vts/functional/wifi_hidl_test_utils.h +9 −2 Original line number Diff line number Diff line Loading @@ -58,26 +58,33 @@ class WifiHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase { public: // Whether NaN feature is supported on the device. bool isNanOn = false; // Whether SoftAp feature is supported on the device. bool isSoftApOn = false; void usage(char* me, char* arg) { fprintf(stderr, "unrecognized option: %s\n\n" "usage: %s <gtest options> <test options>\n\n" "test options are:\n\n" "-N, --nan_on: Whether NAN feature is supported\n", "-N, --nan_on: Whether NAN feature is supported\n" "-S, --softap_on: Whether SOFTAP feature is supported\n", arg, me); } int initFromOptions(int argc, char** argv) { static struct option options[] = {{"nan_on", no_argument, 0, 'N'}, {"softap_on", no_argument, 0, 'S'}, {0, 0, 0, 0}}; int c; while ((c = getopt_long(argc, argv, "N", options, NULL)) >= 0) { while ((c = getopt_long(argc, argv, "NS", options, NULL)) >= 0) { switch (c) { case 'N': isNanOn = true; break; case 'S': isSoftApOn = true; break; default: usage(argv[0], argv[optind]); return 2; Loading Loading
wifi/1.0/vts/functional/wifi_ap_iface_hidl_test.cpp +11 −1 Original line number Diff line number Diff line Loading @@ -29,17 +29,23 @@ using ::android::hardware::wifi::V1_0::WifiBand; using ::android::hardware::wifi::V1_0::WifiStatusCode; using ::android::sp; extern WifiHidlEnvironment* gEnv; /** * Fixture to use for all AP Iface HIDL interface tests. */ class WifiApIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase { public: virtual void SetUp() override { if (!gEnv->isSoftApOn) return; wifi_ap_iface_ = getWifiApIface(); ASSERT_NE(nullptr, wifi_ap_iface_.get()); } virtual void TearDown() override { stopWifi(); } virtual void TearDown() override { if (!gEnv->isSoftApOn) return; stopWifi(); } protected: sp<IWifiApIface> wifi_ap_iface_; Loading @@ -51,6 +57,7 @@ class WifiApIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase { * successfully created. */ TEST(WifiApIfaceHidlTestNoFixture, Create) { if (!gEnv->isSoftApOn) return; EXPECT_NE(nullptr, getWifiApIface().get()); stopWifi(); } Loading @@ -60,6 +67,7 @@ TEST(WifiApIfaceHidlTestNoFixture, Create) { * Ensures that the correct interface type is returned for AP interface. */ TEST_F(WifiApIfaceHidlTest, GetType) { if (!gEnv->isSoftApOn) return; 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 @@ -71,6 +79,7 @@ TEST_F(WifiApIfaceHidlTest, GetType) { * status code. */ TEST_F(WifiApIfaceHidlTest, SetCountryCode) { if (!gEnv->isSoftApOn) return; const android::hardware::hidl_array<int8_t, 2> kCountryCode{ std::array<int8_t, 2>{{0x55, 0x53}}}; EXPECT_EQ(WifiStatusCode::SUCCESS, Loading @@ -82,6 +91,7 @@ TEST_F(WifiApIfaceHidlTest, SetCountryCode) { * Ensures that we can retrieve valid frequencies for 2.4 GHz band. */ TEST_F(WifiApIfaceHidlTest, GetValidFrequenciesForBand) { if (!gEnv->isSoftApOn) return; const auto& status_and_freqs = HIDL_INVOKE( wifi_ap_iface_, getValidFrequenciesForBand, WifiBand::BAND_24GHZ); EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_freqs.first.code); Loading
wifi/1.0/vts/functional/wifi_chip_hidl_test.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -365,6 +365,7 @@ TEST_F(WifiChipHidlTest, GetDebugHostWakeReasonStats) { * succeeds. The 2nd iface creation should be rejected. */ TEST_F(WifiChipHidlTest, CreateApIface) { if (!gEnv->isSoftApOn) return; configureChipForIfaceType(IfaceType::AP, true); sp<IWifiApIface> iface; Loading @@ -381,6 +382,7 @@ TEST_F(WifiChipHidlTest, CreateApIface) { * iface name is returned via the list. */ TEST_F(WifiChipHidlTest, GetApIfaceNames) { if (!gEnv->isSoftApOn) return; configureChipForIfaceType(IfaceType::AP, true); const auto& status_and_iface_names1 = Loading Loading @@ -413,6 +415,7 @@ TEST_F(WifiChipHidlTest, GetApIfaceNames) { * doesn't retrieve an iface object. */ TEST_F(WifiChipHidlTest, GetApIface) { if (!gEnv->isSoftApOn) return; configureChipForIfaceType(IfaceType::AP, true); sp<IWifiApIface> ap_iface; Loading @@ -439,6 +442,7 @@ TEST_F(WifiChipHidlTest, GetApIface) { * doesn't remove the iface. */ TEST_F(WifiChipHidlTest, RemoveApIface) { if (!gEnv->isSoftApOn) return; configureChipForIfaceType(IfaceType::AP, true); sp<IWifiApIface> ap_iface; Loading
wifi/1.0/vts/functional/wifi_hidl_test_utils.h +9 −2 Original line number Diff line number Diff line Loading @@ -58,26 +58,33 @@ class WifiHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase { public: // Whether NaN feature is supported on the device. bool isNanOn = false; // Whether SoftAp feature is supported on the device. bool isSoftApOn = false; void usage(char* me, char* arg) { fprintf(stderr, "unrecognized option: %s\n\n" "usage: %s <gtest options> <test options>\n\n" "test options are:\n\n" "-N, --nan_on: Whether NAN feature is supported\n", "-N, --nan_on: Whether NAN feature is supported\n" "-S, --softap_on: Whether SOFTAP feature is supported\n", arg, me); } int initFromOptions(int argc, char** argv) { static struct option options[] = {{"nan_on", no_argument, 0, 'N'}, {"softap_on", no_argument, 0, 'S'}, {0, 0, 0, 0}}; int c; while ((c = getopt_long(argc, argv, "N", options, NULL)) >= 0) { while ((c = getopt_long(argc, argv, "NS", options, NULL)) >= 0) { switch (c) { case 'N': isNanOn = true; break; case 'S': isSoftApOn = true; break; default: usage(argv[0], argv[optind]); return 2; Loading