Merge "Generate serial number randomly in VTS unit test"

am: 0c49ae609f

Change-Id: Ie1b1a3bcb2ae5f2412c75f09bdab4c50bc50e715
This commit is contained in:
sqian 2017-05-31 21:38:19 +00:00 committed by android-build-merger
commit 63724d3555
20 changed files with 2614 additions and 2686 deletions

View file

@ -27,7 +27,8 @@ cc_test {
"radio_hidl_hal_test.cpp",
"radio_hidl_hal_voice.cpp",
"radio_response.cpp",
"VtsHalRadioV1_0TargetTest.cpp"],
"VtsHalRadioV1_0TargetTest.cpp",
"vts_test_util.cpp"],
shared_libs: [
"libbase",
"liblog",
@ -51,7 +52,8 @@ cc_test {
srcs: ["sap_callback.cpp",
"sap_hidl_hal_api.cpp",
"sap_hidl_hal_test.cpp",
"VtsHalSapV1_0TargetTest.cpp"],
"VtsHalSapV1_0TargetTest.cpp",
"vts_test_util.cpp"],
shared_libs: [
"libbase",
"liblog",

View file

@ -17,11 +17,16 @@
#include <radio_hidl_hal_utils.h>
int main(int argc, char** argv) {
::testing::AddGlobalTestEnvironment(new RadioHidlEnvironment);
::testing::InitGoogleTest(&argc, argv);
::testing::AddGlobalTestEnvironment(new RadioHidlEnvironment);
::testing::InitGoogleTest(&argc, argv);
int status = RUN_ALL_TESTS();
LOG(INFO) << "Test result = " << status;
// setup seed for rand function
int seedSrand = time(NULL);
std::cout << "seed setup for random function (radio):" + std::to_string(seedSrand) << std::endl;
srand(seedSrand);
return status;
int status = RUN_ALL_TESTS();
LOG(INFO) << "Test result = " << status;
return status;
}

View file

@ -17,12 +17,17 @@
#include <sap_hidl_hal_utils.h>
int main(int argc, char** argv) {
// Add Sim-access Profile Hidl Environment
::testing::AddGlobalTestEnvironment(new SapHidlEnvironment);
::testing::InitGoogleTest(&argc, argv);
// Add Sim-access Profile Hidl Environment
::testing::AddGlobalTestEnvironment(new SapHidlEnvironment);
::testing::InitGoogleTest(&argc, argv);
int status = RUN_ALL_TESTS();
LOG(INFO) << "Test result = " << status;
// setup seed for rand function
int seedSrand = time(NULL);
std::cout << "seed setup for random function (sap):" + std::to_string(seedSrand) << std::endl;
srand(seedSrand);
return status;
int status = RUN_ALL_TESTS();
LOG(INFO) << "Test result = " << status;
return status;
}

View file

@ -22,165 +22,163 @@ using namespace ::android::hardware::radio::V1_0;
* Test IRadio.setGsmBroadcastConfig() for the response returned.
*/
TEST_F(RadioHidlTest, setGsmBroadcastConfig) {
int serial = 0;
int serial = GetRandomSerialNumber();
// Create GsmBroadcastSmsConfigInfo #1
GsmBroadcastSmsConfigInfo gbSmsConfig1;
gbSmsConfig1.fromServiceId = 4352;
gbSmsConfig1.toServiceId = 4354;
gbSmsConfig1.fromCodeScheme = 0;
gbSmsConfig1.toCodeScheme = 255;
gbSmsConfig1.selected = true;
// Create GsmBroadcastSmsConfigInfo #1
GsmBroadcastSmsConfigInfo gbSmsConfig1;
gbSmsConfig1.fromServiceId = 4352;
gbSmsConfig1.toServiceId = 4354;
gbSmsConfig1.fromCodeScheme = 0;
gbSmsConfig1.toCodeScheme = 255;
gbSmsConfig1.selected = true;
// Create GsmBroadcastSmsConfigInfo #2
GsmBroadcastSmsConfigInfo gbSmsConfig2;
gbSmsConfig2.fromServiceId = 4356;
gbSmsConfig2.toServiceId = 4356;
gbSmsConfig2.fromCodeScheme = 0;
gbSmsConfig2.toCodeScheme = 255;
gbSmsConfig2.selected = true;
// Create GsmBroadcastSmsConfigInfo #2
GsmBroadcastSmsConfigInfo gbSmsConfig2;
gbSmsConfig2.fromServiceId = 4356;
gbSmsConfig2.toServiceId = 4356;
gbSmsConfig2.fromCodeScheme = 0;
gbSmsConfig2.toCodeScheme = 255;
gbSmsConfig2.selected = true;
// Create GsmBroadcastSmsConfigInfo #3
GsmBroadcastSmsConfigInfo gbSmsConfig3;
gbSmsConfig3.fromServiceId = 4370;
gbSmsConfig3.toServiceId = 4379;
gbSmsConfig3.fromCodeScheme = 0;
gbSmsConfig3.toCodeScheme = 255;
gbSmsConfig3.selected = true;
// Create GsmBroadcastSmsConfigInfo #3
GsmBroadcastSmsConfigInfo gbSmsConfig3;
gbSmsConfig3.fromServiceId = 4370;
gbSmsConfig3.toServiceId = 4379;
gbSmsConfig3.fromCodeScheme = 0;
gbSmsConfig3.toCodeScheme = 255;
gbSmsConfig3.selected = true;
// Create GsmBroadcastSmsConfigInfo #4
GsmBroadcastSmsConfigInfo gbSmsConfig4;
gbSmsConfig4.fromServiceId = 4383;
gbSmsConfig4.toServiceId = 4391;
gbSmsConfig4.fromCodeScheme = 0;
gbSmsConfig4.toCodeScheme = 255;
gbSmsConfig4.selected = true;
// Create GsmBroadcastSmsConfigInfo #4
GsmBroadcastSmsConfigInfo gbSmsConfig4;
gbSmsConfig4.fromServiceId = 4383;
gbSmsConfig4.toServiceId = 4391;
gbSmsConfig4.fromCodeScheme = 0;
gbSmsConfig4.toCodeScheme = 255;
gbSmsConfig4.selected = true;
// Create GsmBroadcastSmsConfigInfo #5
GsmBroadcastSmsConfigInfo gbSmsConfig5;
gbSmsConfig5.fromServiceId = 4392;
gbSmsConfig5.toServiceId = 4392;
gbSmsConfig5.fromCodeScheme = 0;
gbSmsConfig5.toCodeScheme = 255;
gbSmsConfig5.selected = true;
// Create GsmBroadcastSmsConfigInfo #5
GsmBroadcastSmsConfigInfo gbSmsConfig5;
gbSmsConfig5.fromServiceId = 4392;
gbSmsConfig5.toServiceId = 4392;
gbSmsConfig5.fromCodeScheme = 0;
gbSmsConfig5.toCodeScheme = 255;
gbSmsConfig5.selected = true;
android::hardware::hidl_vec<GsmBroadcastSmsConfigInfo>
gsmBroadcastSmsConfigsInfoList = {
gbSmsConfig1, gbSmsConfig2, gbSmsConfig3, gbSmsConfig4, gbSmsConfig5};
android::hardware::hidl_vec<GsmBroadcastSmsConfigInfo> gsmBroadcastSmsConfigsInfoList = {
gbSmsConfig1, gbSmsConfig2, gbSmsConfig3, gbSmsConfig4, gbSmsConfig5};
radio->setGsmBroadcastConfig(++serial, gsmBroadcastSmsConfigsInfoList);
radio->setGsmBroadcastConfig(serial, gsmBroadcastSmsConfigsInfoList);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::NONE);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::NONE);
}
}
/*
* Test IRadio.getGsmBroadcastConfig() for the response returned.
*/
TEST_F(RadioHidlTest, getGsmBroadcastConfig) {
int serial = 0;
int serial = GetRandomSerialNumber();
radio->getGsmBroadcastConfig(++serial);
radio->getGsmBroadcastConfig(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::NONE);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() || radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::NONE);
}
}
/*
* Test IRadio.setCdmaBroadcastConfig() for the response returned.
*/
TEST_F(RadioHidlTest, setCdmaBroadcastConfig) {
int serial = 0;
int serial = GetRandomSerialNumber();
CdmaBroadcastSmsConfigInfo cbSmsConfig;
cbSmsConfig.serviceCategory = 4096;
cbSmsConfig.language = 1;
cbSmsConfig.selected = true;
CdmaBroadcastSmsConfigInfo cbSmsConfig;
cbSmsConfig.serviceCategory = 4096;
cbSmsConfig.language = 1;
cbSmsConfig.selected = true;
android::hardware::hidl_vec<CdmaBroadcastSmsConfigInfo>
cdmaBroadcastSmsConfigInfoList = {cbSmsConfig};
android::hardware::hidl_vec<CdmaBroadcastSmsConfigInfo> cdmaBroadcastSmsConfigInfoList = {
cbSmsConfig};
radio->setCdmaBroadcastConfig(++serial, cdmaBroadcastSmsConfigInfoList);
radio->setCdmaBroadcastConfig(serial, cdmaBroadcastSmsConfigInfoList);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS);
}
}
/*
* Test IRadio.getCdmaBroadcastConfig() for the response returned.
*/
TEST_F(RadioHidlTest, getCdmaBroadcastConfig) {
int serial = 0;
int serial = GetRandomSerialNumber();
radio->getCdmaBroadcastConfig(++serial);
radio->getCdmaBroadcastConfig(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError());
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError());
}
}
/*
* Test IRadio.setCdmaBroadcastActivation() for the response returned.
*/
TEST_F(RadioHidlTest, setCdmaBroadcastActivation) {
int serial = 0;
bool activate = false;
int serial = GetRandomSerialNumber();
bool activate = false;
radio->setCdmaBroadcastActivation(++serial, activate);
radio->setCdmaBroadcastActivation(serial, activate);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS);
}
}
/*
* Test IRadio.setGsmBroadcastActivation() for the response returned.
*/
TEST_F(RadioHidlTest, setGsmBroadcastActivation) {
int serial = 0;
bool activate = false;
int serial = GetRandomSerialNumber();
bool activate = false;
radio->setGsmBroadcastActivation(++serial, activate);
radio->setGsmBroadcastActivation(serial, activate);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::OPERATION_NOT_ALLOWED);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::OPERATION_NOT_ALLOWED);
}
}

View file

