RadioV1_1 VTS Tests: startKeepalive, stopKeepalive

am: 64aae865f0

Change-Id: Ie49223b634fd0260c89b0cb44e762f719311f474
This commit is contained in:
Nathan Harold 2017-07-29 01:03:00 +00:00 committed by android-build-merger
commit a86912c77b
3 changed files with 125 additions and 6 deletions

View file

@ -15,6 +15,7 @@
*/
#include <radio_hidl_hal_utils_v1_1.h>
#include <vector>
/*
* Test IRadio.setSimCardPower() for the response returned.
@ -129,4 +130,116 @@ TEST_F(RadioHidlTest_v1_1, setCarrierInfoForImsiEncryption) {
ASSERT_TRUE(radioRsp_v1_1->rspInfo.error == RadioError::NONE ||
radioRsp_v1_1->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
}
}
}
/*
* Test IRadio.startKeepalive() for the response returned.
*/
TEST_F(RadioHidlTest_v1_1, startKeepalive) {
std::vector<KeepaliveRequest> requests = {
{
// Invalid IPv4 source address
KeepaliveType::NATT_IPV4,
{192, 168, 0 /*, 100*/},
1234,
{8, 8, 4, 4},
4500,
20000,
0xBAD,
},
{
// Invalid IPv4 destination address
KeepaliveType::NATT_IPV4,
{192, 168, 0, 100},
1234,
{8, 8, 4, 4, 1, 2, 3, 4},
4500,
20000,
0xBAD,
},
{
// Invalid Keepalive Type
static_cast<KeepaliveType>(-1),
{192, 168, 0, 100},
1234,
{8, 8, 4, 4},
4500,
20000,
0xBAD,
},
{
// Invalid IPv6 source address
KeepaliveType::NATT_IPV6,
{0xDE, 0xAD, 0xBE, 0xEF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xED,
0xBE, 0xEF, 0xBD},
1234,
{0x20, 0x01, 0x48, 0x60, 0x48, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x88, 0x44},
4500,
20000,
0xBAD,
},
{
// Invalid IPv6 destination address
KeepaliveType::NATT_IPV6,
{0xDE, 0xAD, 0xBE, 0xEF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xED,
0xBE, 0xEF},
1234,
{0x20, 0x01, 0x48, 0x60, 0x48, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x88,
/*0x44*/},
4500,
20000,
0xBAD,
},
{
// Invalid Context ID (cid), this should survive the initial
// range checking and fail in the modem data layer
KeepaliveType::NATT_IPV4,
{192, 168, 0, 100},
1234,
{8, 8, 4, 4},
4500,
20000,
0xBAD,
},
{
// Invalid Context ID (cid), this should survive the initial
// range checking and fail in the modem data layer
KeepaliveType::NATT_IPV6,
{0xDE, 0xAD, 0xBE, 0xEF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xED,
0xBE, 0xEF},
1234,
{0x20, 0x01, 0x48, 0x60, 0x48, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x88, 0x44},
4500,
20000,
0xBAD,
}};
for (auto req = requests.begin(); req != requests.end(); req++) {
int serial = GetRandomSerialNumber();
radio_v1_1->startKeepalive(serial, *req);
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);
ASSERT_TRUE(radioRsp_v1_1->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp_v1_1->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
}
}
/*
* Test IRadio.stopKeepalive() for the response returned.
*/
TEST_F(RadioHidlTest_v1_1, stopKeepalive) {
int serial = GetRandomSerialNumber();
radio_v1_1->stopKeepalive(serial, 0xBAD);
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);
ASSERT_TRUE(radioRsp_v1_1->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp_v1_1->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
}

View file

@ -53,6 +53,7 @@ class RadioResponse_v1_1 : public ::android::hardware::radio::V1_1::IRadioRespon
hidl_string imsi;
IccIoResult iccIoResult;
int channelId;
KeepaliveStatus keepaliveStatus;
// Sms
SendSmsResult sendSmsResult;
@ -567,4 +568,4 @@ class RadioHidlEnvironment : public ::testing::Environment {
public:
virtual void SetUp() {}
virtual void TearDown() {}
};
};

View file

@ -683,11 +683,16 @@ Return<void> RadioResponse_v1_1::stopNetworkScanResponse(const RadioResponseInfo
return Void();
}
Return<void> RadioResponse_v1_1::startKeepaliveResponse(const RadioResponseInfo& /*info*/,
const KeepaliveStatus& /*status*/) {
Return<void> RadioResponse_v1_1::startKeepaliveResponse(const RadioResponseInfo& info,
const KeepaliveStatus& status) {
rspInfo = info;
keepaliveStatus = status;
parent_v1_1.notify();
return Void();
}
Return<void> RadioResponse_v1_1::stopKeepaliveResponse(const RadioResponseInfo& /*info*/) {
Return<void> RadioResponse_v1_1::stopKeepaliveResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_v1_1.notify();
return Void();
}
}