Add vts tests on CBRS related HAL APIs

Bug: 121345298
Test: vts
Change-Id: I011f052fdaa07dcd571d2357865486c7708f797a
Merged-In: I011f052fdaa07dcd571d2357865486c7708f797a
This commit is contained in:
Malcolm Chen 2019-02-22 18:41:55 -08:00 committed by Xiangyu/Malcolm Chen
parent 7042a1aa9d
commit 5d51ea67e2
5 changed files with 127 additions and 1 deletions

View file

@ -75,3 +75,36 @@ TEST_F(RadioHidlTest_v1_3, getModemStackStatus) {
radioRsp_v1_3->rspInfo.error,
{RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR}));
}
/*
* Test IRadio.setSystemSelectionChannels() for the response returned.
*/
TEST_F(RadioHidlTest_v1_3, setSystemSelectionChannels) {
serial = GetRandomSerialNumber();
RadioAccessSpecifier specifier = {.radioAccessNetwork = RadioAccessNetworks::GERAN,
.geranBands = {GeranBands::BAND_450, GeranBands::BAND_480},
.channels = {1, 2}};
Return<void> res = radio_v1_3->setSystemSelectionChannels(serial, true, {specifier});
ASSERT_OK(res);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_3->rspInfo.type);
EXPECT_EQ(serial, radioRsp_v1_3->rspInfo.serial);
ALOGI("setSystemSelectionChannels, rspInfo.error = %s\n",
toString(radioRsp_v1_3->rspInfo.error).c_str());
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_v1_3->rspInfo.error,
{RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::INTERNAL_ERR}));
if (radioRsp_v1_3->rspInfo.error == RadioError::NONE) {
Return<void> res = radio_v1_3->setSystemSelectionChannels(serial, false, {specifier});
ASSERT_OK(res);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_3->rspInfo.type);
EXPECT_EQ(serial, radioRsp_v1_3->rspInfo.serial);
ALOGI("setSystemSelectionChannels, rspInfo.error = %s\n",
toString(radioRsp_v1_3->rspInfo.error).c_str());
EXPECT_EQ(RadioError::NONE, radioRsp_v1_3->rspInfo.error);
}
}

View file

@ -769,12 +769,14 @@ Return<void> RadioResponse_v1_3::getDataRegistrationStateResponse_1_2(
/* 1.3 Api */
Return<void> RadioResponse_v1_3::setSystemSelectionChannelsResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_v1_3.notify(info.serial);
return Void();
}
Return<void> RadioResponse_v1_3::enableModemResponse(const RadioResponseInfo& info) {
rspInfo = info;
enableModemResponseToggle = !enableModemResponseToggle;
parent_v1_3.notify(info.serial);
return Void();
}
@ -782,5 +784,6 @@ Return<void> RadioResponse_v1_3::getModemStackStatusResponse(const RadioResponse
const bool enabled) {
rspInfo = info;
isModemEnabled = enabled;
parent_v1_3.notify(info.serial);
return Void();
}

View file

@ -69,3 +69,89 @@ TEST_F(RadioConfigHidlTest, setModemsConfig_goodRequest) {
ASSERT_TRUE(CheckAnyOfErrors(radioConfigRsp->rspInfo.error,
{RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
}
/*
* Test IRadioConfig.getPhoneCapability()
*/
TEST_F(RadioConfigHidlTest, getPhoneCapability) {
serial = GetRandomSerialNumber();
Return<void> res = radioConfig->getPhoneCapability(serial);
ASSERT_OK(res);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioConfigRsp->rspInfo.type);
EXPECT_EQ(serial, radioConfigRsp->rspInfo.serial);
ALOGI("getPhoneCapability, rspInfo.error = %s\n",
toString(radioConfigRsp->rspInfo.error).c_str());
ASSERT_TRUE(CheckAnyOfErrors(
radioConfigRsp->rspInfo.error,
{RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::INTERNAL_ERR}));
if (radioConfigRsp->rspInfo.error == RadioError ::NONE) {
// maxActiveData should be greater than or equal to maxActiveInternetData.
EXPECT_GE(radioConfigRsp->phoneCap.maxActiveData,
radioConfigRsp->phoneCap.maxActiveInternetData);
// maxActiveData and maxActiveInternetData should be 0 or positive numbers.
EXPECT_GE(radioConfigRsp->phoneCap.maxActiveInternetData, 0);
}
}
/*
* Test IRadioConfig.getPhoneCapability()
*/
TEST_F(RadioConfigHidlTest, setPreferredDataModem) {
serial = GetRandomSerialNumber();
Return<void> res = radioConfig->getPhoneCapability(serial);
ASSERT_OK(res);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioConfigRsp->rspInfo.type);
EXPECT_EQ(serial, radioConfigRsp->rspInfo.serial);
ALOGI("getPhoneCapability, rspInfo.error = %s\n",
toString(radioConfigRsp->rspInfo.error).c_str());
ASSERT_TRUE(CheckAnyOfErrors(
radioConfigRsp->rspInfo.error,
{RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::INTERNAL_ERR}));
if (radioConfigRsp->rspInfo.error != RadioError ::NONE) {
return;
}
if (radioConfigRsp->phoneCap.logicalModemList.size() == 0) {
return;
}
// We get phoneCapability. send setPreferredDataModem command
serial = GetRandomSerialNumber();
uint8_t modemId = radioConfigRsp->phoneCap.logicalModemList[0].modemId;
res = radioConfig->setPreferredDataModem(serial, modemId);
ASSERT_OK(res);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioConfigRsp->rspInfo.type);
EXPECT_EQ(serial, radioConfigRsp->rspInfo.serial);
ALOGI("getModemsConfig, rspInfo.error = %s\n", toString(radioConfigRsp->rspInfo.error).c_str());
ASSERT_TRUE(CheckAnyOfErrors(
radioConfigRsp->rspInfo.error,
{RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::INTERNAL_ERR}));
}
/*
* Test IRadioConfig.getPhoneCapability()
*/
TEST_F(RadioConfigHidlTest, setPreferredDataModem_invalidArgument) {
serial = GetRandomSerialNumber();
uint8_t modemId = -1;
Return<void> res = radioConfig->setPreferredDataModem(serial, modemId);
ASSERT_OK(res);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioConfigRsp->rspInfo.type);
EXPECT_EQ(serial, radioConfigRsp->rspInfo.serial);
ALOGI("getModemsConfig, rspInfo.error = %s\n", toString(radioConfigRsp->rspInfo.error).c_str());
ASSERT_TRUE(CheckAnyOfErrors(radioConfigRsp->rspInfo.error,
{RadioError::INVALID_ARGUMENTS, RadioError::RADIO_NOT_AVAILABLE,
RadioError::INTERNAL_ERR}));
}

View file

@ -51,6 +51,7 @@ class RadioConfigResponse : public IRadioConfigResponse {
public:
RadioResponseInfo rspInfo;
PhoneCapability phoneCap;
RadioConfigResponse(RadioConfigHidlTest& parent);
virtual ~RadioConfigResponse() = default;

View file

@ -31,7 +31,10 @@ Return<void> RadioConfigResponse::setSimSlotsMappingResponse(const RadioResponse
}
Return<void> RadioConfigResponse::getPhoneCapabilityResponse(
const RadioResponseInfo& /* info */, const PhoneCapability& /* phoneCapability */) {
const RadioResponseInfo& info, const PhoneCapability& phoneCapability) {
rspInfo = info;
phoneCap = phoneCapability;
parent.notify(info.serial);
return Void();
}