@ -22,209 +22,204 @@ using namespace ::android::hardware::radio::V1_0;
* Test IRadio.getDataRegistrationState() for the response returned.
*/
TEST_F(RadioHidlTest, getDataRegistrationState) {
int serial = 0;
int serial = GetRandomSerialNumber();
radio->getDataRegistrationState(++serial);
radio->getDataRegistrationState(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
}
if (cardStatus.cardState == CardState::ABSENT) {
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
}
}
/*
* Test IRadio.setupDataCall() for the response returned.
*/
TEST_F(RadioHidlTest, setupDataCall) {
int serial = 0;
int serial = GetRandomSerialNumber();
RadioTechnology radioTechnology = RadioTechnology::LTE;
RadioTechnology radioTechnology = RadioTechnology::LTE;
DataProfileInfo dataProfileInfo;
memset(&dataProfileInfo, 0, sizeof(dataProfileInfo));
dataProfileInfo.profileId = DataProfileId::IMS;
dataProfileInfo.apn = hidl_string("VZWIMS");
dataProfileInfo.protocol = hidl_string("IPV4V6");
dataProfileInfo.roamingProtocol = hidl_string("IPV6");
dataProfileInfo.authType = ApnAuthType::NO_PAP_NO_CHAP;
dataProfileInfo.user = "";
dataProfileInfo.password = "";
dataProfileInfo.type = DataProfileInfoType::THREE_GPP2;
dataProfileInfo.maxConnsTime = 300;
dataProfileInfo.maxConns = 20;
dataProfileInfo.waitTime = 0;
dataProfileInfo.enabled = true;
dataProfileInfo.supportedApnTypesBitmap = 320;
dataProfileInfo.bearerBitmap = 161543;
dataProfileInfo.mtu = 0;
dataProfileInfo.mvnoType = MvnoType::NONE;
dataProfileInfo.mvnoMatchData = hidl_string();
DataProfileInfo dataProfileInfo;
memset(&dataProfileInfo, 0, sizeof(dataProfileInfo));
dataProfileInfo.profileId = DataProfileId::IMS;
dataProfileInfo.apn = hidl_string("VZWIMS");
dataProfileInfo.protocol = hidl_string("IPV4V6");
dataProfileInfo.roamingProtocol = hidl_string("IPV6");
dataProfileInfo.authType = ApnAuthType::NO_PAP_NO_CHAP;
dataProfileInfo.user = "";
dataProfileInfo.password = "";
dataProfileInfo.type = DataProfileInfoType::THREE_GPP2;
dataProfileInfo.maxConnsTime = 300;
dataProfileInfo.maxConns = 20;
dataProfileInfo.waitTime = 0;
dataProfileInfo.enabled = true;
dataProfileInfo.supportedApnTypesBitmap = 320;
dataProfileInfo.bearerBitmap = 161543;
dataProfileInfo.mtu = 0;
dataProfileInfo.mvnoType = MvnoType::NONE;
dataProfileInfo.mvnoMatchData = hidl_string();
bool modemCognitive = false;
bool roamingAllowed = false;
bool isRoaming = false;
bool modemCognitive = false;
bool roamingAllowed = false;
bool isRoaming = false;
radio->setupDataCall(++serial, radioTechnology, dataProfileInfo,
modemCognitive, roamingAllowed, isRoaming);
radio->setupDataCall(serial, radioTechnology, dataProfileInfo, modemCognitive, roamingAllowed,
isRoaming);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::RADIO_NOT_AVAILABLE ||
radioRsp->rspInfo.error ==
RadioError::OP_NOT_ALLOWED_BEFORE_REG_TO_NW ||
radioRsp->rspInfo.error ==
RadioError::OP_NOT_ALLOWED_DURING_VOICE_CALL ||
CheckOEMError());
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::RADIO_NOT_AVAILABLE ||
radioRsp->rspInfo.error == RadioError::OP_NOT_ALLOWED_BEFORE_REG_TO_NW ||
radioRsp->rspInfo.error == RadioError::OP_NOT_ALLOWED_DURING_VOICE_CALL ||
CheckOEMError());
}
}
/*
* Test IRadio.deactivateDataCall() for the response returned.
*/
TEST_F(RadioHidlTest, deactivateDataCall) {
int serial = 0;
int cid = 1;
bool reasonRadioShutDown = false;
int serial = GetRandomSerialNumber();
int cid = 1;
bool reasonRadioShutDown = false;
radio->deactivateDataCall(++serial, cid, reasonRadioShutDown);
radio->deactivateDataCall(serial, cid, reasonRadioShutDown);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
EXPECT_EQ(RadioError::INVALID_CALL_ID, radioRsp->rspInfo.error);
}
if (cardStatus.cardState == CardState::ABSENT) {
EXPECT_EQ(RadioError::INVALID_CALL_ID, radioRsp->rspInfo.error);
}
}
/*
* Test IRadio.getDataCallList() for the response returned.
*/
TEST_F(RadioHidlTest, getDataCallList) {
int serial = 0;
int serial = GetRandomSerialNumber();
radio->getDataCallList(++serial);
radio->getDataCallList(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::RADIO_NOT_AVAILABLE);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::RADIO_NOT_AVAILABLE);
}
}
/*
* Test IRadio.setInitialAttachApn() for the response returned.
*/
TEST_F(RadioHidlTest, setInitialAttachApn) {
int serial = 0;
int serial = GetRandomSerialNumber();
DataProfileInfo dataProfileInfo;
memset(&dataProfileInfo, 0, sizeof(dataProfileInfo));
dataProfileInfo.profileId = DataProfileId::IMS;
dataProfileInfo.apn = hidl_string("VZWIMS");
dataProfileInfo.protocol = hidl_string("IPV4V6");
dataProfileInfo.roamingProtocol = hidl_string("IPV6");
dataProfileInfo.authType = ApnAuthType::NO_PAP_NO_CHAP;
dataProfileInfo.user = "";
dataProfileInfo.password = "";
dataProfileInfo.type = DataProfileInfoType::THREE_GPP2;
dataProfileInfo.maxConnsTime = 300;
dataProfileInfo.maxConns = 20;
dataProfileInfo.waitTime = 0;
dataProfileInfo.enabled = true;
dataProfileInfo.supportedApnTypesBitmap = 320;
dataProfileInfo.bearerBitmap = 161543;
dataProfileInfo.mtu = 0;
dataProfileInfo.mvnoType = MvnoType::NONE;
dataProfileInfo.mvnoMatchData = hidl_string();
DataProfileInfo dataProfileInfo;
memset(&dataProfileInfo, 0, sizeof(dataProfileInfo));
dataProfileInfo.profileId = DataProfileId::IMS;
dataProfileInfo.apn = hidl_string("VZWIMS");
dataProfileInfo.protocol = hidl_string("IPV4V6");
dataProfileInfo.roamingProtocol = hidl_string("IPV6");
dataProfileInfo.authType = ApnAuthType::NO_PAP_NO_CHAP;
dataProfileInfo.user = "";
dataProfileInfo.password = "";
dataProfileInfo.type = DataProfileInfoType::THREE_GPP2;
dataProfileInfo.maxConnsTime = 300;
dataProfileInfo.maxConns = 20;
dataProfileInfo.waitTime = 0;
dataProfileInfo.enabled = true;
dataProfileInfo.supportedApnTypesBitmap = 320;
dataProfileInfo.bearerBitmap = 161543;
dataProfileInfo.mtu = 0;
dataProfileInfo.mvnoType = MvnoType::NONE;
dataProfileInfo.mvnoMatchData = hidl_string();
bool modemCognitive = true;
bool isRoaming = false;
bool modemCognitive = true;
bool isRoaming = false;
radio->setInitialAttachApn(++serial, dataProfileInfo, modemCognitive,
isRoaming);
radio->setInitialAttachApn(serial, dataProfileInfo, modemCognitive, isRoaming);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::RADIO_NOT_AVAILABLE ||
radioRsp->rspInfo.error ==
RadioError::SUBSCRIPTION_NOT_AVAILABLE ||
CheckOEMError());
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::RADIO_NOT_AVAILABLE ||
radioRsp->rspInfo.error == RadioError::SUBSCRIPTION_NOT_AVAILABLE ||
CheckOEMError());
}
}
/*
* Test IRadio.setDataAllowed() for the response returned.
*/
TEST_F(RadioHidlTest, setDataAllowed) {
int serial = 0;
bool allow = true;
int serial = GetRandomSerialNumber();
bool allow = true;
radio->setDataAllowed(++serial, allow);
radio->setDataAllowed(serial, allow);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
}
if (cardStatus.cardState == CardState::ABSENT) {
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
}
}
/*
* Test IRadio.setDataProfile() for the response returned.
*/
TEST_F(RadioHidlTest, setDataProfile) {
int serial = 0;
int serial = GetRandomSerialNumber();
// Create a dataProfileInfo
DataProfileInfo dataProfileInfo;
memset(&dataProfileInfo, 0, sizeof(dataProfileInfo));
dataProfileInfo.profileId = DataProfileId::IMS;
dataProfileInfo.apn = hidl_string("VZWIMS");
dataProfileInfo.protocol = hidl_string("IPV4V6");
dataProfileInfo.roamingProtocol = hidl_string("IPV6");
dataProfileInfo.authType = ApnAuthType::NO_PAP_NO_CHAP;
dataProfileInfo.user = "";
dataProfileInfo.password = "";
dataProfileInfo.type = DataProfileInfoType::THREE_GPP2;
dataProfileInfo.maxConnsTime = 300;
dataProfileInfo.maxConns = 20;
dataProfileInfo.waitTime = 0;
dataProfileInfo.enabled = true;
dataProfileInfo.supportedApnTypesBitmap = 320;
dataProfileInfo.bearerBitmap = 161543;
dataProfileInfo.mtu = 0;
dataProfileInfo.mvnoType = MvnoType::NONE;
dataProfileInfo.mvnoMatchData = hidl_string();
// Create a dataProfileInfo
DataProfileInfo dataProfileInfo;
memset(&dataProfileInfo, 0, sizeof(dataProfileInfo));
dataProfileInfo.profileId = DataProfileId::IMS;
dataProfileInfo.apn = hidl_string("VZWIMS");
dataProfileInfo.protocol = hidl_string("IPV4V6");
dataProfileInfo.roamingProtocol = hidl_string("IPV6");
dataProfileInfo.authType = ApnAuthType::NO_PAP_NO_CHAP;
dataProfileInfo.user = "";
dataProfileInfo.password = "";
dataProfileInfo.type = DataProfileInfoType::THREE_GPP2;
dataProfileInfo.maxConnsTime = 300;
dataProfileInfo.maxConns = 20;
dataProfileInfo.waitTime = 0;
dataProfileInfo.enabled = true;
dataProfileInfo.supportedApnTypesBitmap = 320;
dataProfileInfo.bearerBitmap = 161543;
dataProfileInfo.mtu = 0;
dataProfileInfo.mvnoType = MvnoType::NONE;
dataProfileInfo.mvnoMatchData = hidl_string();
// Create a dataProfileInfoList
android::hardware::hidl_vec<DataProfileInfo> dataProfileInfoList = {
dataProfileInfo};
// Create a dataProfileInfoList
android::hardware::hidl_vec<DataProfileInfo> dataProfileInfoList = {dataProfileInfo};
bool isRoadming = false;
bool isRoadming = false;
radio->setDataProfile(++serial, dataProfileInfoList, isRoadming);
radio->setDataProfile(serial, dataProfileInfoList, isRoadming);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
// TODO(shuoq): Will add error check when we know the expected error from QC
}
if (cardStatus.cardState == CardState::ABSENT) {
// TODO(shuoq): Will add error check when we know the expected error from QC
}
}

View file

@ -20,304 +20,303 @@
* Test IRadio.getIccCardStatus() for the response returned.
*/
TEST_F(RadioHidlTest, getIccCardStatus) {
EXPECT_LE(cardStatus.applications.size(),
(unsigned int)RadioConst::CARD_MAX_APPS);
EXPECT_LT(cardStatus.gsmUmtsSubscriptionAppIndex,
(int)RadioConst::CARD_MAX_APPS);
EXPECT_LT(cardStatus.cdmaSubscriptionAppIndex,
(int)RadioConst::CARD_MAX_APPS);
EXPECT_LT(cardStatus.imsSubscriptionAppIndex, (int)RadioConst::CARD_MAX_APPS);
EXPECT_LE(cardStatus.applications.size(), (unsigned int)RadioConst::CARD_MAX_APPS);
EXPECT_LT(cardStatus.gsmUmtsSubscriptionAppIndex, (int)RadioConst::CARD_MAX_APPS);
EXPECT_LT(cardStatus.cdmaSubscriptionAppIndex, (int)RadioConst::CARD_MAX_APPS);
EXPECT_LT(cardStatus.imsSubscriptionAppIndex, (int)RadioConst::CARD_MAX_APPS);
}
/*
* Test IRadio.supplyIccPinForApp() for the response returned
*/
TEST_F(RadioHidlTest, supplyIccPinForApp) {
int serial = 1;
int serial = GetRandomSerialNumber();
// Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
// 3GPP2 apps only
for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
if (cardStatus.applications[i].appType == AppType::SIM ||
cardStatus.applications[i].appType == AppType::USIM ||
cardStatus.applications[i].appType == AppType::RUIM ||
cardStatus.applications[i].appType == AppType::CSIM) {
radio->supplyIccPinForApp(++serial, hidl_string("test1"),
cardStatus.applications[i].aidPtr);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error);
// Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
// 3GPP2 apps only
for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
if (cardStatus.applications[i].appType == AppType::SIM ||
cardStatus.applications[i].appType == AppType::USIM ||
cardStatus.applications[i].appType == AppType::RUIM ||
cardStatus.applications[i].appType == AppType::CSIM) {
radio->supplyIccPinForApp(serial, hidl_string("test1"),
cardStatus.applications[i].aidPtr);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error);
}
}
}
}
/*
* Test IRadio.supplyIccPukForApp() for the response returned.
*/
TEST_F(RadioHidlTest, supplyIccPukForApp) {
int serial = 1;
int serial = GetRandomSerialNumber();
// Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
// 3GPP2 apps only
for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
if (cardStatus.applications[i].appType == AppType::SIM ||
cardStatus.applications[i].appType == AppType::USIM ||
cardStatus.applications[i].appType == AppType::RUIM ||
cardStatus.applications[i].appType == AppType::CSIM) {
radio->supplyIccPukForApp(++serial, hidl_string("test1"),
hidl_string("test2"),
cardStatus.applications[i].aidPtr);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error);
// Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
// 3GPP2 apps only
for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
if (cardStatus.applications[i].appType == AppType::SIM ||
cardStatus.applications[i].appType == AppType::USIM ||
cardStatus.applications[i].appType == AppType::RUIM ||
cardStatus.applications[i].appType == AppType::CSIM) {
radio->supplyIccPukForApp(serial, hidl_string("test1"), hidl_string("test2"),
cardStatus.applications[i].aidPtr);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error);
}
}
}
}
/*
* Test IRadio.supplyIccPin2ForApp() for the response returned.
*/
TEST_F(RadioHidlTest, supplyIccPin2ForApp) {
int serial = 1;
int serial = GetRandomSerialNumber();
// Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
// 3GPP2 apps only
for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
if (cardStatus.applications[i].appType == AppType::SIM ||
cardStatus.applications[i].appType == AppType::USIM ||
cardStatus.applications[i].appType == AppType::RUIM ||
cardStatus.applications[i].appType == AppType::CSIM) {
radio->supplyIccPin2ForApp(++serial, hidl_string("test1"),
cardStatus.applications[i].aidPtr);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error);
// Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
// 3GPP2 apps only
for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
if (cardStatus.applications[i].appType == AppType::SIM ||
cardStatus.applications[i].appType == AppType::USIM ||
cardStatus.applications[i].appType == AppType::RUIM ||
cardStatus.applications[i].appType == AppType::CSIM) {
radio->supplyIccPin2ForApp(serial, hidl_string("test1"),
cardStatus.applications[i].aidPtr);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error);
}
}
}
}
/*
* Test IRadio.supplyIccPuk2ForApp() for the response returned.
*/
TEST_F(RadioHidlTest, supplyIccPuk2ForApp) {
int serial = 1;
int serial = GetRandomSerialNumber();
// Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
// 3GPP2 apps only
for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
if (cardStatus.applications[i].appType == AppType::SIM ||
cardStatus.applications[i].appType == AppType::USIM ||
cardStatus.applications[i].appType == AppType::RUIM ||
cardStatus.applications[i].appType == AppType::CSIM) {
radio->supplyIccPuk2ForApp(++serial, hidl_string("test1"),
hidl_string("test2"),
cardStatus.applications[i].aidPtr);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error);
// Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
// 3GPP2 apps only
for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
if (cardStatus.applications[i].appType == AppType::SIM ||
cardStatus.applications[i].appType == AppType::USIM ||
cardStatus.applications[i].appType == AppType::RUIM ||
cardStatus.applications[i].appType == AppType::CSIM) {
radio->supplyIccPuk2ForApp(serial, hidl_string("test1"), hidl_string("test2"),
cardStatus.applications[i].aidPtr);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error);
}
}
}
}
/*
* Test IRadio.changeIccPinForApp() for the response returned.
*/
TEST_F(RadioHidlTest, changeIccPinForApp) {
int serial = 1;
int serial = GetRandomSerialNumber();
// Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
// 3GPP2 apps only
for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
if (cardStatus.applications[i].appType == AppType::SIM ||
cardStatus.applications[i].appType == AppType::USIM ||
cardStatus.applications[i].appType == AppType::RUIM ||
cardStatus.applications[i].appType == AppType::CSIM) {
radio->changeIccPinForApp(++serial, hidl_string("test1"),
hidl_string("test2"),
cardStatus.applications[i].aidPtr);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error);
// Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
// 3GPP2 apps only
for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
if (cardStatus.applications[i].appType == AppType::SIM ||
cardStatus.applications[i].appType == AppType::USIM ||
cardStatus.applications[i].appType == AppType::RUIM ||
cardStatus.applications[i].appType == AppType::CSIM) {
radio->changeIccPinForApp(serial, hidl_string("test1"), hidl_string("test2"),
cardStatus.applications[i].aidPtr);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error);
}
}
}
}
/*
* Test IRadio.changeIccPin2ForApp() for the response returned.
*/
TEST_F(RadioHidlTest, changeIccPin2ForApp) {
int serial = 1;
int serial = GetRandomSerialNumber();
// Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
// 3GPP2 apps only
for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
if (cardStatus.applications[i].appType == AppType::SIM ||
cardStatus.applications[i].appType == AppType::USIM ||
cardStatus.applications[i].appType == AppType::RUIM ||
cardStatus.applications[i].appType == AppType::CSIM) {
radio->changeIccPin2ForApp(++serial, hidl_string("test1"),
hidl_string("test2"),
cardStatus.applications[i].aidPtr);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error);
// Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
// 3GPP2 apps only
for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
if (cardStatus.applications[i].appType == AppType::SIM ||
cardStatus.applications[i].appType == AppType::USIM ||
cardStatus.applications[i].appType == AppType::RUIM ||
cardStatus.applications[i].appType == AppType::CSIM) {
radio->changeIccPin2ForApp(serial, hidl_string("test1"), hidl_string("test2"),
cardStatus.applications[i].aidPtr);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error);
}
}
}
}
/*
* Test IRadio.getImsiForApp() for the response returned.
*/
TEST_F(RadioHidlTest, getImsiForApp) {
int serial = 1;
int serial = GetRandomSerialNumber();
// Check success returned while getting imsi for 3GPP and 3GPP2 apps only
for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
if (cardStatus.applications[i].appType == AppType::SIM ||
cardStatus.applications[i].appType == AppType::USIM ||
cardStatus.applications[i].appType == AppType::RUIM ||
cardStatus.applications[i].appType == AppType::CSIM) {
radio->getImsiForApp(++serial, cardStatus.applications[i].aidPtr);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
// Check success returned while getting imsi for 3GPP and 3GPP2 apps only
for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
if (cardStatus.applications[i].appType == AppType::SIM ||
cardStatus.applications[i].appType == AppType::USIM ||
cardStatus.applications[i].appType == AppType::RUIM ||
cardStatus.applications[i].appType == AppType::CSIM) {
radio->getImsiForApp(serial, cardStatus.applications[i].aidPtr);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
// IMSI (MCC+MNC+MSIN) is at least 6 digits, but not more than 15
if (radioRsp->rspInfo.error == RadioError::NONE) {
EXPECT_NE(radioRsp->imsi, hidl_string());
EXPECT_GE((int)(radioRsp->imsi).size(), 6);
EXPECT_LE((int)(radioRsp->imsi).size(), 15);
}
// IMSI (MCC+MNC+MSIN) is at least 6 digits, but not more than 15
if (radioRsp->rspInfo.error == RadioError::NONE) {
EXPECT_NE(radioRsp->imsi, hidl_string());
EXPECT_GE((int)(radioRsp->imsi).size(), 6);
EXPECT_LE((int)(radioRsp->imsi).size(), 15);
}
}
}
}
}
/*
* Test IRadio.iccIOForApp() for the response returned.
*/
TEST_F(RadioHidlTest, iccIOForApp) {
int serial = 1;
int serial = GetRandomSerialNumber();
for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
IccIo iccIo;
iccIo.command = 0xc0;
iccIo.fileId = 0x6f11;
iccIo.path = hidl_string("3F007FFF");
iccIo.p1 = 0;
iccIo.p2 = 0;
iccIo.p3 = 0;
iccIo.data = hidl_string();
iccIo.pin2 = hidl_string();
iccIo.aid = cardStatus.applications[i].aidPtr;
for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
IccIo iccIo;
iccIo.command = 0xc0;
iccIo.fileId = 0x6f11;
iccIo.path = hidl_string("3F007FFF");
iccIo.p1 = 0;
iccIo.p2 = 0;
iccIo.p3 = 0;
iccIo.data = hidl_string();
iccIo.pin2 = hidl_string();
iccIo.aid = cardStatus.applications[i].aidPtr;
radio->iccIOForApp(++serial, iccIo);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
}
radio->iccIOForApp(serial, iccIo);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
}
}
/*
* Test IRadio.iccTransmitApduBasicChannel() for the response returned.
*/
TEST_F(RadioHidlTest, iccTransmitApduBasicChannel) {
int serial = 1;
SimApdu msg;
memset(&msg, 0, sizeof(msg));
msg.data = hidl_string();
int serial = GetRandomSerialNumber();
SimApdu msg;
memset(&msg, 0, sizeof(msg));
msg.data = hidl_string();
radio->iccTransmitApduBasicChannel(serial, msg);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
radio->iccTransmitApduBasicChannel(serial, msg);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
// TODO(sanketpadawe): Add test for error code
// TODO(sanketpadawe): Add test for error code
}
/*
* Test IRadio.iccOpenLogicalChannel() for the response returned.
*/
TEST_F(RadioHidlTest, iccOpenLogicalChannel) {
int serial = 1;
int p2 = 0x04;
// Specified in ISO 7816-4 clause 7.1.1 0x04 means that FCP template is requested.
for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
radio->iccOpenLogicalChannel(++serial, cardStatus.applications[i].aidPtr, p2);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
}
int serial = GetRandomSerialNumber();
int p2 = 0x04;
// Specified in ISO 7816-4 clause 7.1.1 0x04 means that FCP template is requested.
for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
radio->iccOpenLogicalChannel(serial, cardStatus.applications[i].aidPtr, p2);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
}
}
/*
* Test IRadio.iccCloseLogicalChannel() for the response returned.
*/
TEST_F(RadioHidlTest, iccCloseLogicalChannel) {
int serial = 1;
// Try closing invalid channel and check INVALID_ARGUMENTS returned as error
radio->iccCloseLogicalChannel(serial, 0);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
int serial = GetRandomSerialNumber();
// Try closing invalid channel and check INVALID_ARGUMENTS returned as error
radio->iccCloseLogicalChannel(serial, 0);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(RadioError::INVALID_ARGUMENTS, radioRsp->rspInfo.error);
EXPECT_EQ(RadioError::INVALID_ARGUMENTS, radioRsp->rspInfo.error);
}
/*
* Test IRadio.iccTransmitApduLogicalChannel() for the response returned.
*/
TEST_F(RadioHidlTest, iccTransmitApduLogicalChannel) {
SimApdu msg;
memset(&msg, 0, sizeof(msg));
msg.data = hidl_string();
int serial = GetRandomSerialNumber();
SimApdu msg;
memset(&msg, 0, sizeof(msg));
msg.data = hidl_string();
radio->iccTransmitApduLogicalChannel(1, msg);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(1, radioRsp->rspInfo.serial);
radio->iccTransmitApduLogicalChannel(serial, msg);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
// TODO(sanketpadawe): Add test for error code
// TODO(sanketpadawe): Add test for error code
}
/*
* Test IRadio.requestIccSimAuthentication() for the response returned.
*/
TEST_F(RadioHidlTest, requestIccSimAuthentication) {
int serial = 1;
int serial = GetRandomSerialNumber();
// Pass wrong challenge string and check RadioError::INVALID_ARGUMENTS
// returned as error.
for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
radio->requestIccSimAuthentication(++serial, 0, hidl_string("test"),
cardStatus.applications[i].aidPtr);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(RadioError::INVALID_ARGUMENTS, radioRsp->rspInfo.error);
}
// Pass wrong challenge string and check RadioError::INVALID_ARGUMENTS
// returned as error.
for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
radio->requestIccSimAuthentication(serial, 0, hidl_string("test"),
cardStatus.applications[i].aidPtr);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(RadioError::INVALID_ARGUMENTS, radioRsp->rspInfo.error);
}
}
/*
* Test IRadio.supplyNetworkDepersonalization() for the response returned.
*/
TEST_F(RadioHidlTest, supplyNetworkDepersonalization) {
int serial = 1;
int serial = GetRandomSerialNumber();
radio->supplyNetworkDepersonalization(serial, hidl_string("test"));
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
radio->supplyNetworkDepersonalization(serial, hidl_string("test"));
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::PASSWORD_INCORRECT);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::SYSTEM_ERR ||
radioRsp->rspInfo.error == RadioError::NO_MEMORY ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_SIM_STATE ||
radioRsp->rspInfo.error == RadioError::PASSWORD_INCORRECT ||
radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
}
}

