Merge " Add VTS code for the network scan API"

am: 6ef70c9040

Change-Id: I53e0827adf81cfde229f2f1d202ba5e589b7b4e3
This commit is contained in:
yinxu 2017-07-24 23:50:57 +00:00 committed by android-build-merger
commit a944299fdb
2 changed files with 76 additions and 2 deletions

View file

@ -34,3 +34,73 @@ TEST_F(RadioHidlTest_v1_1, setSimCardPower_1_1) {
radioRsp_v1_1->rspInfo.error == RadioError::RADIO_NOT_AVAILABLE);
}
}
/*
* Test IRadio.startNetworkScan() for the response returned.
*/
TEST_F(RadioHidlTest_v1_1, startNetworkScan) {
int serial = GetRandomSerialNumber();
NetworkScanRequest request;
request.type = ScanType::ONE_SHOT;
request.interval = 60;
RadioAccessSpecifier specifier;
specifier.radioAccessNetwork = RadioAccessNetworks::GERAN;
specifier.geranBands.resize(2);
specifier.geranBands[0] = GeranBands::BAND_450;
specifier.geranBands[1] = GeranBands::BAND_480;
specifier.channels.resize(2);
specifier.channels[0] = 1;
specifier.channels[1] = 2;
request.specifiers.resize(1);
request.specifiers[0] = specifier;
radio_v1_1->startNetworkScan(serial, request);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_1->rspInfo.type);
EXPECT_EQ(serial, radioRsp_v1_1->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(radioRsp_v1_1->rspInfo.error == RadioError::NONE ||
radioRsp_v1_1->rspInfo.error == RadioError::SIM_ABSENT ||
radioRsp_v1_1->rspInfo.error == RadioError::INVALID_ARGUMENTS);
}
}
/*
* Test IRadio.startNetworkScan() for the response returned.
*/
TEST_F(RadioHidlTest_v1_1, startNetworkScan_InvalidArgument) {
int serial = GetRandomSerialNumber();
NetworkScanRequest request;
request.type = ScanType::ONE_SHOT;
request.interval = 60;
radio_v1_1->startNetworkScan(serial, request);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_1->rspInfo.type);
EXPECT_EQ(serial, radioRsp_v1_1->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(radioRsp_v1_1->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp_v1_1->rspInfo.error == RadioError::SIM_ABSENT);
}
}
/*
* Test IRadio.stopNetworkScan() for the response returned.
*/
TEST_F(RadioHidlTest_v1_1, stopNetworkScan) {
int serial = GetRandomSerialNumber();
radio_v1_1->stopNetworkScan(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_1->rspInfo.type);
EXPECT_EQ(serial, radioRsp_v1_1->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(radioRsp_v1_1->rspInfo.error == RadioError::NONE ||
radioRsp_v1_1->rspInfo.error == RadioError::SIM_ABSENT);
}
}

View file

@ -669,11 +669,15 @@ Return<void> RadioResponse_v1_1::setSimCardPowerResponse_1_1(const RadioResponse
return Void();
}
Return<void> RadioResponse_v1_1::startNetworkScanResponse(const RadioResponseInfo& /*info*/) {
Return<void> RadioResponse_v1_1::startNetworkScanResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_v1_1.notify();
return Void();
}
Return<void> RadioResponse_v1_1::stopNetworkScanResponse(const RadioResponseInfo& /*info*/) {
Return<void> RadioResponse_v1_1::stopNetworkScanResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_v1_1.notify();
return Void();
}