From 7a5a185dc6e71ce97d41a74f6164d12e63765c00 Mon Sep 17 00:00:00 2001 From: Ningyuan Wang Date: Tue, 11 Apr 2017 10:32:05 -0700 Subject: [PATCH] Add more VTS tests for SupplicantStaIface This covers the following APIs by adding tests to ISupplicantStaIface: ISupplicantStaIface::setExternalSim(), ISupplicantStaIface::addExtRadioWork(), ISupplicantStaIface::removeExtRadioWork() Bug: 33457575 Test: VTS tests pass Change-Id: Ie252ecf8e6e0cdc9d669a5fec18e076dc2d03eba --- .../supplicant_sta_iface_hidl_test.cpp | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/wifi/supplicant/1.0/vts/functional/supplicant_sta_iface_hidl_test.cpp b/wifi/supplicant/1.0/vts/functional/supplicant_sta_iface_hidl_test.cpp index 5abf4e04d9..b2ff4bae96 100644 --- a/wifi/supplicant/1.0/vts/functional/supplicant_sta_iface_hidl_test.cpp +++ b/wifi/supplicant/1.0/vts/functional/supplicant_sta_iface_hidl_test.cpp @@ -20,6 +20,7 @@ #include +#include "supplicant_hidl_call_util.h" #include "supplicant_hidl_test_utils.h" using ::android::sp; @@ -45,6 +46,10 @@ constexpr ISupplicantStaIface::Hs20AnqpSubtypes kTestHs20Types[] = { ISupplicantStaIface::Hs20AnqpSubtypes::WAN_METRICS, ISupplicantStaIface::Hs20AnqpSubtypes::OPERATOR_FRIENDLY_NAME}; constexpr char kTestHs20IconFile[] = "TestFile"; +constexpr char kTestRadioWorkName[] = "TestRadioWork"; +constexpr uint32_t kTestRadioWorkFrequency = 2412; +constexpr uint32_t kTestRadioWorkTimeout = 8; +constexpr uint32_t kTestRadioWorkId = 16; constexpr int8_t kTestCountryCode[] = {'U', 'S'}; } // namespace @@ -405,3 +410,38 @@ TEST_F(SupplicantStaIfaceHidlTest, SetCountryCode) { EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code); }); } + +/* + * SetExternalSim + */ +TEST_F(SupplicantStaIfaceHidlTest, SetExternalSim) { + EXPECT_EQ(SupplicantStatusCode::SUCCESS, + HIDL_INVOKE(sta_iface_, setExternalSim, true).code); + EXPECT_EQ(SupplicantStatusCode::SUCCESS, + HIDL_INVOKE(sta_iface_, setExternalSim, false).code); +} + +/* + * AddExtRadioWork + */ +TEST_F(SupplicantStaIfaceHidlTest, AddExtRadioWork) { + const auto& status_and_radio_work_id = + HIDL_INVOKE(sta_iface_, addExtRadioWork, kTestRadioWorkName, + kTestRadioWorkFrequency, kTestRadioWorkTimeout); + EXPECT_EQ(SupplicantStatusCode::SUCCESS, + status_and_radio_work_id.first.code); + // removeExtRadio only succeeds if the added radio work hasn't started yet. + // So there this no guaranteed result from calling removeExtRadioWork here. + // That being said, currently we are not able to test addExtRadioWork and + // removeExtRadioWork in a row. +} + +/* + * RemoveExtRadioWork + */ +TEST_F(SupplicantStaIfaceHidlTest, RemoveExtRadioWork) { + // This fails because there is no on going radio work with kTestRadioWorkId. + EXPECT_NE( + SupplicantStatusCode::SUCCESS, + HIDL_INVOKE(sta_iface_, removeExtRadioWork, kTestRadioWorkId).code); +}