View file

@ -22,178 +22,174 @@ using namespace ::android::hardware::radio::V1_0;
* Test IRadio.getClir() for the response returned.
*/
TEST_F(RadioHidlTest, getClir) {
int serial = 0;
int serial = GetRandomSerialNumber();
radio->getClir(++serial);
radio->getClir(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() || radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
}
/*
* Test IRadio.setClir() for the response returned.
*/
TEST_F(RadioHidlTest, setClir) {
int serial = 0;
int32_t status = 1;
int serial = GetRandomSerialNumber();
int32_t status = 1;
radio->setClir(++serial, status);
radio->setClir(serial, status);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
}
if (cardStatus.cardState == CardState::ABSENT) {
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
}
}
/*
* Test IRadio.getFacilityLockForApp() for the response returned.
*/
TEST_F(RadioHidlTest, getFacilityLockForApp) {
int serial = 0;
std::string facility = "";
std::string password = "";
int32_t serviceClass = 1;
std::string appId = "";
int serial = GetRandomSerialNumber();
std::string facility = "";
std::string password = "";
int32_t serviceClass = 1;
std::string appId = "";
radio->getFacilityLockForApp(++serial, facility, password, serviceClass,
appId);
radio->getFacilityLockForApp(serial, facility, password, serviceClass, appId);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
}
/*
* Test IRadio.setFacilityLockForApp() for the response returned.
*/
TEST_F(RadioHidlTest, setFacilityLockForApp) {
int serial = 0;
std::string facility = "";
bool lockState = false;
std::string password = "";
int32_t serviceClass = 1;
std::string appId = "";
int serial = GetRandomSerialNumber();
std::string facility = "";
bool lockState = false;
std::string password = "";
int32_t serviceClass = 1;
std::string appId = "";
radio->setFacilityLockForApp(++serial, facility, lockState, password,
serviceClass, appId);
radio->setFacilityLockForApp(serial, facility, lockState, password, serviceClass, appId);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
}
/*
* Test IRadio.setBarringPassword() for the response returned.
*/
TEST_F(RadioHidlTest, setBarringPassword) {
int serial = 0;
std::string facility = "";
std::string oldPassword = "";
std::string newPassword = "";
int serial = GetRandomSerialNumber();
std::string facility = "";
std::string oldPassword = "";
std::string newPassword = "";
radio->setBarringPassword(++serial, facility, oldPassword, newPassword);
radio->setBarringPassword(serial, facility, oldPassword, newPassword);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
radioRsp->rspInfo.error == RadioError::FDN_CHECK_FAILURE);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
radioRsp->rspInfo.error == RadioError::FDN_CHECK_FAILURE);
}
}
/*
* Test IRadio.getClip() for the response returned.
*/
TEST_F(RadioHidlTest, getClip) {
int serial = 0;
int serial = GetRandomSerialNumber();
radio->getClip(++serial);
radio->getClip(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() || radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
}
/*
* Test IRadio.setSuppServiceNotifications() for the response returned.
*/
TEST_F(RadioHidlTest, setSuppServiceNotifications) {
int serial = 0;
bool enable = false;
int serial = GetRandomSerialNumber();
bool enable = false;
radio->setSuppServiceNotifications(++serial, enable);
radio->setSuppServiceNotifications(serial, enable);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
}
if (cardStatus.cardState == CardState::ABSENT) {
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
}
}
/*
* Test IRadio.requestIsimAuthentication() for the response returned.
*/
TEST_F(RadioHidlTest, requestIsimAuthentication) {
int serial = 0;
std::string challenge = "";
int serial = GetRandomSerialNumber();
std::string challenge = "";
radio->requestIsimAuthentication(++serial, challenge);
radio->requestIsimAuthentication(serial, challenge);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError());
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError());
}
}
/*
* Test IRadio.getImsRegistrationState() for the response returned.
*/
TEST_F(RadioHidlTest, getImsRegistrationState) {
int serial = 0;
int serial = GetRandomSerialNumber();
radio->getImsRegistrationState(++serial);
radio->getImsRegistrationState(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
}
if (cardStatus.cardState == CardState::ABSENT) {
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
}
}

File diff suppressed because it is too large Load diff

View file

