Merge "Add VTS test for misc RIL apis." am: 69c546ba21

am: d9dabe6b57

Change-Id: Ib8b6086623384f536638ee36c3703a93da1999e5
This commit is contained in:
Sanket Padawe 2017-03-17 23:28:52 +00:00 committed by android-build-merger
commit 592ddbf04e
5 changed files with 944 additions and 52 deletions

View file

@ -17,15 +17,16 @@
cc_test {
name: "VtsHalRadioV1_0TargetTest",
defaults: ["hidl_defaults"],
srcs: ["radio_hidl_hal_test.cpp",
"radio_response.cpp",
"radio_hidl_hal_voice.cpp",
"radio_hidl_hal_cell_broadcast.cpp",
srcs: ["radio_hidl_hal_cell_broadcast.cpp",
"radio_hidl_hal_data.cpp",
"radio_hidl_hal_icc.cpp",
"radio_hidl_hal_ims.cpp",
"radio_hidl_hal_misc.cpp",
"radio_hidl_hal_sms.cpp",
"radio_hidl_hal_stk.cpp",
"radio_hidl_hal_test.cpp",
"radio_hidl_hal_voice.cpp",
"radio_response.cpp",
"VtsHalRadioV1_0TargetTest.cpp"],
shared_libs: [
"libbase",

View file

@ -287,4 +287,20 @@ TEST_F(RadioHidlTest, requestIccSimAuthentication) {
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;
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(radioRsp->rspInfo.error == RadioError::PASSWORD_INCORRECT);
}
}

View file

@ -0,0 +1,774 @@
/*
* 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<radio_hidl_hal_utils.h>
/*
* Test IRadio.getSignalStrength() for the response returned.
*/
TEST_F(RadioHidlTest, getSignalStrength) {
int serial = 1;
radio->getSignalStrength(++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);
}
}
/*
* Test IRadio.getVoiceRegistrationState() for the response returned.
*/
TEST_F(RadioHidlTest, getVoiceRegistrationState) {
int serial = 1;
radio->getVoiceRegistrationState(++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);
}
}
/*
* Test IRadio.getOperator() for the response returned.
*/
TEST_F(RadioHidlTest, getOperator) {
int serial = 1;
radio->getOperator(++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);
}
}
/*
* Test IRadio.setRadioPower() for the response returned.
*/
TEST_F(RadioHidlTest, setRadioPower) {
int serial = 1;
radio->setRadioPower(++serial, 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(radioRsp->rspInfo.error == RadioError::NONE);
}
}
/*
* Test IRadio.getNetworkSelectionMode() for the response returned.
*/
TEST_F(RadioHidlTest, getNetworkSelectionMode) {
int serial = 1;
radio->getNetworkSelectionMode(++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);
}
}
/*
* Test IRadio.setNetworkSelectionModeAutomatic() for the response returned.
*/
TEST_F(RadioHidlTest, setNetworkSelectionModeAutomatic) {
int serial = 1;
radio->setNetworkSelectionModeAutomatic(++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::ILLEGAL_SIM_OR_ME);
}
}
/*
* Test IRadio.setNetworkSelectionModeManual() for the response returned.
*/
TEST_F(RadioHidlTest, setNetworkSelectionModeManual) {
int serial = 1;
radio->setNetworkSelectionModeManual(++serial, "123456");
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::ILLEGAL_SIM_OR_ME);
}
}
/*
* Test IRadio.getAvailableNetworks() for the response returned.
*/
TEST_F(RadioHidlTest, getAvailableNetworks) {
int serial = 1;
radio->getAvailableNetworks(++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);
}
}
/*
* Test IRadio.getBasebandVersion() for the response returned.
*/
TEST_F(RadioHidlTest, getBasebandVersion) {
int serial = 1;
radio->getBasebandVersion(++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);
}
}
/*
* Test IRadio.setBandMode() for the response returned.
*/
TEST_F(RadioHidlTest, setBandMode) {
int serial = 1;
radio->setBandMode(++serial, RadioBandMode::BAND_MODE_USA);
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);
}
}
/*
* Test IRadio.getAvailableBandModes() for the response returned.
*/
TEST_F(RadioHidlTest, getAvailableBandModes) {
int serial = 1;
radio->getAvailableBandModes(++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);
}
}
/*
* Test IRadio.setPreferredNetworkType() for the response returned.
*/
TEST_F(RadioHidlTest, setPreferredNetworkType) {
int serial = 1;
radio->setPreferredNetworkType(++serial, PreferredNetworkType::GSM_ONLY);
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);
}
}
/*
* Test IRadio.getPreferredNetworkType() for the response returned.
*/
TEST_F(RadioHidlTest, getPreferredNetworkType) {
int serial = 1;
radio->getPreferredNetworkType(++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);
}
}
/*
* Test IRadio.getNeighboringCids() for the response returned.
*/
TEST_F(RadioHidlTest, getNeighboringCids) {
int serial = 1;
radio->getNeighboringCids(++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);
}
}
/*
* Test IRadio.setLocationUpdates() for the response returned.
*/
TEST_F(RadioHidlTest, setLocationUpdates) {
int serial = 1;
radio->setLocationUpdates(++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(radioRsp->rspInfo.error == RadioError::NONE);
}
}
/*
* Test IRadio.setCdmaRoamingPreference() for the response returned.
*/
TEST_F(RadioHidlTest, setCdmaRoamingPreference) {
int serial = 1;
radio->setCdmaRoamingPreference(++serial, CdmaRoamingType::HOME_NETWORK);
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);
}
}
/*
* Test IRadio.getCdmaRoamingPreference() for the response returned.
*/
TEST_F(RadioHidlTest, getCdmaRoamingPreference) {
int serial = 1;
radio->getCdmaRoamingPreference(++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);
}
}
/*
* Test IRadio.getTTYMode() for the response returned.
*/
TEST_F(RadioHidlTest, getTTYMode) {
int serial = 1;
radio->getTTYMode(++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);
}
}
/*
* Test IRadio.setTTYMode() for the response returned.
*/
TEST_F(RadioHidlTest, setTTYMode) {
int serial = 1;
radio->setTTYMode(++serial, TtyMode::OFF);
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);
}
}
/*
* Test IRadio.setPreferredVoicePrivacy() for the response returned.
*/
TEST_F(RadioHidlTest, setPreferredVoicePrivacy) {
int serial = 1;
radio->setPreferredVoicePrivacy(++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(radioRsp->rspInfo.error == RadioError::NONE);
}
}
/*
* Test IRadio.getPreferredVoicePrivacy() for the response returned.
*/
TEST_F(RadioHidlTest, getPreferredVoicePrivacy) {
int serial = 1;
radio->getPreferredVoicePrivacy(++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);
}
}
/*
* Test IRadio.getCDMASubscription() for the response returned.
*/
TEST_F(RadioHidlTest, getCDMASubscription) {
int serial = 1;
radio->getCDMASubscription(++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);
}
}
/*
* Test IRadio.getDeviceIdentity() for the response returned.
*/
TEST_F(RadioHidlTest, getDeviceIdentity) {
int serial = 1;
radio->getDeviceIdentity(++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);
}
}
/*
* Test IRadio.exitEmergencyCallbackMode() for the response returned.
*/
TEST_F(RadioHidlTest, exitEmergencyCallbackMode) {
int serial = 1;
radio->exitEmergencyCallbackMode(++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);
}
}
/*
* Test IRadio.getCdmaSubscriptionSource() for the response returned.
*/
TEST_F(RadioHidlTest, getCdmaSubscriptionSource) {
int serial = 1;
radio->getCdmaSubscriptionSource(++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);
}
}
/*
* Test IRadio.getVoiceRadioTechnology() for the response returned.
*/
TEST_F(RadioHidlTest, getVoiceRadioTechnology) {
int serial = 1;
radio->getVoiceRadioTechnology(++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);
}
}
/*
* Test IRadio.getCellInfoList() for the response returned.
*/
TEST_F(RadioHidlTest, getCellInfoList) {
int serial = 1;
radio->getCellInfoList(++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);
}
}
/*
* Test IRadio.setCellInfoListRate() for the response returned.
*/
TEST_F(RadioHidlTest, setCellInfoListRate) {
int serial = 1;
// TODO(sanketpadawe): RIL crashes with value of rate = 10
radio->setCellInfoListRate(++serial, 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(radioRsp->rspInfo.error == RadioError::NONE);
}
}
/*
* Test IRadio.nvReadItem() for the response returned.
*/
TEST_F(RadioHidlTest, nvReadItem) {
int serial = 1;
radio->nvReadItem(++serial, NvItem::LTE_BAND_ENABLE_25);
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);
}
}
/*
* Test IRadio.nvWriteItem() for the response returned.
*/
TEST_F(RadioHidlTest, nvWriteItem) {
int serial = 1;
NvWriteItem item;
memset(&item, 0, sizeof(item));
item.value = hidl_string();
radio->nvWriteItem(++serial, item);
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);
}
}
/*
* Test IRadio.nvWriteCdmaPrl() for the response returned.
*/
TEST_F(RadioHidlTest, nvWriteCdmaPrl) {
int serial = 1;
std::vector<uint8_t> prl = {1, 2, 3, 4, 5};
radio->nvWriteCdmaPrl(++serial, hidl_vec<uint8_t>(prl));
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);
}
}
/*
* Test IRadio.nvResetConfig() for the response returned.
*/
TEST_F(RadioHidlTest, nvResetConfig) {
int serial = 1;
radio->nvResetConfig(++serial, ResetNvType::RELOAD);
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);
}
}
/*
* Test IRadio.setUiccSubscription() for the response returned.
*/
TEST_F(RadioHidlTest, setUiccSubscription) {
int serial = 1;
SelectUiccSub item;
memset(&item, 0, sizeof(item));
radio->setUiccSubscription(++serial, item);
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);
}
}
/*
* Test IRadio.getHardwareConfig() for the response returned.
*/
TEST_F(RadioHidlTest, getHardwareConfig) {
int serial = 1;
radio->getHardwareConfig(++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);
}
}
/*
* Test IRadio.requestShutdown() for the response returned.
*/
TEST_F(RadioHidlTest, requestShutdown) {
int serial = 1;
radio->requestShutdown(++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);
}
}
/*
* Test IRadio.getRadioCapability() for the response returned.
*/
TEST_F(RadioHidlTest, getRadioCapability) {
int serial = 1;
radio->getRadioCapability(++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);
}
}
/*
* Test IRadio.setRadioCapability() for the response returned.
*/
TEST_F(RadioHidlTest, setRadioCapability) {
int serial = 1;
RadioCapability rc;
memset(&rc, 0, sizeof(rc));
rc.logicalModemUuid = hidl_string();
radio->setRadioCapability(++serial, rc);
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);
}
}
/*
* Test IRadio.startLceService() for the response returned.
*/
TEST_F(RadioHidlTest, startLceService) {
int serial = 1;
radio->startLceService(++serial, 5, 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(radioRsp->rspInfo.error == RadioError::NONE
|| radioRsp->rspInfo.error == RadioError::LCE_NOT_SUPPORTED);
}
}
/*
* Test IRadio.stopLceService() for the response returned.
*/
TEST_F(RadioHidlTest, stopLceService) {
int serial = 1;
radio->stopLceService(++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::LCE_NOT_SUPPORTED);
}
}
/*
* Test IRadio.pullLceData() for the response returned.
*/
TEST_F(RadioHidlTest, pullLceData) {
int serial = 1;
radio->pullLceData(++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::LCE_NOT_SUPPORTED);
}
}
/*
* Test IRadio.getModemActivityInfo() for the response returned.
*/
TEST_F(RadioHidlTest, getModemActivityInfo) {
int serial = 1;
radio->getModemActivityInfo(++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);
}
}
/*
* Test IRadio.setAllowedCarriers() for the response returned.
*/
TEST_F(RadioHidlTest, setAllowedCarriers) {
int serial = 1;
CarrierRestrictions carriers;
memset(&carriers, 0, sizeof(carriers));
carriers.allowedCarriers.resize(1);
carriers.excludedCarriers.resize(0);
carriers.allowedCarriers[0].mcc = hidl_string();
carriers.allowedCarriers[0].mnc = hidl_string();
carriers.allowedCarriers[0].matchType = CarrierMatchType::ALL;
carriers.allowedCarriers[0].matchData = hidl_string();
radio->setAllowedCarriers(++serial, false, carriers);
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);
}
}
/*
* Test IRadio.getAllowedCarriers() for the response returned.
*/
TEST_F(RadioHidlTest, getAllowedCarriers) {
int serial = 1;
radio->getAllowedCarriers(++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);
}
}
/*
* Test IRadio.sendDeviceState() for the response returned.
*/
TEST_F(RadioHidlTest, sendDeviceState) {
int serial = 1;
radio->sendDeviceState(++serial, DeviceStateType::POWER_SAVE_MODE, 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(radioRsp->rspInfo.error == RadioError::NONE);
}
}
/*
* Test IRadio.setIndicationFilter() for the response returned.
*/
TEST_F(RadioHidlTest, setIndicationFilter) {
int serial = 1;
radio->setIndicationFilter(++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(radioRsp->rspInfo.error == RadioError::NONE);
}
}
/*
* Test IRadio.setSimCardPower() for the response returned.
*/
TEST_F(RadioHidlTest, setSimCardPower) {
int serial = 1;
radio->setSimCardPower(++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(radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
}
}

View file

@ -32,6 +32,7 @@ using ::android::hardware::radio::V1_0::CardStatus;
using ::android::hardware::radio::V1_0::CardState;
using ::android::hardware::radio::V1_0::Call;
using ::android::hardware::radio::V1_0::CallForwardInfo;
using ::android::hardware::radio::V1_0::CarrierMatchType;
using ::android::hardware::radio::V1_0::CarrierRestrictions;
using ::android::hardware::radio::V1_0::CdmaRoamingType;
using ::android::hardware::radio::V1_0::CdmaBroadcastSmsConfigInfo;
@ -39,6 +40,7 @@ using ::android::hardware::radio::V1_0::CdmaSubscriptionSource;
using ::android::hardware::radio::V1_0::CellInfo;
using ::android::hardware::radio::V1_0::ClipStatus;
using ::android::hardware::radio::V1_0::DataRegStateResult;
using ::android::hardware::radio::V1_0::DeviceStateType;
using ::android::hardware::radio::V1_0::Dial;
using ::android::hardware::radio::V1_0::GsmBroadcastSmsConfigInfo;
using ::android::hardware::radio::V1_0::HardwareConfig;
@ -54,6 +56,8 @@ using ::android::hardware::radio::V1_0::LastCallFailCauseInfo;
using ::android::hardware::radio::V1_0::LceDataInfo;
using ::android::hardware::radio::V1_0::LceStatusInfo;
using ::android::hardware::radio::V1_0::NeighboringCell;
using ::android::hardware::radio::V1_0::NvItem;
using ::android::hardware::radio::V1_0::NvWriteItem;
using ::android::hardware::radio::V1_0::OperatorInfo;
using ::android::hardware::radio::V1_0::PreferredNetworkType;
using ::android::hardware::radio::V1_0::RadioBandMode;
@ -61,6 +65,8 @@ using ::android::hardware::radio::V1_0::RadioCapability;
using ::android::hardware::radio::V1_0::RadioResponseType;
using ::android::hardware::radio::V1_0::RadioTechnology;
using ::android::hardware::radio::V1_0::RadioTechnologyFamily;
using ::android::hardware::radio::V1_0::ResetNvType;
using ::android::hardware::radio::V1_0::SelectUiccSub;
using ::android::hardware::radio::V1_0::SendSmsResult;
using ::android::hardware::radio::V1_0::SetupDataCallResult;
using ::android::hardware::radio::V1_0::SignalStrength;
@ -69,11 +75,12 @@ using ::android::hardware::radio::V1_0::TtyMode;
using ::android::hardware::radio::V1_0::VoiceRegStateResult;
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::sp;
#define TIMEOUT_PERIOD 20
#define TIMEOUT_PERIOD 40
class RadioHidlTest;
extern CardStatus cardStatus;

View file

@ -72,7 +72,9 @@ Return<void> RadioResponse::changeIccPin2ForAppResponse(
}
Return<void> RadioResponse::supplyNetworkDepersonalizationResponse(
const RadioResponseInfo& /*info*/, int32_t /*remainingRetries*/) {
const RadioResponseInfo& info, int32_t /*remainingRetries*/) {
rspInfo = info;
parent.notify();
return Void();
}
@ -147,12 +149,16 @@ Return<void> RadioResponse::getLastCallFailCauseResponse(
}
Return<void> RadioResponse::getSignalStrengthResponse(
const RadioResponseInfo& /*info*/, const SignalStrength& /*sig_strength*/) {
const RadioResponseInfo& info, const SignalStrength& /*sig_strength*/) {
rspInfo = info;
parent.notify();
return Void();
}
Return<void> RadioResponse::getVoiceRegistrationStateResponse(
const RadioResponseInfo& /*info*/, const VoiceRegStateResult& /*voiceRegResponse*/) {
const RadioResponseInfo& info, const VoiceRegStateResult& /*voiceRegResponse*/) {
rspInfo = info;
parent.notify();
return Void();
}
@ -164,13 +170,17 @@ Return<void> RadioResponse::getDataRegistrationStateResponse(
}
Return<void> RadioResponse::getOperatorResponse(
const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*longName*/,
const RadioResponseInfo& info, const ::android::hardware::hidl_string& /*longName*/,
const ::android::hardware::hidl_string& /*shortName*/,
const ::android::hardware::hidl_string& /*numeric*/) {
rspInfo = info;
parent.notify();
return Void();
}
Return<void> RadioResponse::setRadioPowerResponse(const RadioResponseInfo& /*info*/) {
Return<void> RadioResponse::setRadioPowerResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
return Void();
}
@ -302,23 +312,31 @@ Return<void> RadioResponse::setBarringPasswordResponse(const RadioResponseInfo&
}
Return<void> RadioResponse::getNetworkSelectionModeResponse(
const RadioResponseInfo& /*info*/, bool /*manual*/) {
const RadioResponseInfo& info, bool /*manual*/) {
rspInfo = info;
parent.notify();
return Void();
}
Return<void> RadioResponse::setNetworkSelectionModeAutomaticResponse(
const RadioResponseInfo& /*info*/) {
const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
return Void();
}
Return<void> RadioResponse::setNetworkSelectionModeManualResponse(
const RadioResponseInfo& /*info*/) {
const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
return Void();
}
Return<void> RadioResponse::getAvailableNetworksResponse(
const RadioResponseInfo& /*info*/,
const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<OperatorInfo>& /*networkInfos*/) {
rspInfo = info;
parent.notify();
return Void();
}
@ -337,7 +355,9 @@ Return<void> RadioResponse::stopDtmfResponse(
}
Return<void> RadioResponse::getBasebandVersionResponse(
const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*version*/) {
const RadioResponseInfo& info, const ::android::hardware::hidl_string& /*version*/) {
rspInfo = info;
parent.notify();
return Void();
}
@ -408,13 +428,17 @@ Return<void> RadioResponse::deleteSmsOnSimResponse(
return Void();
}
Return<void> RadioResponse::setBandModeResponse(const RadioResponseInfo& /*info*/) {
Return<void> RadioResponse::setBandModeResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
return Void();
}
Return<void> RadioResponse::getAvailableBandModesResponse(
const RadioResponseInfo& /*info*/,
const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<RadioBandMode>& /*bandModes*/) {
rspInfo = info;
parent.notify();
return Void();
}
@ -444,23 +468,31 @@ Return<void> RadioResponse::explicitCallTransferResponse(const RadioResponseInfo
return Void();
}
Return<void> RadioResponse::setPreferredNetworkTypeResponse(const RadioResponseInfo& /*info*/) {
Return<void> RadioResponse::setPreferredNetworkTypeResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
return Void();
}
Return<void> RadioResponse::getPreferredNetworkTypeResponse(
const RadioResponseInfo& /*info*/, PreferredNetworkType /*nw_type*/) {
const RadioResponseInfo& info, PreferredNetworkType /*nw_type*/) {
rspInfo = info;
parent.notify();
return Void();
}
Return<void> RadioResponse::getNeighboringCidsResponse(
const RadioResponseInfo& /*info*/,
const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<NeighboringCell>& /*cells*/) {
rspInfo = info;
parent.notify();
return Void();
}
Return<void> RadioResponse::setLocationUpdatesResponse(
const RadioResponseInfo& /*info*/) {
const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
return Void();
}
@ -468,30 +500,42 @@ Return<void> RadioResponse::setCdmaSubscriptionSourceResponse(const RadioRespons
return Void();
}
Return<void> RadioResponse::setCdmaRoamingPreferenceResponse(const RadioResponseInfo& /*info*/) {
Return<void> RadioResponse::setCdmaRoamingPreferenceResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
return Void();
}
Return<void> RadioResponse::getCdmaRoamingPreferenceResponse(
const RadioResponseInfo& /*info*/, CdmaRoamingType /*type*/) {
const RadioResponseInfo& info, CdmaRoamingType /*type*/) {
rspInfo = info;
parent.notify();
return Void();
}
Return<void> RadioResponse::setTTYModeResponse(const RadioResponseInfo& /*info*/) {
Return<void> RadioResponse::setTTYModeResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
return Void();
}
Return<void> RadioResponse::getTTYModeResponse(const RadioResponseInfo& /*info*/,
Return<void> RadioResponse::getTTYModeResponse(const RadioResponseInfo& info,
TtyMode /*mode*/) {
rspInfo = info;
parent.notify();
return Void();
}
Return<void> RadioResponse::setPreferredVoicePrivacyResponse(const RadioResponseInfo& /*info*/) {
Return<void> RadioResponse::setPreferredVoicePrivacyResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
return Void();
}
Return<void> RadioResponse::getPreferredVoicePrivacyResponse(
const RadioResponseInfo& /*info*/, bool /*enable*/) {
const RadioResponseInfo& info, bool /*enable*/) {
rspInfo = info;
parent.notify();
return Void();
}
@ -561,11 +605,13 @@ Return<void> RadioResponse::setCdmaBroadcastActivationResponse(const RadioRespon
}
Return<void> RadioResponse::getCDMASubscriptionResponse(
const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*mdn*/,
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*/) {
rspInfo = info;
parent.notify();
return Void();
}
@ -585,14 +631,18 @@ Return<void> RadioResponse::deleteSmsOnRuimResponse(
}
Return<void> RadioResponse::getDeviceIdentityResponse(
const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*imei*/,
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*/) {
rspInfo = info;
parent.notify();
return Void();
}
Return<void> RadioResponse::exitEmergencyCallbackModeResponse(const RadioResponseInfo& /*info*/) {
Return<void> RadioResponse::exitEmergencyCallbackModeResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
return Void();
}
@ -623,7 +673,9 @@ Return<void> RadioResponse::reportStkServiceIsRunningResponse(const RadioRespons
}
Return<void> RadioResponse::getCdmaSubscriptionSourceResponse(
const RadioResponseInfo& /*info*/, CdmaSubscriptionSource /*source*/) {
const RadioResponseInfo& info, CdmaSubscriptionSource /*source*/) {
rspInfo = info;
parent.notify();
return Void();
}
@ -649,17 +701,23 @@ Return<void> RadioResponse::sendEnvelopeWithStatusResponse(
}
Return<void> RadioResponse::getVoiceRadioTechnologyResponse(
const RadioResponseInfo& /*info*/, RadioTechnology /*rat*/) {
const RadioResponseInfo& info, RadioTechnology /*rat*/) {
rspInfo = info;
parent.notify();
return Void();
}
Return<void> RadioResponse::getCellInfoListResponse(
const RadioResponseInfo& /*info*/,
const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<CellInfo>& /*cellInfo*/) {
rspInfo = info;
parent.notify();
return Void();
}
Return<void> RadioResponse::setCellInfoListRateResponse(const RadioResponseInfo& /*info*/) {
Return<void> RadioResponse::setCellInfoListRateResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
return Void();
}
@ -717,23 +775,33 @@ Return<void> RadioResponse::iccTransmitApduLogicalChannelResponse(
}
Return<void> RadioResponse::nvReadItemResponse(
const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*result*/) {
const RadioResponseInfo& info, const ::android::hardware::hidl_string& /*result*/) {
rspInfo = info;
parent.notify();
return Void();
}
Return<void> RadioResponse::nvWriteItemResponse(const RadioResponseInfo& /*info*/) {
Return<void> RadioResponse::nvWriteItemResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
return Void();
}
Return<void> RadioResponse::nvWriteCdmaPrlResponse(const RadioResponseInfo& /*info*/) {
Return<void> RadioResponse::nvWriteCdmaPrlResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
return Void();
}
Return<void> RadioResponse::nvResetConfigResponse(const RadioResponseInfo& /*info*/) {
Return<void> RadioResponse::nvResetConfigResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
return Void();
}
Return<void> RadioResponse::setUiccSubscriptionResponse(const RadioResponseInfo& /*info*/) {
Return<void> RadioResponse::setUiccSubscriptionResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
return Void();
}
@ -744,8 +812,10 @@ Return<void> RadioResponse::setDataAllowedResponse(const RadioResponseInfo& info
}
Return<void> RadioResponse::getHardwareConfigResponse(
const RadioResponseInfo& /*info*/,
const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<HardwareConfig>& /*config*/) {
rspInfo = info;
parent.notify();
return Void();
}
@ -763,63 +833,87 @@ Return<void> RadioResponse::setDataProfileResponse(const RadioResponseInfo& info
return Void();
}
Return<void> RadioResponse::requestShutdownResponse(const RadioResponseInfo& /*info*/) {
Return<void> RadioResponse::requestShutdownResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
return Void();
}
Return<void> RadioResponse::getRadioCapabilityResponse(
const RadioResponseInfo& /*info*/, const RadioCapability& /*rc*/) {
const RadioResponseInfo& info, const RadioCapability& /*rc*/) {
rspInfo = info;
parent.notify();
return Void();
}
Return<void> RadioResponse::setRadioCapabilityResponse(
const RadioResponseInfo& /*info*/, const RadioCapability& /*rc*/) {
const RadioResponseInfo& info, const RadioCapability& /*rc*/) {
rspInfo = info;
parent.notify();
return Void();
}
Return<void> RadioResponse::startLceServiceResponse(
const RadioResponseInfo& /*info*/, const LceStatusInfo& /*statusInfo*/) {
const RadioResponseInfo& info, const LceStatusInfo& /*statusInfo*/) {
rspInfo = info;
parent.notify();
return Void();
}
Return<void> RadioResponse::stopLceServiceResponse(
const RadioResponseInfo& /*info*/, const LceStatusInfo& /*statusInfo*/) {
const RadioResponseInfo& info, const LceStatusInfo& /*statusInfo*/) {
rspInfo = info;
parent.notify();
return Void();
}
Return<void> RadioResponse::pullLceDataResponse(
const RadioResponseInfo& /*info*/, const LceDataInfo& /*lceInfo*/) {
const RadioResponseInfo& info, const LceDataInfo& /*lceInfo*/) {
rspInfo = info;
parent.notify();
return Void();
}
Return<void> RadioResponse::getModemActivityInfoResponse(
const RadioResponseInfo& /*info*/, const ActivityStatsInfo& /*activityInfo*/) {
const RadioResponseInfo& info, const ActivityStatsInfo& /*activityInfo*/) {
rspInfo = info;
parent.notify();
return Void();
}
Return<void> RadioResponse::setAllowedCarriersResponse(
const RadioResponseInfo& /*info*/, int32_t /*numAllowed*/) {
const RadioResponseInfo& info, int32_t /*numAllowed*/) {
rspInfo = info;
parent.notify();
return Void();
}
Return<void> RadioResponse::getAllowedCarriersResponse(
const RadioResponseInfo& /*info*/, bool /*allAllowed*/,
const RadioResponseInfo& info, bool /*allAllowed*/,
const CarrierRestrictions& /*carriers*/) {
rspInfo = info;
parent.notify();
return Void();
}
Return<void> RadioResponse::sendDeviceStateResponse(
const RadioResponseInfo& /*info*/) {
const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
return Void();
}
Return<void> RadioResponse::setIndicationFilterResponse(
const RadioResponseInfo& /*info*/) {
const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
return Void();
}
Return<void> RadioResponse::setSimCardPowerResponse(
const RadioResponseInfo& /*info*/) {
const RadioResponseInfo& info) {
rspInfo = info;
parent.notify();
return Void();
}