@ -22,417 +22,412 @@ using namespace ::android::hardware::radio::V1_0;
* Test IRadio.sendSms() for the response returned.
*/
TEST_F(RadioHidlTest, sendSms) {
int serial = 0;
GsmSmsMessage msg;
msg.smscPdu = "";
msg.pdu = "01000b916105770203f3000006d4f29c3e9b01";
int serial = GetRandomSerialNumber();
GsmSmsMessage msg;
msg.smscPdu = "";
msg.pdu = "01000b916105770203f3000006d4f29c3e9b01";
radio->sendSms(++serial, msg);
radio->sendSms(serial, msg);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE);
EXPECT_EQ(0, radioRsp->sendSmsResult.errorCode);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE);
EXPECT_EQ(0, radioRsp->sendSmsResult.errorCode);
}
}
/*
* Test IRadio.sendSMSExpectMore() for the response returned.
*/
TEST_F(RadioHidlTest, sendSMSExpectMore) {
int serial = 0;
GsmSmsMessage msg;
msg.smscPdu = "";
msg.pdu = "01000b916105770203f3000006d4f29c3e9b01";
int serial = GetRandomSerialNumber();
GsmSmsMessage msg;
msg.smscPdu = "";
msg.pdu = "01000b916105770203f3000006d4f29c3e9b01";
radio->sendSMSExpectMore(++serial, msg);
radio->sendSMSExpectMore(serial, msg);
// TODO(shuoq): add more test for this API when inserted sim card is
// considered
// TODO(shuoq): add more test for this API when inserted sim card is
// considered
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE);
}
}
/*
* Test IRadio.acknowledgeLastIncomingGsmSms() for the response returned.
*/
TEST_F(RadioHidlTest, acknowledgeLastIncomingGsmSms) {
int serial = 0;
bool success = true;
int serial = GetRandomSerialNumber();
bool success = true;
radio->acknowledgeLastIncomingGsmSms(
++serial, success, SmsAcknowledgeFailCause::MEMORY_CAPACITY_EXCEEDED);
radio->acknowledgeLastIncomingGsmSms(serial, success,
SmsAcknowledgeFailCause::MEMORY_CAPACITY_EXCEEDED);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE);
}
}
/*
* Test IRadio.acknowledgeIncomingGsmSmsWithPdu() for the response returned.
*/
TEST_F(RadioHidlTest, acknowledgeIncomingGsmSmsWithPdu) {
int serial = 0;
bool success = true;
std::string ackPdu = "";
int serial = GetRandomSerialNumber();
bool success = true;
std::string ackPdu = "";
radio->acknowledgeIncomingGsmSmsWithPdu(++serial, success, ackPdu);
radio->acknowledgeIncomingGsmSmsWithPdu(serial, success, ackPdu);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
// TODO(shuoq): Will add error check when we know the expected error from QC
}
if (cardStatus.cardState == CardState::ABSENT) {
// TODO(shuoq): Will add error check when we know the expected error from QC
}
}
/*
* Test IRadio.sendCdmaSms() for the response returned.
*/
TEST_F(RadioHidlTest, sendCdmaSms) {
int serial = 0;
int serial = GetRandomSerialNumber();
// Create a CdmaSmsAddress
CdmaSmsAddress cdmaSmsAddress;
cdmaSmsAddress.digitMode = CdmaSmsDigitMode::FOUR_BIT;
cdmaSmsAddress.numberMode = CdmaSmsNumberMode::NOT_DATA_NETWORK;
cdmaSmsAddress.numberType = CdmaSmsNumberType::UNKNOWN;
cdmaSmsAddress.numberPlan = CdmaSmsNumberPlan::UNKNOWN;
cdmaSmsAddress.digits =
(std::vector<uint8_t>){11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
// Create a CdmaSmsAddress
CdmaSmsAddress cdmaSmsAddress;
cdmaSmsAddress.digitMode = CdmaSmsDigitMode::FOUR_BIT;
cdmaSmsAddress.numberMode = CdmaSmsNumberMode::NOT_DATA_NETWORK;
cdmaSmsAddress.numberType = CdmaSmsNumberType::UNKNOWN;
cdmaSmsAddress.numberPlan = CdmaSmsNumberPlan::UNKNOWN;
cdmaSmsAddress.digits = (std::vector<uint8_t>){11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
// Create a CdmaSmsSubAddress
CdmaSmsSubaddress cdmaSmsSubaddress;
cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddressType::NSAP;
cdmaSmsSubaddress.odd = false;
cdmaSmsSubaddress.digits = (std::vector<uint8_t>){};
// Create a CdmaSmsSubAddress
CdmaSmsSubaddress cdmaSmsSubaddress;
cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddressType::NSAP;
cdmaSmsSubaddress.odd = false;
cdmaSmsSubaddress.digits = (std::vector<uint8_t>){};
// Create a CdmaSmsMessage
android::hardware::radio::V1_0::CdmaSmsMessage cdmaSmsMessage;
cdmaSmsMessage.teleserviceId = 4098;
cdmaSmsMessage.isServicePresent = false;
cdmaSmsMessage.serviceCategory = 0;
cdmaSmsMessage.address = cdmaSmsAddress;
cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
cdmaSmsMessage.bearerData = (std::vector<uint8_t>){
15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
// Create a CdmaSmsMessage
android::hardware::radio::V1_0::CdmaSmsMessage cdmaSmsMessage;
cdmaSmsMessage.teleserviceId = 4098;
cdmaSmsMessage.isServicePresent = false;
cdmaSmsMessage.serviceCategory = 0;
cdmaSmsMessage.address = cdmaSmsAddress;
cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
cdmaSmsMessage.bearerData =
(std::vector<uint8_t>){15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
radio->sendCdmaSms(++serial, cdmaSmsMessage);
radio->sendCdmaSms(serial, cdmaSmsMessage);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE);
}
}
/*
* Test IRadio.acknowledgeLastIncomingCdmaSms() for the response returned.
*/
TEST_F(RadioHidlTest, acknowledgeLastIncomingCdmaSms) {
int serial = 0;
int serial = GetRandomSerialNumber();
// Create a CdmaSmsAck
CdmaSmsAck cdmaSmsAck;
cdmaSmsAck.errorClass = CdmaSmsErrorClass::NO_ERROR;
cdmaSmsAck.smsCauseCode = 1;
// Create a CdmaSmsAck
CdmaSmsAck cdmaSmsAck;
cdmaSmsAck.errorClass = CdmaSmsErrorClass::NO_ERROR;
cdmaSmsAck.smsCauseCode = 1;
radio->acknowledgeLastIncomingCdmaSms(++serial, cdmaSmsAck);
radio->acknowledgeLastIncomingCdmaSms(serial, cdmaSmsAck);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::NO_SMS_TO_ACK);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::NO_SMS_TO_ACK);
}
}
/*
* Test IRadio.sendImsSms() for the response returned.
*/
TEST_F(RadioHidlTest, sendImsSms) {
int serial = 1;
int serial = GetRandomSerialNumber();
// Create a CdmaSmsAddress
CdmaSmsAddress cdmaSmsAddress;
cdmaSmsAddress.digitMode = CdmaSmsDigitMode::FOUR_BIT;
cdmaSmsAddress.numberMode = CdmaSmsNumberMode::NOT_DATA_NETWORK;
cdmaSmsAddress.numberType = CdmaSmsNumberType::UNKNOWN;
cdmaSmsAddress.numberPlan = CdmaSmsNumberPlan::UNKNOWN;
cdmaSmsAddress.digits =
(std::vector<uint8_t>){11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
// Create a CdmaSmsAddress
CdmaSmsAddress cdmaSmsAddress;
cdmaSmsAddress.digitMode = CdmaSmsDigitMode::FOUR_BIT;
cdmaSmsAddress.numberMode = CdmaSmsNumberMode::NOT_DATA_NETWORK;
cdmaSmsAddress.numberType = CdmaSmsNumberType::UNKNOWN;
cdmaSmsAddress.numberPlan = CdmaSmsNumberPlan::UNKNOWN;
cdmaSmsAddress.digits = (std::vector<uint8_t>){11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
// Create a CdmaSmsSubAddress
CdmaSmsSubaddress cdmaSmsSubaddress;
cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddressType::NSAP;
cdmaSmsSubaddress.odd = false;
cdmaSmsSubaddress.digits = (std::vector<uint8_t>){};
// Create a CdmaSmsSubAddress
CdmaSmsSubaddress cdmaSmsSubaddress;
cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddressType::NSAP;
cdmaSmsSubaddress.odd = false;
cdmaSmsSubaddress.digits = (std::vector<uint8_t>){};
// Create a CdmaSmsMessage
CdmaSmsMessage cdmaSmsMessage;
cdmaSmsMessage.teleserviceId = 4098;
cdmaSmsMessage.isServicePresent = false;
cdmaSmsMessage.serviceCategory = 0;
cdmaSmsMessage.address = cdmaSmsAddress;
cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
cdmaSmsMessage.bearerData = (std::vector<uint8_t>){
15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
// Create a CdmaSmsMessage
CdmaSmsMessage cdmaSmsMessage;
cdmaSmsMessage.teleserviceId = 4098;
cdmaSmsMessage.isServicePresent = false;
cdmaSmsMessage.serviceCategory = 0;
cdmaSmsMessage.address = cdmaSmsAddress;
cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
cdmaSmsMessage.bearerData =
(std::vector<uint8_t>){15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
// Creata an ImsSmsMessage
ImsSmsMessage msg;
msg.tech = RadioTechnologyFamily::THREE_GPP2;
msg.retry = false;
msg.messageRef = 0;
msg.cdmaMessage = (std::vector<CdmaSmsMessage>){cdmaSmsMessage};
msg.gsmMessage = (std::vector<GsmSmsMessage>){};
// Creata an ImsSmsMessage
ImsSmsMessage msg;
msg.tech = RadioTechnologyFamily::THREE_GPP2;
msg.retry = false;
msg.messageRef = 0;
msg.cdmaMessage = (std::vector<CdmaSmsMessage>){cdmaSmsMessage};
msg.gsmMessage = (std::vector<GsmSmsMessage>){};
radio->sendImsSms(serial, msg);
radio->sendImsSms(serial, msg);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS);
}
}
/*
* Test IRadio.getSmscAddress() for the response returned.
*/
TEST_F(RadioHidlTest, getSmscAddress) {
int serial = 0;
int serial = GetRandomSerialNumber();
radio->getSmscAddress(++serial);
radio->getSmscAddress(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::INVALID_MODEM_STATE);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() || radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::INVALID_MODEM_STATE);
}
}
/*
* Test IRadio.setSmscAddress() for the response returned.
*/
TEST_F(RadioHidlTest, setSmscAddress) {
int serial = 0;
hidl_string address = hidl_string("smscAddress");
int serial = GetRandomSerialNumber();
hidl_string address = hidl_string("smscAddress");
radio->setSmscAddress(++serial, address);
radio->setSmscAddress(serial, address);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_SMS_FORMAT);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_SMS_FORMAT);
}
}
/*
* Test IRadio.writeSmsToSim() for the response returned.
*/
TEST_F(RadioHidlTest, writeSmsToSim) {
int serial = 0;
SmsWriteArgs smsWriteArgs;
smsWriteArgs.status = SmsWriteArgsStatus::REC_UNREAD;
smsWriteArgs.smsc = "";
smsWriteArgs.pdu = "01000b916105770203f3000006d4f29c3e9b01";
int serial = GetRandomSerialNumber();
SmsWriteArgs smsWriteArgs;
smsWriteArgs.status = SmsWriteArgsStatus::REC_UNREAD;
smsWriteArgs.smsc = "";
smsWriteArgs.pdu = "01000b916105770203f3000006d4f29c3e9b01";
radio->writeSmsToSim(++serial, smsWriteArgs);
radio->writeSmsToSim(serial, smsWriteArgs);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
radioRsp->rspInfo.error == RadioError::ENCODING_ERR ||
radioRsp->rspInfo.error == RadioError::NO_RESOURCES ||
radioRsp->rspInfo.error == RadioError::NETWORK_NOT_READY ||
radioRsp->rspInfo.error == RadioError::INVALID_SMSC_ADDRESS);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
radioRsp->rspInfo.error == RadioError::ENCODING_ERR ||
radioRsp->rspInfo.error == RadioError::NO_RESOURCES ||
radioRsp->rspInfo.error == RadioError::NETWORK_NOT_READY ||
radioRsp->rspInfo.error == RadioError::INVALID_SMSC_ADDRESS);
}
}
/*
* Test IRadio.deleteSmsOnSim() for the response returned.
*/
TEST_F(RadioHidlTest, deleteSmsOnSim) {
int serial = 0;
int index = 1;
int serial = GetRandomSerialNumber();
int index = 1;
radio->deleteSmsOnSim(++serial, index);
radio->deleteSmsOnSim(serial, index);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
radioRsp->rspInfo.error == RadioError::NO_SUCH_ENTRY);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
radioRsp->rspInfo.error == RadioError::NO_SUCH_ENTRY);
}
}
/*
* Test IRadio.writeSmsToRuim() for the response returned.
*/
TEST_F(RadioHidlTest, writeSmsToRuim) {
int serial = 0;
int serial = GetRandomSerialNumber();
// Create a CdmaSmsAddress
CdmaSmsAddress cdmaSmsAddress;
cdmaSmsAddress.digitMode = CdmaSmsDigitMode::FOUR_BIT;
cdmaSmsAddress.numberMode = CdmaSmsNumberMode::NOT_DATA_NETWORK;
cdmaSmsAddress.numberType = CdmaSmsNumberType::UNKNOWN;
cdmaSmsAddress.numberPlan = CdmaSmsNumberPlan::UNKNOWN;
cdmaSmsAddress.digits =
(std::vector<uint8_t>){11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
// Create a CdmaSmsAddress
CdmaSmsAddress cdmaSmsAddress;
cdmaSmsAddress.digitMode = CdmaSmsDigitMode::FOUR_BIT;
cdmaSmsAddress.numberMode = CdmaSmsNumberMode::NOT_DATA_NETWORK;
cdmaSmsAddress.numberType = CdmaSmsNumberType::UNKNOWN;
cdmaSmsAddress.numberPlan = CdmaSmsNumberPlan::UNKNOWN;
cdmaSmsAddress.digits = (std::vector<uint8_t>){11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
// Create a CdmaSmsSubAddress
CdmaSmsSubaddress cdmaSmsSubaddress;
cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddressType::NSAP;
cdmaSmsSubaddress.odd = false;
cdmaSmsSubaddress.digits = (std::vector<uint8_t>){};
// Create a CdmaSmsSubAddress
CdmaSmsSubaddress cdmaSmsSubaddress;
cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddressType::NSAP;
cdmaSmsSubaddress.odd = false;
cdmaSmsSubaddress.digits = (std::vector<uint8_t>){};
// Create a CdmaSmsMessage
CdmaSmsMessage cdmaSmsMessage;
cdmaSmsMessage.teleserviceId = 4098;
cdmaSmsMessage.isServicePresent = false;
cdmaSmsMessage.serviceCategory = 0;
cdmaSmsMessage.address = cdmaSmsAddress;
cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
cdmaSmsMessage.bearerData = (std::vector<uint8_t>){
15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
// Create a CdmaSmsMessage
CdmaSmsMessage cdmaSmsMessage;
cdmaSmsMessage.teleserviceId = 4098;
cdmaSmsMessage.isServicePresent = false;
cdmaSmsMessage.serviceCategory = 0;
cdmaSmsMessage.address = cdmaSmsAddress;
cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
cdmaSmsMessage.bearerData =
(std::vector<uint8_t>){15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
// Create a CdmaSmsWriteArgs
CdmaSmsWriteArgs cdmaSmsWriteArgs;
cdmaSmsWriteArgs.status = CdmaSmsWriteArgsStatus::REC_UNREAD;
cdmaSmsWriteArgs.message = cdmaSmsMessage;
// Create a CdmaSmsWriteArgs
CdmaSmsWriteArgs cdmaSmsWriteArgs;
cdmaSmsWriteArgs.status = CdmaSmsWriteArgsStatus::REC_UNREAD;
cdmaSmsWriteArgs.message = cdmaSmsMessage;
radio->writeSmsToRuim(++serial, cdmaSmsWriteArgs);
radio->writeSmsToRuim(serial, cdmaSmsWriteArgs);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::INVALID_SMS_FORMAT ||
radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
radioRsp->rspInfo.error == RadioError::NO_SUCH_ENTRY ||
radioRsp->rspInfo.error == RadioError::INVALID_SMSC_ADDRESS);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::INVALID_SMS_FORMAT ||
radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
radioRsp->rspInfo.error == RadioError::NO_SUCH_ENTRY ||
radioRsp->rspInfo.error == RadioError::INVALID_SMSC_ADDRESS);
}
}
/*
* Test IRadio.deleteSmsOnRuim() for the response returned.
*/
TEST_F(RadioHidlTest, deleteSmsOnRuim) {
int serial = 0;
int index = 1;
int serial = GetRandomSerialNumber();
int index = 1;
// Create a CdmaSmsAddress
CdmaSmsAddress cdmaSmsAddress;
cdmaSmsAddress.digitMode = CdmaSmsDigitMode::FOUR_BIT;
cdmaSmsAddress.numberMode = CdmaSmsNumberMode::NOT_DATA_NETWORK;
cdmaSmsAddress.numberType = CdmaSmsNumberType::UNKNOWN;
cdmaSmsAddress.numberPlan = CdmaSmsNumberPlan::UNKNOWN;
cdmaSmsAddress.digits =
(std::vector<uint8_t>){11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
// Create a CdmaSmsAddress
CdmaSmsAddress cdmaSmsAddress;
cdmaSmsAddress.digitMode = CdmaSmsDigitMode::FOUR_BIT;
cdmaSmsAddress.numberMode = CdmaSmsNumberMode::NOT_DATA_NETWORK;
cdmaSmsAddress.numberType = CdmaSmsNumberType::UNKNOWN;
cdmaSmsAddress.numberPlan = CdmaSmsNumberPlan::UNKNOWN;
cdmaSmsAddress.digits = (std::vector<uint8_t>){11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
// Create a CdmaSmsSubAddress
CdmaSmsSubaddress cdmaSmsSubaddress;
cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddressType::NSAP;
cdmaSmsSubaddress.odd = false;
cdmaSmsSubaddress.digits = (std::vector<uint8_t>){};
// Create a CdmaSmsSubAddress
CdmaSmsSubaddress cdmaSmsSubaddress;
cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddressType::NSAP;
cdmaSmsSubaddress.odd = false;
cdmaSmsSubaddress.digits = (std::vector<uint8_t>){};
// Create a CdmaSmsMessage
CdmaSmsMessage cdmaSmsMessage;
cdmaSmsMessage.teleserviceId = 4098;
cdmaSmsMessage.isServicePresent = false;
cdmaSmsMessage.serviceCategory = 0;
cdmaSmsMessage.address = cdmaSmsAddress;
cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
cdmaSmsMessage.bearerData = (std::vector<uint8_t>){
15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
// Create a CdmaSmsMessage
CdmaSmsMessage cdmaSmsMessage;
cdmaSmsMessage.teleserviceId = 4098;
cdmaSmsMessage.isServicePresent = false;
cdmaSmsMessage.serviceCategory = 0;
cdmaSmsMessage.address = cdmaSmsAddress;
cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
cdmaSmsMessage.bearerData =
(std::vector<uint8_t>){15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
// Create a CdmaSmsWriteArgs
CdmaSmsWriteArgs cdmaSmsWriteArgs;
cdmaSmsWriteArgs.status = CdmaSmsWriteArgsStatus::REC_UNREAD;
cdmaSmsWriteArgs.message = cdmaSmsMessage;
// Create a CdmaSmsWriteArgs
CdmaSmsWriteArgs cdmaSmsWriteArgs;
cdmaSmsWriteArgs.status = CdmaSmsWriteArgsStatus::REC_UNREAD;
cdmaSmsWriteArgs.message = cdmaSmsMessage;
radio->deleteSmsOnRuim(++serial, index);
radio->deleteSmsOnRuim(serial, index);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError());
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError());
}
}
/*
* Test IRadio.reportSmsMemoryStatus() for the response returned.
*/
TEST_F(RadioHidlTest, reportSmsMemoryStatus) {
int serial = 0;
bool available = true;
int serial = GetRandomSerialNumber();
bool available = true;
radio->reportSmsMemoryStatus(++serial, available);
radio->reportSmsMemoryStatus(serial, available);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
}

View file

@ -22,101 +22,109 @@ using namespace ::android::hardware::radio::V1_0;
* Test IRadio.sendEnvelope() for the response returned.
*/
TEST_F(RadioHidlTest, sendEnvelope) {
int serial = 0;
int serial = GetRandomSerialNumber();
// Test with sending empty string
std::string content = "";
// Test with sending empty string
std::string content = "";
radio->sendEnvelope(++serial, content);
radio->sendEnvelope(serial, content);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
}
if (cardStatus.cardState == CardState::ABSENT) {
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
}
// Test with sending random string
content = "0";
// Test with sending random string
serial = GetRandomSerialNumber();
content = "0";
radio->sendEnvelope(++serial, content);
radio->sendEnvelope(serial, content);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
}
if (cardStatus.cardState == CardState::ABSENT) {
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
}
}
/*
* Test IRadio.sendTerminalResponseToSim() for the response returned.
*/
TEST_F(RadioHidlTest, sendTerminalResponseToSim) {
int serial = 0;
int serial = GetRandomSerialNumber();
// Test with sending empty string
std::string commandResponse = "";
// Test with sending empty string
std::string commandResponse = "";
radio->sendTerminalResponseToSim(++serial, commandResponse);
radio->sendTerminalResponseToSim(serial, commandResponse);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
}
if (cardStatus.cardState == CardState::ABSENT) {
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
}
// Test with sending random string
commandResponse = "0";
serial = GetRandomSerialNumber();
radio->sendTerminalResponseToSim(++serial, commandResponse);
// Test with sending random string
commandResponse = "0";
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
radio->sendTerminalResponseToSim(serial, commandResponse);
if (cardStatus.cardState == CardState::ABSENT) {
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
}
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
}
}
/*
* Test IRadio.handleStkCallSetupRequestFromSim() for the response returned.
*/
TEST_F(RadioHidlTest, handleStkCallSetupRequestFromSim) {
int serial = 0;
bool accept = false;
int serial = GetRandomSerialNumber();
bool accept = false;
radio->handleStkCallSetupRequestFromSim(++serial, accept);
radio->handleStkCallSetupRequestFromSim(serial, accept);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::SYSTEM_ERR ||
radioRsp->rspInfo.error == RadioError::NO_MEMORY ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
}
}
/*
* Test IRadio.reportStkServiceIsRunning() for the response returned.
*/
TEST_F(RadioHidlTest, reportStkServiceIsRunning) {
int serial = 0;
int serial = GetRandomSerialNumber();
radio->reportStkServiceIsRunning(++serial);
radio->reportStkServiceIsRunning(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
}
if (cardStatus.cardState == CardState::ABSENT) {
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
}
}
/*
@ -124,31 +132,32 @@ TEST_F(RadioHidlTest, reportStkServiceIsRunning) {
* string.
*/
TEST_F(RadioHidlTest, sendEnvelopeWithStatus) {
int serial = 0;
int serial = GetRandomSerialNumber();
// Test with sending empty string
std::string contents = "";
// Test with sending empty string
std::string contents = "";
radio->sendEnvelopeWithStatus(++serial, contents);
radio->sendEnvelopeWithStatus(serial, contents);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
}
if (cardStatus.cardState == CardState::ABSENT) {
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
}
// Test with sending random string
contents = "0";
// Test with sending random string
serial = GetRandomSerialNumber();
contents = "0";
radio->sendEnvelopeWithStatus(++serial, contents);
radio->sendEnvelopeWithStatus(serial, contents);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_FALSE(RadioError::NONE == radioRsp->rspInfo.error);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_FALSE(RadioError::NONE == radioRsp->rspInfo.error);
}
}

View file

@ -17,46 +17,47 @@
#include <radio_hidl_hal_utils.h>
void RadioHidlTest::SetUp() {
radio = ::testing::VtsHalHidlTargetTestBase::getService<IRadio>(
hidl_string(RADIO_SERVICE_NAME));
ASSERT_NE(radio, nullptr);
radio =
::testing::VtsHalHidlTargetTestBase::getService<IRadio>(hidl_string(RADIO_SERVICE_NAME));
ASSERT_NE(radio, nullptr);
radioRsp = new RadioResponse(*this);
ASSERT_NE(radioRsp, nullptr);
radioRsp = new RadioResponse(*this);
ASSERT_NE(radioRsp, nullptr);
count = 0;
count = 0;
radioInd = NULL;
radio->setResponseFunctions(radioRsp, radioInd);
radioInd = NULL;
radio->setResponseFunctions(radioRsp, radioInd);
radio->getIccCardStatus(1);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(1, radioRsp->rspInfo.serial);
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
int serial = GetRandomSerialNumber();
radio->getIccCardStatus(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
}
void RadioHidlTest::TearDown() {}
void RadioHidlTest::notify() {
std::unique_lock<std::mutex> lock(mtx);
count++;
cv.notify_one();
std::unique_lock<std::mutex> lock(mtx);
count++;
cv.notify_one();
}
std::cv_status RadioHidlTest::wait() {
std::unique_lock<std::mutex> lock(mtx);
std::unique_lock<std::mutex> lock(mtx);
std::cv_status status = std::cv_status::no_timeout;
auto now = std::chrono::system_clock::now();
while (count == 0) {
status = cv.wait_until(lock, now + std::chrono::seconds(TIMEOUT_PERIOD));
if (status == std::cv_status::timeout) {
return status;
std::cv_status status = std::cv_status::no_timeout;
auto now = std::chrono::system_clock::now();
while (count == 0) {
status = cv.wait_until(lock, now + std::chrono::seconds(TIMEOUT_PERIOD));
if (status == std::cv_status::timeout) {
return status;
}
}
}
count--;
return status;
count--;
return status;
}
bool RadioHidlTest::CheckGeneralError() {

View file

@ -26,6 +26,8 @@
#include <android/hardware/radio/1.0/IRadioResponse.h>
#include <android/hardware/radio/1.0/types.h>
#include <vts_test_util.h>
using ::android::hardware::radio::V1_0::ActivityStatsInfo;
using ::android::hardware::radio::V1_0::AppType;
using ::android::hardware::radio::V1_0::CardStatus;
@ -88,432 +90,388 @@ extern CardStatus cardStatus;
/* Callback class for radio response */
class RadioResponse : public IRadioResponse {
private:
RadioHidlTest& parent;
private:
RadioHidlTest& parent;
public:
RadioResponseInfo rspInfo;
hidl_string imsi;
IccIoResult iccIoResult;
int channelId;
public:
RadioResponseInfo rspInfo;
hidl_string imsi;
IccIoResult iccIoResult;
int channelId;
// Sms
SendSmsResult sendSmsResult;
hidl_string smscAddress;
uint32_t writeSmsToSimIndex;
uint32_t writeSmsToRuimIndex;
// Sms
SendSmsResult sendSmsResult;
hidl_string smscAddress;
uint32_t writeSmsToSimIndex;
uint32_t writeSmsToRuimIndex;
RadioResponse(RadioHidlTest& parent);
RadioResponse(RadioHidlTest& parent);
virtual ~RadioResponse() = default;
virtual ~RadioResponse() = default;
Return<void> getIccCardStatusResponse(const RadioResponseInfo& info,
const CardStatus& cardStatus);
Return<void> getIccCardStatusResponse(const RadioResponseInfo& info,
const CardStatus& cardStatus);
Return<void> supplyIccPinForAppResponse(const RadioResponseInfo& info,
int32_t remainingRetries);
Return<void> supplyIccPinForAppResponse(const RadioResponseInfo& info,
int32_t remainingRetries);
Return<void> supplyIccPukForAppResponse(const RadioResponseInfo& info,
int32_t remainingRetries);
Return<void> supplyIccPukForAppResponse(const RadioResponseInfo& info,
int32_t remainingRetries);
Return<void> supplyIccPin2ForAppResponse(const RadioResponseInfo& info,
int32_t remainingRetries);
Return<void> supplyIccPin2ForAppResponse(const RadioResponseInfo& info,
int32_t remainingRetries);
Return<void> supplyIccPuk2ForAppResponse(const RadioResponseInfo& info,
int32_t remainingRetries);
Return<void> supplyIccPuk2ForAppResponse(const RadioResponseInfo& info,
int32_t remainingRetries);
Return<void> changeIccPinForAppResponse(const RadioResponseInfo& info,
int32_t remainingRetries);
Return<void> changeIccPinForAppResponse(const RadioResponseInfo& info,
int32_t remainingRetries);
Return<void> changeIccPin2ForAppResponse(const RadioResponseInfo& info,
int32_t remainingRetries);
Return<void> changeIccPin2ForAppResponse(const RadioResponseInfo& info,
int32_t remainingRetries);
Return<void> supplyNetworkDepersonalizationResponse(
const RadioResponseInfo& info, int32_t remainingRetries);
Return<void> supplyNetworkDepersonalizationResponse(const RadioResponseInfo& info,
int32_t remainingRetries);
Return<void> getCurrentCallsResponse(
const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<Call>& calls);
Return<void> getCurrentCallsResponse(const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<Call>& calls);
Return<void> dialResponse(const RadioResponseInfo& info);
Return<void> dialResponse(const RadioResponseInfo& info);
Return<void> getIMSIForAppResponse(
const RadioResponseInfo& info,
const ::android::hardware::hidl_string& imsi);
Return<void> getIMSIForAppResponse(const RadioResponseInfo& info,
const ::android::hardware::hidl_string& imsi);
Return<void> hangupConnectionResponse(const RadioResponseInfo& info);
Return<void> hangupConnectionResponse(const RadioResponseInfo& info);
Return<void> hangupWaitingOrBackgroundResponse(const RadioResponseInfo& info);
Return<void> hangupWaitingOrBackgroundResponse(const RadioResponseInfo& info);
Return<void> hangupForegroundResumeBackgroundResponse(
const RadioResponseInfo& info);
Return<void> hangupForegroundResumeBackgroundResponse(const RadioResponseInfo& info);
Return<void> switchWaitingOrHoldingAndActiveResponse(
const RadioResponseInfo& info);
Return<void> switchWaitingOrHoldingAndActiveResponse(const RadioResponseInfo& info);
Return<void> conferenceResponse(const RadioResponseInfo& info);
Return<void> conferenceResponse(const RadioResponseInfo& info);
Return<void> rejectCallResponse(const RadioResponseInfo& info);
Return<void> rejectCallResponse(const RadioResponseInfo& info);
Return<void> getLastCallFailCauseResponse(
const RadioResponseInfo& info,
const LastCallFailCauseInfo& failCauseInfo);
Return<void> getLastCallFailCauseResponse(const RadioResponseInfo& info,
const LastCallFailCauseInfo& failCauseInfo);
Return<void> getSignalStrengthResponse(const RadioResponseInfo& info,
const SignalStrength& sigStrength);
Return<void> getSignalStrengthResponse(const RadioResponseInfo& info,
const SignalStrength& sigStrength);
Return<void> getVoiceRegistrationStateResponse(
const RadioResponseInfo& info,
const VoiceRegStateResult& voiceRegResponse);
Return<void> getVoiceRegistrationStateResponse(const RadioResponseInfo& info,
const VoiceRegStateResult& voiceRegResponse);
Return<void> getDataRegistrationStateResponse(
const RadioResponseInfo& info, const DataRegStateResult& dataRegResponse);
Return<void> getDataRegistrationStateResponse(const RadioResponseInfo& info,
const DataRegStateResult& dataRegResponse);
Return<void> getOperatorResponse(
const RadioResponseInfo& info,
const ::android::hardware::hidl_string& longName,
const ::android::hardware::hidl_string& shortName,
const ::android::hardware::hidl_string& numeric);
Return<void> getOperatorResponse(const RadioResponseInfo& info,
const ::android::hardware::hidl_string& longName,
const ::android::hardware::hidl_string& shortName,
const ::android::hardware::hidl_string& numeric);
Return<void> setRadioPowerResponse(const RadioResponseInfo& info);
Return<void> setRadioPowerResponse(const RadioResponseInfo& info);
Return<void> sendDtmfResponse(const RadioResponseInfo& info);
Return<void> sendDtmfResponse(const RadioResponseInfo& info);
Return<void> sendSmsResponse(const RadioResponseInfo& info,
const SendSmsResult& sms);
Return<void> sendSmsResponse(const RadioResponseInfo& info, const SendSmsResult& sms);
Return<void> sendSMSExpectMoreResponse(const RadioResponseInfo& info,
const SendSmsResult& sms);
Return<void> sendSMSExpectMoreResponse(const RadioResponseInfo& info, const SendSmsResult& sms);
Return<void> setupDataCallResponse(const RadioResponseInfo& info,
const SetupDataCallResult& dcResponse);
Return<void> setupDataCallResponse(const RadioResponseInfo& info,
const SetupDataCallResult& dcResponse);
Return<void> iccIOForAppResponse(const RadioResponseInfo& info,
const IccIoResult& iccIo);
Return<void> iccIOForAppResponse(const RadioResponseInfo& info, const IccIoResult& iccIo);
Return<void> sendUssdResponse(const RadioResponseInfo& info);
Return<void> sendUssdResponse(const RadioResponseInfo& info);
Return<void> cancelPendingUssdResponse(const RadioResponseInfo& info);
Return<void> cancelPendingUssdResponse(const RadioResponseInfo& info);
Return<void> getClirResponse(const RadioResponseInfo& info, int32_t n,
int32_t m);
Return<void> getClirResponse(const RadioResponseInfo& info, int32_t n, int32_t m);
Return<void> setClirResponse(const RadioResponseInfo& info);
Return<void> setClirResponse(const RadioResponseInfo& info);
Return<void> getCallForwardStatusResponse(
const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<CallForwardInfo>& call_forwardInfos);
Return<void> getCallForwardStatusResponse(
const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<CallForwardInfo>& call_forwardInfos);
Return<void> setCallForwardResponse(const RadioResponseInfo& info);
Return<void> setCallForwardResponse(const RadioResponseInfo& info);
Return<void> getCallWaitingResponse(const RadioResponseInfo& info,
bool enable, int32_t serviceClass);
Return<void> getCallWaitingResponse(const RadioResponseInfo& info, bool enable,
int32_t serviceClass);
Return<void> setCallWaitingResponse(const RadioResponseInfo& info);
Return<void> setCallWaitingResponse(const RadioResponseInfo& info);
Return<void> acknowledgeLastIncomingGsmSmsResponse(
const RadioResponseInfo& info);
Return<void> acknowledgeLastIncomingGsmSmsResponse(const RadioResponseInfo& info);
Return<void> acceptCallResponse(const RadioResponseInfo& info);
Return<void> acceptCallResponse(const RadioResponseInfo& info);
Return<void> deactivateDataCallResponse(const RadioResponseInfo& info);
Return<void> deactivateDataCallResponse(const RadioResponseInfo& info);
Return<void> getFacilityLockForAppResponse(const RadioResponseInfo& info,
int32_t response);
Return<void> getFacilityLockForAppResponse(const RadioResponseInfo& info, int32_t response);
Return<void> setFacilityLockForAppResponse(const RadioResponseInfo& info,
int32_t retry);
Return<void> setFacilityLockForAppResponse(const RadioResponseInfo& info, int32_t retry);
Return<void> setBarringPasswordResponse(const RadioResponseInfo& info);
Return<void> setBarringPasswordResponse(const RadioResponseInfo& info);
Return<void> getNetworkSelectionModeResponse(const RadioResponseInfo& info,
bool manual);
Return<void> getNetworkSelectionModeResponse(const RadioResponseInfo& info, bool manual);
Return<void> setNetworkSelectionModeAutomaticResponse(
const RadioResponseInfo& info);
Return<void> setNetworkSelectionModeAutomaticResponse(const RadioResponseInfo& info);
Return<void> setNetworkSelectionModeManualResponse(
const RadioResponseInfo& info);
Return<void> setNetworkSelectionModeManualResponse(const RadioResponseInfo& info);
Return<void> getAvailableNetworksResponse(
const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<OperatorInfo>& networkInfos);
Return<void> getAvailableNetworksResponse(
const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<OperatorInfo>& networkInfos);
Return<void> startDtmfResponse(const RadioResponseInfo& info);
Return<void> startDtmfResponse(const RadioResponseInfo& info);
Return<void> stopDtmfResponse(const RadioResponseInfo& info);
Return<void> stopDtmfResponse(const RadioResponseInfo& info);
Return<void> getBasebandVersionResponse(
const RadioResponseInfo& info,
const ::android::hardware::hidl_string& version);
Return<void> getBasebandVersionResponse(const RadioResponseInfo& info,
const ::android::hardware::hidl_string& version);
Return<void> separateConnectionResponse(const RadioResponseInfo& info);
Return<void> separateConnectionResponse(const RadioResponseInfo& info);
Return<void> setMuteResponse(const RadioResponseInfo& info);
Return<void> setMuteResponse(const RadioResponseInfo& info);
Return<void> getMuteResponse(const RadioResponseInfo& info, bool enable);
Return<void> getMuteResponse(const RadioResponseInfo& info, bool enable);
Return<void> getClipResponse(const RadioResponseInfo& info,
ClipStatus status);
Return<void> getClipResponse(const RadioResponseInfo& info, ClipStatus status);
Return<void> getDataCallListResponse(
const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<SetupDataCallResult>& dcResponse);
Return<void> getDataCallListResponse(
const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<SetupDataCallResult>& dcResponse);
Return<void> sendOemRilRequestRawResponse(
const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<uint8_t>& data);
Return<void> sendOemRilRequestRawResponse(const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<uint8_t>& data);
Return<void> sendOemRilRequestStringsResponse(
const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<::android::hardware::hidl_string>&
data);
Return<void> sendOemRilRequestStringsResponse(
const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& data);
Return<void> setSuppServiceNotificationsResponse(
const RadioResponseInfo& info);
Return<void> setSuppServiceNotificationsResponse(const RadioResponseInfo& info);
Return<void> writeSmsToSimResponse(const RadioResponseInfo& info,
int32_t index);
Return<void> writeSmsToSimResponse(const RadioResponseInfo& info, int32_t index);
Return<void> deleteSmsOnSimResponse(const RadioResponseInfo& info);
Return<void> deleteSmsOnSimResponse(const RadioResponseInfo& info);
Return<void> setBandModeResponse(const RadioResponseInfo& info);
Return<void> setBandModeResponse(const RadioResponseInfo& info);
Return<void> getAvailableBandModesResponse(
const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<RadioBandMode>& bandModes);
Return<void> getAvailableBandModesResponse(
const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<RadioBandMode>& bandModes);
Return<void> sendEnvelopeResponse(
const RadioResponseInfo& info,
const ::android::hardware::hidl_string& commandResponse);
Return<void> sendEnvelopeResponse(const RadioResponseInfo& info,
const ::android::hardware::hidl_string& commandResponse);
Return<void> sendTerminalResponseToSimResponse(const RadioResponseInfo& info);
Return<void> sendTerminalResponseToSimResponse(const RadioResponseInfo& info);
Return<void> handleStkCallSetupRequestFromSimResponse(
const RadioResponseInfo& info);
Return<void> handleStkCallSetupRequestFromSimResponse(const RadioResponseInfo& info);
Return<void> explicitCallTransferResponse(const RadioResponseInfo& info);
Return<void> explicitCallTransferResponse(const RadioResponseInfo& info);
Return<void> setPreferredNetworkTypeResponse(const RadioResponseInfo& info);
Return<void> setPreferredNetworkTypeResponse(const RadioResponseInfo& info);
Return<void> getPreferredNetworkTypeResponse(const RadioResponseInfo& info,
PreferredNetworkType nwType);
Return<void> getPreferredNetworkTypeResponse(const RadioResponseInfo& info,
PreferredNetworkType nwType);
Return<void> getNeighboringCidsResponse(
const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<NeighboringCell>& cells);
Return<void> getNeighboringCidsResponse(
const RadioResponseInfo& info, const ::android::hardware::hidl_vec<NeighboringCell>& cells);
Return<void> setLocationUpdatesResponse(const RadioResponseInfo& info);
Return<void> setLocationUpdatesResponse(const RadioResponseInfo& info);
Return<void> setCdmaSubscriptionSourceResponse(const RadioResponseInfo& info);
Return<void> setCdmaSubscriptionSourceResponse(const RadioResponseInfo& info);
Return<void> setCdmaRoamingPreferenceResponse(const RadioResponseInfo& info);
Return<void> setCdmaRoamingPreferenceResponse(const RadioResponseInfo& info);
Return<void> getCdmaRoamingPreferenceResponse(const RadioResponseInfo& info,
CdmaRoamingType type);
Return<void> getCdmaRoamingPreferenceResponse(const RadioResponseInfo& info,
CdmaRoamingType type);
Return<void> setTTYModeResponse(const RadioResponseInfo& info);
Return<void> setTTYModeResponse(const RadioResponseInfo& info);
Return<void> getTTYModeResponse(const RadioResponseInfo& info, TtyMode mode);
Return<void> getTTYModeResponse(const RadioResponseInfo& info, TtyMode mode);
Return<void> setPreferredVoicePrivacyResponse(const RadioResponseInfo& info);
Return<void> setPreferredVoicePrivacyResponse(const RadioResponseInfo& info);
Return<void> getPreferredVoicePrivacyResponse(const RadioResponseInfo& info,
bool enable);
Return<void> getPreferredVoicePrivacyResponse(const RadioResponseInfo& info, bool enable);
Return<void> sendCDMAFeatureCodeResponse(const RadioResponseInfo& info);
Return<void> sendCDMAFeatureCodeResponse(const RadioResponseInfo& info);
Return<void> sendBurstDtmfResponse(const RadioResponseInfo& info);
Return<void> sendBurstDtmfResponse(const RadioResponseInfo& info);
Return<void> sendCdmaSmsResponse(const RadioResponseInfo& info,
const SendSmsResult& sms);
Return<void> sendCdmaSmsResponse(const RadioResponseInfo& info, const SendSmsResult& sms);
Return<void> acknowledgeLastIncomingCdmaSmsResponse(
const RadioResponseInfo& info);
Return<void> acknowledgeLastIncomingCdmaSmsResponse(const RadioResponseInfo& info);
Return<void> getGsmBroadcastConfigResponse(
const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<GsmBroadcastSmsConfigInfo>& configs);
Return<void> getGsmBroadcastConfigResponse(
const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<GsmBroadcastSmsConfigInfo>& configs);
Return<void> setGsmBroadcastConfigResponse(const RadioResponseInfo& info);
Return<void> setGsmBroadcastConfigResponse(const RadioResponseInfo& info);
Return<void> setGsmBroadcastActivationResponse(const RadioResponseInfo& info);
Return<void> setGsmBroadcastActivationResponse(const RadioResponseInfo& info);
Return<void> getCdmaBroadcastConfigResponse(
const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<CdmaBroadcastSmsConfigInfo>& configs);
Return<void> getCdmaBroadcastConfigResponse(
const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<CdmaBroadcastSmsConfigInfo>& configs);
Return<void> setCdmaBroadcastConfigResponse(const RadioResponseInfo& info);
Return<void> setCdmaBroadcastConfigResponse(const RadioResponseInfo& info);
Return<void> setCdmaBroadcastActivationResponse(
const RadioResponseInfo& info);
Return<void> setCdmaBroadcastActivationResponse(const RadioResponseInfo& info);
Return<void> getCDMASubscriptionResponse(
const RadioResponseInfo& info,
const ::android::hardware::hidl_string& mdn,
const ::android::hardware::hidl_string& hSid,
const ::android::hardware::hidl_string& hNid,
const ::android::hardware::hidl_string& min,
const ::android::hardware::hidl_string& prl);
Return<void> getCDMASubscriptionResponse(const RadioResponseInfo& info,
const ::android::hardware::hidl_string& mdn,
const ::android::hardware::hidl_string& hSid,
const ::android::hardware::hidl_string& hNid,
const ::android::hardware::hidl_string& min,
const ::android::hardware::hidl_string& prl);
Return<void> writeSmsToRuimResponse(const RadioResponseInfo& info,
uint32_t index);
Return<void> writeSmsToRuimResponse(const RadioResponseInfo& info, uint32_t index);
Return<void> deleteSmsOnRuimResponse(const RadioResponseInfo& info);
Return<void> deleteSmsOnRuimResponse(const RadioResponseInfo& info);
Return<void> getDeviceIdentityResponse(
const RadioResponseInfo& info,
const ::android::hardware::hidl_string& imei,
const ::android::hardware::hidl_string& imeisv,
const ::android::hardware::hidl_string& esn,
const ::android::hardware::hidl_string& meid);
Return<void> getDeviceIdentityResponse(const RadioResponseInfo& info,
const ::android::hardware::hidl_string& imei,
const ::android::hardware::hidl_string& imeisv,
const ::android::hardware::hidl_string& esn,
const ::android::hardware::hidl_string& meid);
Return<void> exitEmergencyCallbackModeResponse(const RadioResponseInfo& info);
Return<void> exitEmergencyCallbackModeResponse(const RadioResponseInfo& info);
Return<void> getSmscAddressResponse(
const RadioResponseInfo& info,
const ::android::hardware::hidl_string& smsc);
Return<void> getSmscAddressResponse(const RadioResponseInfo& info,
const ::android::hardware::hidl_string& smsc);
Return<void> setSmscAddressResponse(const RadioResponseInfo& info);
Return<void> setSmscAddressResponse(const RadioResponseInfo& info);
Return<void> reportSmsMemoryStatusResponse(const RadioResponseInfo& info);
Return<void> reportSmsMemoryStatusResponse(const RadioResponseInfo& info);
Return<void> reportStkServiceIsRunningResponse(const RadioResponseInfo& info);
Return<void> reportStkServiceIsRunningResponse(const RadioResponseInfo& info);
Return<void> getCdmaSubscriptionSourceResponse(const RadioResponseInfo& info,
CdmaSubscriptionSource source);
Return<void> getCdmaSubscriptionSourceResponse(const RadioResponseInfo& info,
CdmaSubscriptionSource source);
Return<void> requestIsimAuthenticationResponse(
const RadioResponseInfo& info,
const ::android::hardware::hidl_string& response);
Return<void> requestIsimAuthenticationResponse(
const RadioResponseInfo& info, const ::android::hardware::hidl_string& response);
Return<void> acknowledgeIncomingGsmSmsWithPduResponse(
const RadioResponseInfo& info);
Return<void> acknowledgeIncomingGsmSmsWithPduResponse(const RadioResponseInfo& info);
Return<void> sendEnvelopeWithStatusResponse(const RadioResponseInfo& info,
const IccIoResult& iccIo);
Return<void> sendEnvelopeWithStatusResponse(const RadioResponseInfo& info,
const IccIoResult& iccIo);
Return<void> getVoiceRadioTechnologyResponse(const RadioResponseInfo& info,
RadioTechnology rat);
Return<void> getVoiceRadioTechnologyResponse(const RadioResponseInfo& info,
RadioTechnology rat);
Return<void> getCellInfoListResponse(
const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<CellInfo>& cellInfo);
Return<void> getCellInfoListResponse(const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<CellInfo>& cellInfo);
Return<void> setCellInfoListRateResponse(const RadioResponseInfo& info);
Return<void> setCellInfoListRateResponse(const RadioResponseInfo& info);
Return<void> setInitialAttachApnResponse(const RadioResponseInfo& info);
Return<void> setInitialAttachApnResponse(const RadioResponseInfo& info);
Return<void> getImsRegistrationStateResponse(const RadioResponseInfo& info,
bool isRegistered,
RadioTechnologyFamily ratFamily);
Return<void> getImsRegistrationStateResponse(const RadioResponseInfo& info, bool isRegistered,
RadioTechnologyFamily ratFamily);
Return<void> sendImsSmsResponse(const RadioResponseInfo& info,
const SendSmsResult& sms);
Return<void> sendImsSmsResponse(const RadioResponseInfo& info, const SendSmsResult& sms);
Return<void> iccTransmitApduBasicChannelResponse(
const RadioResponseInfo& info, const IccIoResult& result);
Return<void> iccTransmitApduBasicChannelResponse(const RadioResponseInfo& info,
const IccIoResult& result);
Return<void> iccOpenLogicalChannelResponse(
const RadioResponseInfo& info, int32_t channelId,
const ::android::hardware::hidl_vec<int8_t>& selectResponse);
Return<void> iccOpenLogicalChannelResponse(
const RadioResponseInfo& info, int32_t channelId,
const ::android::hardware::hidl_vec<int8_t>& selectResponse);
Return<void> iccCloseLogicalChannelResponse(const RadioResponseInfo& info);
Return<void> iccCloseLogicalChannelResponse(const RadioResponseInfo& info);
Return<void> iccTransmitApduLogicalChannelResponse(
const RadioResponseInfo& info, const IccIoResult& result);
Return<void> iccTransmitApduLogicalChannelResponse(const RadioResponseInfo& info,
const IccIoResult& result);
Return<void> nvReadItemResponse(
const RadioResponseInfo& info,
const ::android::hardware::hidl_string& result);
Return<void> nvReadItemResponse(const RadioResponseInfo& info,
const ::android::hardware::hidl_string& result);
Return<void> nvWriteItemResponse(const RadioResponseInfo& info);
Return<void> nvWriteItemResponse(const RadioResponseInfo& info);
Return<void> nvWriteCdmaPrlResponse(const RadioResponseInfo& info);
Return<void> nvWriteCdmaPrlResponse(const RadioResponseInfo& info);
Return<void> nvResetConfigResponse(const RadioResponseInfo& info);
Return<void> nvResetConfigResponse(const RadioResponseInfo& info);
Return<void> setUiccSubscriptionResponse(const RadioResponseInfo& info);
Return<void> setUiccSubscriptionResponse(const RadioResponseInfo& info);
Return<void> setDataAllowedResponse(const RadioResponseInfo& info);
Return<void> setDataAllowedResponse(const RadioResponseInfo& info);
Return<void> getHardwareConfigResponse(
const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<HardwareConfig>& config);
Return<void> getHardwareConfigResponse(
const RadioResponseInfo& info, const ::android::hardware::hidl_vec<HardwareConfig>& config);
Return<void> requestIccSimAuthenticationResponse(
const RadioResponseInfo& info, const IccIoResult& result);
Return<void> requestIccSimAuthenticationResponse(const RadioResponseInfo& info,
const IccIoResult& result);
Return<void> setDataProfileResponse(const RadioResponseInfo& info);
Return<void> setDataProfileResponse(const RadioResponseInfo& info);
Return<void> requestShutdownResponse(const RadioResponseInfo& info);
Return<void> requestShutdownResponse(const RadioResponseInfo& info);
Return<void> getRadioCapabilityResponse(const RadioResponseInfo& info,
const RadioCapability& rc);
Return<void> getRadioCapabilityResponse(const RadioResponseInfo& info,
const RadioCapability& rc);
Return<void> setRadioCapabilityResponse(const RadioResponseInfo& info,
const RadioCapability& rc);
Return<void> setRadioCapabilityResponse(const RadioResponseInfo& info,
const RadioCapability& rc);
Return<void> startLceServiceResponse(const RadioResponseInfo& info,
const LceStatusInfo& statusInfo);
Return<void> startLceServiceResponse(const RadioResponseInfo& info,
const LceStatusInfo& statusInfo);
Return<void> stopLceServiceResponse(const RadioResponseInfo& info,
const LceStatusInfo& statusInfo);
Return<void> stopLceServiceResponse(const RadioResponseInfo& info,
const LceStatusInfo& statusInfo);
Return<void> pullLceDataResponse(const RadioResponseInfo& info,
const LceDataInfo& lceInfo);
Return<void> pullLceDataResponse(const RadioResponseInfo& info, const LceDataInfo& lceInfo);
Return<void> getModemActivityInfoResponse(
const RadioResponseInfo& info, const ActivityStatsInfo& activityInfo);
Return<void> getModemActivityInfoResponse(const RadioResponseInfo& info,
const ActivityStatsInfo& activityInfo);
Return<void> setAllowedCarriersResponse(const RadioResponseInfo& info,
int32_t numAllowed);
Return<void> setAllowedCarriersResponse(const RadioResponseInfo& info, int32_t numAllowed);
Return<void> getAllowedCarriersResponse(const RadioResponseInfo& info,
bool allAllowed,
const CarrierRestrictions& carriers);
Return<void> getAllowedCarriersResponse(const RadioResponseInfo& info, bool allAllowed,
const CarrierRestrictions& carriers);
Return<void> sendDeviceStateResponse(const RadioResponseInfo& info);
Return<void> sendDeviceStateResponse(const RadioResponseInfo& info);
Return<void> setIndicationFilterResponse(const RadioResponseInfo& info);
Return<void> setIndicationFilterResponse(const RadioResponseInfo& info);
Return<void> setSimCardPowerResponse(const RadioResponseInfo& info);
Return<void> setSimCardPowerResponse(const RadioResponseInfo& info);
Return<void> acknowledgeRequest(int32_t serial);
Return<void> acknowledgeRequest(int32_t serial);
};
// The main test class for Radio HIDL.
class RadioHidlTest : public ::testing::VtsHalHidlTargetTestBase {
private:
std::mutex mtx;
std::condition_variable cv;
int count;
private:
std::mutex mtx;
std::condition_variable cv;
int count;
public:
virtual void SetUp() override;
public:
virtual void SetUp() override;
virtual void TearDown() override;
virtual void TearDown() override;
/* Used as a mechanism to inform the test about data/event callback */
void notify();
/* Used as a mechanism to inform the test about data/event callback */
void notify();
/* Test code calls this function to wait for response */
std::cv_status wait();
/* Test code calls this function to wait for response */
std::cv_status wait();
/* Used for checking General Errors */
bool CheckGeneralError();
/* Used for checking General Errors */
bool CheckGeneralError();
/* Used for checking OEM Errors */
bool CheckOEMError();
/* Used for checking OEM Errors */
bool CheckOEMError();
sp<IRadio> radio;
sp<RadioResponse> radioRsp;
sp<IRadioIndication> radioInd;
sp<IRadio> radio;
sp<RadioResponse> radioRsp;
sp<IRadioIndication> radioInd;
};
// A class for test environment setup
class RadioHidlEnvironment : public ::testing::Environment {
public:
virtual void SetUp() {}
virtual void TearDown() {}
public:
virtual void SetUp() {}
virtual void TearDown() {}
};

View file

@ -20,477 +20,467 @@
* Test IRadio.getCurrentCalls() for the response returned.
*/
TEST_F(RadioHidlTest, getCurrentCalls) {
int serial = 1;
int serial = GetRandomSerialNumber();
radio->getCurrentCalls(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
radio->getCurrentCalls(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
}
}
/*
* Test IRadio.dial() for the response returned.
*/
TEST_F(RadioHidlTest, dial) {
int serial = 1;
int serial = GetRandomSerialNumber();
Dial dialInfo;
memset(&dialInfo, 0, sizeof(dialInfo));
dialInfo.address = hidl_string("123456789");
Dial dialInfo;
memset(&dialInfo, 0, sizeof(dialInfo));
dialInfo.address = hidl_string("123456789");
radio->dial(serial, dialInfo);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
radio->dial(serial, dialInfo);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
radioRsp->rspInfo.error == RadioError::FDN_CHECK_FAILURE ||
radioRsp->rspInfo.error == RadioError::NO_SUBSCRIPTION ||
radioRsp->rspInfo.error == RadioError::NO_NETWORK_FOUND ||
radioRsp->rspInfo.error == RadioError::INVALID_CALL_ID ||
radioRsp->rspInfo.error == RadioError::DEVICE_IN_USE ||
radioRsp->rspInfo.error == RadioError::MODE_NOT_SUPPORTED ||
radioRsp->rspInfo.error == RadioError::INVALID_MODEM_STATE ||
radioRsp->rspInfo.error == RadioError::CANCELLED);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
radioRsp->rspInfo.error == RadioError::FDN_CHECK_FAILURE ||
radioRsp->rspInfo.error == RadioError::NO_SUBSCRIPTION ||
radioRsp->rspInfo.error == RadioError::NO_NETWORK_FOUND ||
radioRsp->rspInfo.error == RadioError::INVALID_CALL_ID ||
radioRsp->rspInfo.error == RadioError::DEVICE_IN_USE ||
radioRsp->rspInfo.error == RadioError::MODE_NOT_SUPPORTED ||
radioRsp->rspInfo.error == RadioError::INVALID_MODEM_STATE ||
radioRsp->rspInfo.error == RadioError::CANCELLED);
}
}
/*
* Test IRadio.hangup() for the response returned.
*/
TEST_F(RadioHidlTest, hangup) {
int serial = 1;
int serial = GetRandomSerialNumber();
radio->hangup(serial, 1);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
radio->hangup(serial, 1);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
}
/*
* Test IRadio.hangupWaitingOrBackground() for the response returned.
*/
TEST_F(RadioHidlTest, hangupWaitingOrBackground) {
int serial = 1;
int serial = GetRandomSerialNumber();
radio->hangupWaitingOrBackground(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
radio->hangupWaitingOrBackground(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() || radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
}
/*
* Test IRadio.hangupForegroundResumeBackground() for the response returned.
*/
TEST_F(RadioHidlTest, hangupForegroundResumeBackground) {
int serial = 1;
int serial = GetRandomSerialNumber();
radio->hangupForegroundResumeBackground(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
radio->hangupForegroundResumeBackground(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() || radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
}
/*
* Test IRadio.switchWaitingOrHoldingAndActive() for the response returned.
*/
TEST_F(RadioHidlTest, switchWaitingOrHoldingAndActive) {
int serial = 1;
int serial = GetRandomSerialNumber();
radio->switchWaitingOrHoldingAndActive(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
radio->switchWaitingOrHoldingAndActive(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() || radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
}
/*
* Test IRadio.conference() for the response returned.
*/
TEST_F(RadioHidlTest, conference) {
int serial = 1;
int serial = GetRandomSerialNumber();
radio->conference(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
radio->conference(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() || radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
}
/*
* Test IRadio.rejectCall() for the response returned.
*/
TEST_F(RadioHidlTest, rejectCall) {
int serial = 1;
int serial = GetRandomSerialNumber();
radio->rejectCall(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
radio->rejectCall(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() || radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
}
/*
* Test IRadio.getLastCallFailCause() for the response returned.
*/
TEST_F(RadioHidlTest, getLastCallFailCause) {
int serial = 1;
int serial = GetRandomSerialNumber();
radio->getLastCallFailCause(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
radio->getLastCallFailCause(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::NONE);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() || radioRsp->rspInfo.error == RadioError::NONE);
}
}
/*
* Test IRadio.sendUssd() for the response returned.
*/
TEST_F(RadioHidlTest, sendUssd) {
int serial = 1;
radio->sendUssd(serial, hidl_string("test"));
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
int serial = GetRandomSerialNumber();
radio->sendUssd(serial, hidl_string("test"));
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
}
/*
* Test IRadio.cancelPendingUssd() for the response returned.
*/
TEST_F(RadioHidlTest, cancelPendingUssd) {
int serial = 1;
int serial = GetRandomSerialNumber();
radio->cancelPendingUssd(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
radio->cancelPendingUssd(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() || radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
}
/*
* Test IRadio.getCallForwardStatus() for the response returned.
*/
TEST_F(RadioHidlTest, getCallForwardStatus) {
int serial = 1;
CallForwardInfo callInfo;
memset(&callInfo, 0, sizeof(callInfo));
callInfo.number = hidl_string();
int serial = GetRandomSerialNumber();
CallForwardInfo callInfo;
memset(&callInfo, 0, sizeof(callInfo));
callInfo.number = hidl_string();
radio->getCallForwardStatus(serial, callInfo);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
radio->getCallForwardStatus(serial, callInfo);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
}
/*
* Test IRadio.setCallForward() for the response returned.
*/
TEST_F(RadioHidlTest, setCallForward) {
int serial = 1;
CallForwardInfo callInfo;
memset(&callInfo, 0, sizeof(callInfo));
callInfo.number = hidl_string();
int serial = GetRandomSerialNumber();
CallForwardInfo callInfo;
memset(&callInfo, 0, sizeof(callInfo));
callInfo.number = hidl_string();
radio->setCallForward(serial, callInfo);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
radio->setCallForward(serial, callInfo);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
}
/*
* Test IRadio.getCallWaiting() for the response returned.
*/
TEST_F(RadioHidlTest, getCallWaiting) {
int serial = 1;
int serial = GetRandomSerialNumber();
radio->getCallWaiting(serial, 1);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
radio->getCallWaiting(serial, 1);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
}
/*
* Test IRadio.setCallWaiting() for the response returned.
*/
TEST_F(RadioHidlTest, setCallWaiting) {
int serial = 1;
int serial = GetRandomSerialNumber();
radio->setCallWaiting(serial, true, 1);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
radio->setCallWaiting(serial, true, 1);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
}
/*
* Test IRadio.acceptCall() for the response returned.
*/
TEST_F(RadioHidlTest, acceptCall) {
int serial = 1;
int serial = GetRandomSerialNumber();
radio->acceptCall(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
radio->acceptCall(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() || radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
}
/*
* Test IRadio.separateConnection() for the response returned.
*/
TEST_F(RadioHidlTest, separateConnection) {
int serial = 1;
int serial = GetRandomSerialNumber();
radio->separateConnection(serial, 1);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
radio->separateConnection(serial, 1);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
}
/*
* Test IRadio.explicitCallTransfer() for the response returned.
*/
TEST_F(RadioHidlTest, explicitCallTransfer) {
int serial = 1;
int serial = GetRandomSerialNumber();
radio->explicitCallTransfer(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
radio->explicitCallTransfer(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() || radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
}
/*
* Test IRadio.sendCDMAFeatureCode() for the response returned.
*/
TEST_F(RadioHidlTest, sendCDMAFeatureCode) {
int serial = 1;
int serial = GetRandomSerialNumber();
radio->sendCDMAFeatureCode(serial, hidl_string());
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
radio->sendCDMAFeatureCode(serial, hidl_string());
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::INVALID_CALL_ID ||
radioRsp->rspInfo.error == RadioError::INVALID_MODEM_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::INVALID_CALL_ID ||
radioRsp->rspInfo.error == RadioError::INVALID_MODEM_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
}
/*
* Test IRadio.sendDtmf() for the response returned.
*/
TEST_F(RadioHidlTest, sendDtmf) {
int serial = 1;
int serial = GetRandomSerialNumber();
radio->sendDtmf(serial, "1");
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
radio->sendDtmf(serial, "1");
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::INVALID_CALL_ID ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::INVALID_CALL_ID ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
}
/*
* Test IRadio.startDtmf() for the response returned.
*/
TEST_F(RadioHidlTest, startDtmf) {
int serial = 1;
int serial = GetRandomSerialNumber();
radio->startDtmf(serial, "1");
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
radio->startDtmf(serial, "1");
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::INVALID_CALL_ID ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::INVALID_CALL_ID ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
}
/*
* Test IRadio.stopDtmf() for the response returned.
*/
TEST_F(RadioHidlTest, stopDtmf) {
int serial = 1;
int serial = GetRandomSerialNumber();
radio->stopDtmf(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
radio->stopDtmf(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::INVALID_CALL_ID ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() || radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::INVALID_CALL_ID ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
}
/*
* Test IRadio.setMute() for the response returned.
*/
TEST_F(RadioHidlTest, setMute) {
int serial = 1;
int serial = GetRandomSerialNumber();
radio->setMute(serial, true);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
radio->setMute(serial, true);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::NONE);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::NONE);
}
}
/*
* Test IRadio.getMute() for the response returned.
*/
TEST_F(RadioHidlTest, getMute) {
int serial = 1;
int serial = GetRandomSerialNumber();
radio->getMute(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
radio->getMute(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
}
}
/*
* Test IRadio.sendBurstDtmf() for the response returned.
*/
TEST_F(RadioHidlTest, sendBurstDtmf) {
int serial = 1;
int serial = GetRandomSerialNumber();
radio->sendBurstDtmf(serial, "1", 0, 0);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
radio->sendBurstDtmf(serial, "1", 0, 0);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR);
}
}

File diff suppressed because it is too large Load diff

View file

@ -18,78 +18,74 @@
SapCallback::SapCallback(SapHidlTest& parent) : parent(parent) {}
Return<void> SapCallback::connectResponse(int32_t token,
SapConnectRsp /*sapConnectRsp*/,
Return<void> SapCallback::connectResponse(int32_t token, SapConnectRsp /*sapConnectRsp*/,
int32_t /*maxMsgSize*/) {
sapResponseToken = token;
parent.notify();
return Void();
sapResponseToken = token;
parent.notify();
return Void();
}
Return<void> SapCallback::disconnectResponse(int32_t token) {
sapResponseToken = token;
parent.notify();
return Void();
sapResponseToken = token;
parent.notify();
return Void();
}
Return<void> SapCallback::disconnectIndication(
int32_t /*token*/, SapDisconnectType /*disconnectType*/) {
return Void();
Return<void> SapCallback::disconnectIndication(int32_t /*token*/,
SapDisconnectType /*disconnectType*/) {
return Void();
}
Return<void> SapCallback::apduResponse(
int32_t token, SapResultCode resultCode,
const ::android::hardware::hidl_vec<uint8_t>& /*apduRsp*/) {
sapResponseToken = token;
sapResultCode = resultCode;
parent.notify();
return Void();
Return<void> SapCallback::apduResponse(int32_t token, SapResultCode resultCode,
const ::android::hardware::hidl_vec<uint8_t>& /*apduRsp*/) {
sapResponseToken = token;
sapResultCode = resultCode;
parent.notify();
return Void();
}
Return<void> SapCallback::transferAtrResponse(
int32_t token, SapResultCode resultCode,
const ::android::hardware::hidl_vec<uint8_t>& /*atr*/) {
sapResponseToken = token;
sapResultCode = resultCode;
parent.notify();
return Void();
sapResponseToken = token;
sapResultCode = resultCode;
parent.notify();
return Void();
}
Return<void> SapCallback::powerResponse(int32_t token,
SapResultCode resultCode) {
sapResponseToken = token;
sapResultCode = resultCode;
parent.notify();
return Void();
Return<void> SapCallback::powerResponse(int32_t token, SapResultCode resultCode) {
sapResponseToken = token;
sapResultCode = resultCode;
parent.notify();
return Void();
}
Return<void> SapCallback::resetSimResponse(int32_t token,
SapResultCode resultCode) {
sapResponseToken = token;
sapResultCode = resultCode;
parent.notify();
return Void();
Return<void> SapCallback::resetSimResponse(int32_t token, SapResultCode resultCode) {
sapResponseToken = token;
sapResultCode = resultCode;
parent.notify();
return Void();
}
Return<void> SapCallback::statusIndication(int32_t /*token*/,
SapStatus /*status*/) {
return Void();
Return<void> SapCallback::statusIndication(int32_t /*token*/, SapStatus /*status*/) {
return Void();
}
Return<void> SapCallback::transferCardReaderStatusResponse(
int32_t token, SapResultCode resultCode, int32_t /*cardReaderStatus*/) {
sapResponseToken = token;
sapResultCode = resultCode;
parent.notify();
return Void();
Return<void> SapCallback::transferCardReaderStatusResponse(int32_t token, SapResultCode resultCode,
int32_t /*cardReaderStatus*/) {
sapResponseToken = token;
sapResultCode = resultCode;
parent.notify();
return Void();
}
Return<void> SapCallback::errorResponse(int32_t /*token*/) { return Void(); }
Return<void> SapCallback::transferProtocolResponse(int32_t token,
SapResultCode resultCode) {
sapResponseToken = token;
sapResultCode = resultCode;
parent.notify();
return Void();
Return<void> SapCallback::errorResponse(int32_t /*token*/) {
return Void();
}
Return<void> SapCallback::transferProtocolResponse(int32_t token, SapResultCode resultCode) {
sapResponseToken = token;
sapResultCode = resultCode;
parent.notify();
return Void();
}

View file

@ -20,112 +20,117 @@
* Test ISap.connectReq() for the response returned.
*/
TEST_F(SapHidlTest, connectReq) {
int32_t token = 0;
int32_t maxMsgSize = 100;
int32_t token = GetRandomSerialNumber();
int32_t maxMsgSize = 100;
sap->connectReq(++token, maxMsgSize);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(sapCb->sapResponseToken, token);
sap->connectReq(token, maxMsgSize);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(sapCb->sapResponseToken, token);
}
/*
* Test IRadio.disconnectReq() for the response returned
*/
TEST_F(SapHidlTest, disconnectReq) {
int32_t token = 0;
int32_t token = GetRandomSerialNumber();
sap->disconnectReq(++token);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(sapCb->sapResponseToken, token);
sap->disconnectReq(token);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(sapCb->sapResponseToken, token);
}
/*
* Test IRadio.apduReq() for the response returned.
*/
TEST_F(SapHidlTest, apduReq) {
int32_t token = 0;
SapApduType sapApduType = SapApduType::APDU;
android::hardware::hidl_vec<uint8_t> command = {};
int32_t token = GetRandomSerialNumber();
SapApduType sapApduType = SapApduType::APDU;
android::hardware::hidl_vec<uint8_t> command = {};
sap->apduReq(++token, sapApduType, command);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(sapCb->sapResponseToken, token);
sap->apduReq(token, sapApduType, command);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(sapCb->sapResponseToken, token);
ASSERT_TRUE(SapResultCode::CARD_NOT_ACCESSSIBLE == sapCb->sapResultCode ||
SapResultCode::CARD_ALREADY_POWERED_OFF == sapCb->sapResultCode ||
SapResultCode::CARD_REMOVED == sapCb->sapResultCode);
ASSERT_TRUE(SapResultCode::GENERIC_FAILURE == sapCb->sapResultCode ||
SapResultCode::CARD_NOT_ACCESSSIBLE == sapCb->sapResultCode ||
SapResultCode::CARD_ALREADY_POWERED_OFF == sapCb->sapResultCode ||
SapResultCode::CARD_REMOVED == sapCb->sapResultCode);
}
/*
* Test IRadio.transferAtrReq() for the response returned.
*/
TEST_F(SapHidlTest, transferAtrReq) {
int32_t token = 0;
int32_t token = GetRandomSerialNumber();
sap->transferAtrReq(++token);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(sapCb->sapResponseToken, token);
sap->transferAtrReq(token);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(sapCb->sapResponseToken, token);
ASSERT_TRUE(SapResultCode::DATA_NOT_AVAILABLE == sapCb->sapResultCode ||
SapResultCode::CARD_ALREADY_POWERED_OFF == sapCb->sapResultCode ||
SapResultCode::CARD_REMOVED == sapCb->sapResultCode);
ASSERT_TRUE(SapResultCode::GENERIC_FAILURE == sapCb->sapResultCode ||
SapResultCode::DATA_NOT_AVAILABLE == sapCb->sapResultCode ||
SapResultCode::CARD_ALREADY_POWERED_OFF == sapCb->sapResultCode ||
SapResultCode::CARD_REMOVED == sapCb->sapResultCode);
}
/*
* Test IRadio.powerReq() for the response returned.
*/
TEST_F(SapHidlTest, powerReq) {
int32_t token = 0;
bool state = true;
int32_t token = GetRandomSerialNumber();
bool state = true;
sap->powerReq(++token, state);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(sapCb->sapResponseToken, token);
sap->powerReq(token, state);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(sapCb->sapResponseToken, token);
ASSERT_TRUE(SapResultCode::CARD_NOT_ACCESSSIBLE == sapCb->sapResultCode ||
SapResultCode::CARD_ALREADY_POWERED_OFF == sapCb->sapResultCode ||
SapResultCode::CARD_REMOVED == sapCb->sapResultCode ||
SapResultCode::CARD_ALREADY_POWERED_ON == sapCb->sapResultCode);
ASSERT_TRUE(SapResultCode::GENERIC_FAILURE == sapCb->sapResultCode ||
SapResultCode::CARD_NOT_ACCESSSIBLE == sapCb->sapResultCode ||
SapResultCode::CARD_ALREADY_POWERED_OFF == sapCb->sapResultCode ||
SapResultCode::CARD_REMOVED == sapCb->sapResultCode ||
SapResultCode::CARD_ALREADY_POWERED_ON == sapCb->sapResultCode);
}
/*
* Test IRadio.resetSimReq() for the response returned.
*/
TEST_F(SapHidlTest, resetSimReq) {
int32_t token = 0;
int32_t token = GetRandomSerialNumber();
sap->resetSimReq(++token);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(sapCb->sapResponseToken, token);
sap->resetSimReq(token);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(sapCb->sapResponseToken, token);
ASSERT_TRUE(SapResultCode::CARD_NOT_ACCESSSIBLE == sapCb->sapResultCode ||
SapResultCode::CARD_ALREADY_POWERED_OFF == sapCb->sapResultCode ||
SapResultCode::CARD_REMOVED == sapCb->sapResultCode);
ASSERT_TRUE(SapResultCode::GENERIC_FAILURE == sapCb->sapResultCode ||
SapResultCode::CARD_NOT_ACCESSSIBLE == sapCb->sapResultCode ||
SapResultCode::CARD_ALREADY_POWERED_OFF == sapCb->sapResultCode ||
SapResultCode::CARD_REMOVED == sapCb->sapResultCode);
}
/*
* Test IRadio.transferCardReaderStatusReq() for the response returned.
*/
TEST_F(SapHidlTest, transferCardReaderStatusReq) {
int32_t token = 0;
int32_t token = GetRandomSerialNumber();
sap->transferCardReaderStatusReq(++token);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(sapCb->sapResponseToken, token);
sap->transferCardReaderStatusReq(token);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(sapCb->sapResponseToken, token);
EXPECT_EQ(SapResultCode::DATA_NOT_AVAILABLE, sapCb->sapResultCode);
ASSERT_TRUE(SapResultCode::GENERIC_FAILURE == sapCb->sapResultCode ||
SapResultCode::DATA_NOT_AVAILABLE == sapCb->sapResultCode);
}
/*
* Test IRadio.setTransferProtocolReq() for the response returned.
*/
TEST_F(SapHidlTest, setTransferProtocolReq) {
int32_t token = 0;
SapTransferProtocol sapTransferProtocol = SapTransferProtocol::T0;
int32_t token = GetRandomSerialNumber();
SapTransferProtocol sapTransferProtocol = SapTransferProtocol::T0;
sap->setTransferProtocolReq(++token, sapTransferProtocol);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(sapCb->sapResponseToken, token);
sap->setTransferProtocolReq(token, sapTransferProtocol);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(sapCb->sapResponseToken, token);
EXPECT_EQ(SapResultCode::NOT_SUPPORTED, sapCb->sapResultCode);
EXPECT_EQ(SapResultCode::NOT_SUPPORTED, sapCb->sapResultCode);
}

View file

@ -17,37 +17,36 @@
#include <sap_hidl_hal_utils.h>
void SapHidlTest::SetUp() {
sap = ::testing::VtsHalHidlTargetTestBase::getService<ISap>(
hidl_string(SAP_SERVICE_NAME));
ASSERT_NE(sap, nullptr);
sap = ::testing::VtsHalHidlTargetTestBase::getService<ISap>(hidl_string(SAP_SERVICE_NAME));
ASSERT_NE(sap, nullptr);
sapCb = new SapCallback(*this);
ASSERT_NE(sapCb, nullptr);
sapCb = new SapCallback(*this);
ASSERT_NE(sapCb, nullptr);
count = 0;
count = 0;
sap->setCallback(sapCb);
sap->setCallback(sapCb);
}
void SapHidlTest::TearDown() {}
void SapHidlTest::notify() {
std::unique_lock<std::mutex> lock(mtx);
count++;
cv.notify_one();
std::unique_lock<std::mutex> lock(mtx);
count++;
cv.notify_one();
}
std::cv_status SapHidlTest::wait() {
std::unique_lock<std::mutex> lock(mtx);
std::unique_lock<std::mutex> lock(mtx);
std::cv_status status = std::cv_status::no_timeout;
auto now = std::chrono::system_clock::now();
while (count == 0) {
status = cv.wait_until(lock, now + std::chrono::seconds(TIMEOUT_PERIOD));
if (status == std::cv_status::timeout) {
return status;
std::cv_status status = std::cv_status::no_timeout;
auto now = std::chrono::system_clock::now();
while (count == 0) {
status = cv.wait_until(lock, now + std::chrono::seconds(TIMEOUT_PERIOD));
if (status == std::cv_status::timeout) {
return status;
}
}
}
count--;
return status;
}
count--;
return status;
}

View file

@ -25,6 +25,8 @@
#include <android/hardware/radio/1.0/ISapCallback.h>
#include <android/hardware/radio/1.0/types.h>
#include <vts_test_util.h>
using namespace ::android::hardware::radio::V1_0;
using ::android::hardware::hidl_string;
@ -40,77 +42,71 @@ class SapHidlTest;
/* Callback class for sap response */
class SapCallback : public ISapCallback {
private:
SapHidlTest& parent;
private:
SapHidlTest& parent;
public:
SapResultCode sapResultCode;
int32_t sapResponseToken;
public:
SapResultCode sapResultCode;
int32_t sapResponseToken;
SapCallback(SapHidlTest& parent);
SapCallback(SapHidlTest& parent);
virtual ~SapCallback() = default;
virtual ~SapCallback() = default;
Return<void> connectResponse(int32_t token, SapConnectRsp sapConnectRsp,
int32_t maxMsgSize);
Return<void> connectResponse(int32_t token, SapConnectRsp sapConnectRsp, int32_t maxMsgSize);
Return<void> disconnectResponse(int32_t token);
Return<void> disconnectResponse(int32_t token);
Return<void> disconnectIndication(int32_t token,
SapDisconnectType disconnectType);
Return<void> disconnectIndication(int32_t token, SapDisconnectType disconnectType);
Return<void> apduResponse(
int32_t token, SapResultCode resultCode,
const ::android::hardware::hidl_vec<uint8_t>& apduRsp);
Return<void> apduResponse(int32_t token, SapResultCode resultCode,
const ::android::hardware::hidl_vec<uint8_t>& apduRsp);
Return<void> transferAtrResponse(
int32_t token, SapResultCode resultCode,
const ::android::hardware::hidl_vec<uint8_t>& atr);
Return<void> transferAtrResponse(int32_t token, SapResultCode resultCode,
const ::android::hardware::hidl_vec<uint8_t>& atr);
Return<void> powerResponse(int32_t token, SapResultCode resultCode);
Return<void> powerResponse(int32_t token, SapResultCode resultCode);
Return<void> resetSimResponse(int32_t token, SapResultCode resultCode);
Return<void> resetSimResponse(int32_t token, SapResultCode resultCode);
Return<void> statusIndication(int32_t token, SapStatus status);
Return<void> statusIndication(int32_t token, SapStatus status);
Return<void> transferCardReaderStatusResponse(int32_t token,
SapResultCode resultCode,
int32_t cardReaderStatus);
Return<void> transferCardReaderStatusResponse(int32_t token, SapResultCode resultCode,
int32_t cardReaderStatus);
Return<void> errorResponse(int32_t token);
Return<void> errorResponse(int32_t token);
Return<void> transferProtocolResponse(int32_t token,
SapResultCode resultCode);
Return<void> transferProtocolResponse(int32_t token, SapResultCode resultCode);
};
// The main test class for Sap HIDL.
class SapHidlTest : public ::testing::VtsHalHidlTargetTestBase {
private:
std::mutex mtx;
std::condition_variable cv;
int count;
private:
std::mutex mtx;
std::condition_variable cv;
int count;
public:
virtual void SetUp() override;
public:
virtual void SetUp() override;
virtual void TearDown() override;
virtual void TearDown() override;
/* Used as a mechanism to inform the test about data/event callback */
void notify();
/* Used as a mechanism to inform the test about data/event callback */
void notify();
/* Test code calls this function to wait for response */
std::cv_status wait();
/* Test code calls this function to wait for response */
std::cv_status wait();
/* Sap service */
sp<ISap> sap;
/* Sap service */
sp<ISap> sap;
/* Sap Callback object */
sp<SapCallback> sapCb;
/* Sap Callback object */
sp<SapCallback> sapCb;
};
// A class for test environment setup
class SapHidlEnvironment : public ::testing::Environment {
public:
virtual void SetUp() {}
virtual void TearDown() {}
public:
virtual void SetUp() {}
virtual void TearDown() {}
};

View file

@ -0,0 +1,22 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <vts_test_util.h>
#include <iostream>
using namespace std;
int GetRandomSerialNumber() {
return rand();
}

View file

@ -0,0 +1,17 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
int GetRandomSerialNumber();