srcs: ["radio_hidl_hal_test.cpp",
"radio_response.cpp",
"radio_hidl_hal_voice.cpp",
+ "radio_hidl_hal_cell_broadcast.cpp",
+ "radio_hidl_hal_data.cpp",
"radio_hidl_hal_icc.cpp",
+ "radio_hidl_hal_ims.cpp",
"radio_hidl_hal_sms.cpp",
+ "radio_hidl_hal_stk.cpp",
"VtsHalRadioV1_0TargetTest.cpp"],
shared_libs: [
"libbase",
--- /dev/null
+/*
+ * 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>
+
+using namespace ::android::hardware::radio::V1_0;
+
+/*
+ * Test IRadio.setGsmBroadcastConfig() for the response returned.
+ */
+TEST_F(RadioHidlTest, setGsmBroadcastConfig) {
+ int serial = 0;
+
+ // 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 #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 #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};
+
+ 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);
+
+ if (cardStatus.cardState == CardState::ABSENT) {
+ EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+ }
+}
+
+/*
+ * Test IRadio.getGsmBroadcastConfig() for the response returned.
+ */
+TEST_F(RadioHidlTest, getGsmBroadcastConfig) {
+ int serial = 0;
+
+ radio->getGsmBroadcastConfig(++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);
+ }
+}
+
+/*
+ * Test IRadio.setCdmaBroadcastConfig() for the response returned.
+ */
+TEST_F(RadioHidlTest, setCdmaBroadcastConfig) {
+ int serial = 0;
+
+ CdmaBroadcastSmsConfigInfo cbSmsConfig;
+ cbSmsConfig.serviceCategory = 4096;
+ cbSmsConfig.language = 1;
+ cbSmsConfig.selected = true;
+
+ android::hardware::hidl_vec<CdmaBroadcastSmsConfigInfo> cdmaBroadcastSmsConfigInfoList
+ = {cbSmsConfig};
+
+ 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);
+
+ if (cardStatus.cardState == CardState::ABSENT) {
+ EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+ }
+}
+
+/*
+ * Test IRadio.getCdmaBroadcastConfig() for the response returned.
+ */
+TEST_F(RadioHidlTest, getCdmaBroadcastConfig) {
+ int serial = 0;
+
+ radio->getCdmaBroadcastConfig(++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);
+ }
+}
+
+/*
+ * Test IRadio.setCdmaBroadcastActivation() for the response returned.
+ */
+TEST_F(RadioHidlTest, setCdmaBroadcastActivation) {
+ int serial = 0;
+ bool activate = false;
+
+ 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);
+
+ if (cardStatus.cardState == CardState::ABSENT) {
+ EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+ }
+}
+
+/*
+ * Test IRadio.setGsmBroadcastActivation() for the response returned.
+ */
+TEST_F(RadioHidlTest, setGsmBroadcastActivation) {
+ int serial = 0;
+ bool activate = false;
+
+ 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);
+
+ if (cardStatus.cardState == CardState::ABSENT) {
+ EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+ }
+}
--- /dev/null
+/*
+ * 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>
+
+using namespace ::android::hardware::radio::V1_0;
+
+/*
+ * Test IRadio.getDataRegistrationState() for the response returned.
+ */
+TEST_F(RadioHidlTest, getDataRegistrationState) {
+ int serial = 0;
+
+ radio->getDataRegistrationState(++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);
+ }
+}
+
+/*
+ * Test IRadio.setupDataCall() for the response returned.
+ */
+TEST_F(RadioHidlTest, setupDataCall) {
+ int serial = 0;
+
+ 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();
+
+ bool modemCognitive = false;
+ bool roamingAllowed = false;
+ bool isRoaming = false;
+
+ 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);
+
+ if (cardStatus.cardState == CardState::ABSENT) {
+ ASSERT_FALSE(RadioError::NONE == radioRsp->rspInfo.error);
+ }
+}
+
+/*
+ * Test IRadio.deactivateDataCall() for the response returned.
+ */
+TEST_F(RadioHidlTest, deactivateDataCall) {
+ int serial = 0;
+ int cid = 1;
+ bool reasonRadioShutDown = false;
+
+ 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);
+
+ if (cardStatus.cardState == CardState::ABSENT) {
+ EXPECT_EQ(RadioError::INVALID_ARGUMENTS, radioRsp->rspInfo.error);
+ }
+}
+
+/*
+ * Test IRadio.getDataCallList() for the response returned.
+ */
+TEST_F(RadioHidlTest, getDataCallList) {
+ int serial = 0;
+
+ radio->getDataCallList(++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);
+ }
+}
+
+/*
+ * Test IRadio.setInitialAttachApn() for the response returned.
+ */
+TEST_F(RadioHidlTest, setInitialAttachApn) {
+ int serial = 0;
+
+ 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;
+
+ 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);
+
+ if (cardStatus.cardState == CardState::ABSENT) {
+ ASSERT_FALSE(RadioError::NONE == radioRsp->rspInfo.error);
+ }
+}
+
+/*
+ * Test IRadio.setDataAllowed() for the response returned.
+ */
+TEST_F(RadioHidlTest, setDataAllowed) {
+ int serial = 0;
+ bool allow = true;
+
+ 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);
+
+ 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;
+
+ // 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};
+
+ bool isRoadming = false;
+
+ 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);
+
+ if (cardStatus.cardState == CardState::ABSENT) {
+ // TODO(shuoq): Will add error check when we know the expected error from QC
+ }
+}
+
--- /dev/null
+/*
+ * 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>
+
+using namespace ::android::hardware::radio::V1_0;
+
+/*
+ * Test IRadio.getClir() for the response returned.
+ */
+TEST_F(RadioHidlTest, getClir) {
+ int serial = 0;
+
+ radio->getClir(++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::MODEM_ERR
+ || radioRsp->rspInfo.error == RadioError::SYSTEM_ERR
+ || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+ }
+}
+
+/*
+ * Test IRadio.setClir() for the response returned.
+ */
+TEST_F(RadioHidlTest, setClir) {
+ int serial = 0;
+ int32_t status = 1;
+
+ 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);
+
+ 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 = "";
+
+ 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);
+
+ if (cardStatus.cardState == CardState::ABSENT) {
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
+ || radioRsp->rspInfo.error == RadioError::MODEM_ERR
+ || radioRsp->rspInfo.error == RadioError::SYSTEM_ERR
+ || radioRsp->rspInfo.error == RadioError::INTERNAL_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 = "";
+
+ 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);
+
+ if (cardStatus.cardState == CardState::ABSENT) {
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
+ || radioRsp->rspInfo.error == RadioError::MODEM_ERR
+ || radioRsp->rspInfo.error == RadioError::SYSTEM_ERR
+ || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+ }
+}
+
+/*
+ * Test IRadio.setBarringPassword() for the response returned.
+ */
+TEST_F(RadioHidlTest, setBarringPassword) {
+ int serial = 0;
+ std::string facility = "";
+ std::string oldPassword = "";
+ std::string 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);
+
+ if (cardStatus.cardState == CardState::ABSENT) {
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
+ || radioRsp->rspInfo.error == RadioError::MODEM_ERR
+ || radioRsp->rspInfo.error == RadioError::SYSTEM_ERR
+ || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+ }
+}
+
+/*
+ * Test IRadio.getClip() for the response returned.
+ */
+TEST_F(RadioHidlTest, getClip) {
+ int serial = 0;
+
+ radio->getClip(++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::MODEM_ERR
+ || radioRsp->rspInfo.error == RadioError::SYSTEM_ERR
+ || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+ }
+}
+
+/*
+ * Test IRadio.setSuppServiceNotifications() for the response returned.
+ */
+TEST_F(RadioHidlTest, setSuppServiceNotifications) {
+ int serial = 0;
+ bool enable = false;
+
+ 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);
+
+ 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 = "";
+
+ 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);
+
+ if (cardStatus.cardState == CardState::ABSENT) {
+ EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+ }
+}
+
+/*
+ * Test IRadio.getImsRegistrationState() for the response returned.
+ */
+TEST_F(RadioHidlTest, getImsRegistrationState) {
+ int serial = 0;
+
+ radio->getImsRegistrationState(++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);
+ }
+}
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
- EXPECT_EQ(RadioError::INVALID_STATE, radioRsp->rspInfo.error);
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
+ || radioRsp->rspInfo.error == RadioError::MODEM_ERR
+ || radioRsp->rspInfo.error == RadioError::SYSTEM_ERR
+ || radioRsp->rspInfo.error == RadioError::INVALID_STATE);
EXPECT_EQ(0, radioRsp->sendSmsResult.errorCode);
- } else {
- EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
- EXPECT_EQ("", radioRsp->sendSmsResult.ackPDU);
- EXPECT_EQ(-1, radioRsp->sendSmsResult.errorCode);
}
}
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
- EXPECT_EQ(RadioError::INVALID_STATE, radioRsp->rspInfo.error);
- } else {
- EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
- EXPECT_EQ("", radioRsp->sendSmsResult.ackPDU);
- EXPECT_EQ(-1, radioRsp->sendSmsResult.errorCode);
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
+ || radioRsp->rspInfo.error == RadioError::MODEM_ERR
+ || radioRsp->rspInfo.error == RadioError::SYSTEM_ERR
+ || radioRsp->rspInfo.error == RadioError::INVALID_STATE);
}
}
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
- EXPECT_EQ(RadioError::INVALID_STATE, radioRsp->rspInfo.error);
- } else {
- // TODO(shuoq): Will test right behavior when inserted sim card is considered
+ EXPECT_EQ(RadioError::INVALID_ARGUMENTS, radioRsp->rspInfo.error);
}
}
if (cardStatus.cardState == CardState::ABSENT) {
// TODO(shuoq): Will add error check when we know the expected error from QC
- } else {
- // TODO(shuoq): Will test right behavior when inserted sim card is considered
}
}
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
- } else {
- // TODO(shuoq): radioRsp->sendSmsResult needs to be investigated when Sim card is in
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
+ || radioRsp->rspInfo.error == RadioError::MODEM_ERR
+ || radioRsp->rspInfo.error == RadioError::SYSTEM_ERR
+ || radioRsp->rspInfo.error == RadioError::INVALID_STATE);
}
}
if (cardStatus.cardState == CardState::ABSENT) {
EXPECT_EQ(RadioError::NO_SMS_TO_ACK, radioRsp->rspInfo.error);
- } else {
- EXPECT_EQ(RadioError::NO_SMS_TO_ACK, radioRsp->rspInfo.error);
}
}
if (cardStatus.cardState == CardState::ABSENT) {
EXPECT_EQ(RadioError::INVALID_ARGUMENTS, radioRsp->rspInfo.error);
- } else {
- EXPECT_EQ(RadioError::INVALID_ARGUMENTS, radioRsp->rspInfo.error);
- // TODO(shuoq): radioRsp->sendSmsResult needs to be investigated when sim card is in
}
}
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
- } else {
- EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
- // TODO(shuoq): radioRsp->smscAddress needs to be investigated when Sim card is in
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
+ || radioRsp->rspInfo.error == RadioError::MODEM_ERR
+ || radioRsp->rspInfo.error == RadioError::SYSTEM_ERR
+ || radioRsp->rspInfo.error == RadioError::INVALID_STATE
+ || radioRsp->rspInfo.error == RadioError::INVALID_MODEM_STATE);
}
}
if (cardStatus.cardState == CardState::ABSENT) {
EXPECT_EQ(RadioError::INVALID_SMS_FORMAT, radioRsp->rspInfo.error);
- } else {
- EXPECT_EQ(RadioError::INVALID_SMS_FORMAT, radioRsp->rspInfo.error);
}
}
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
- } else {
- // TODO(shuoq): radioRsp->writeSmsToSimIndex needs to be investigated when Sim card is in
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
+ || radioRsp->rspInfo.error == RadioError::MODEM_ERR
+ || radioRsp->rspInfo.error == RadioError::INVALID_MODEM_STATE
+ || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
}
}
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
- } else {
- EXPECT_EQ(RadioError::NO_SUCH_ENTRY, radioRsp->rspInfo.error);
+ EXPECT_EQ(RadioError::INVALID_SMS_FORMAT, radioRsp->rspInfo.error);
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
+ || radioRsp->rspInfo.error == RadioError::MODEM_ERR
+ || radioRsp->rspInfo.error == RadioError::SYSTEM_ERR);
}
}
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
- } else {
- // TODO(shuoq): radioRsp->writeSmsToRuimIndex needs to be investigated when sim card is in
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
+ || radioRsp->rspInfo.error == RadioError::MODEM_ERR
+ || radioRsp->rspInfo.error == RadioError::INVALID_MODEM_STATE
+ || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
}
}
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
- } else {
- // TODO(shuoq): Will test right behavior when inserted sim card is considered
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
+ || radioRsp->rspInfo.error == RadioError::MODEM_ERR
+ || radioRsp->rspInfo.error == RadioError::SYSTEM_ERR);
}
}
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
- } else {
- EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
+ || radioRsp->rspInfo.error == RadioError::MODEM_ERR
+ || radioRsp->rspInfo.error == RadioError::SYSTEM_ERR
+ || radioRsp->rspInfo.error == RadioError::INVALID_STATE);
}
}
--- /dev/null
+/*
+ * 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>
+
+using namespace ::android::hardware::radio::V1_0;
+
+/*
+ * Test IRadio.sendEnvelope() for the response returned.
+ */
+TEST_F(RadioHidlTest, sendEnvelope) {
+ int serial = 0;
+
+ // Test with sending empty string
+ std::string 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);
+
+ if (cardStatus.cardState == CardState::ABSENT) {
+ EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+ }
+
+ // Test with sending random string
+ content = "0";
+
+ 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);
+
+ 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;
+
+ // Test with sending empty string
+ std::string 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);
+
+ if (cardStatus.cardState == CardState::ABSENT) {
+ EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+ }
+
+ // Test with sending random string
+ commandResponse = "0";
+
+ 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);
+
+ 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;
+
+ 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);
+
+ if (cardStatus.cardState == CardState::ABSENT) {
+ EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+ }
+}
+
+/*
+ * Test IRadio.reportStkServiceIsRunning() for the response returned.
+ */
+TEST_F(RadioHidlTest, reportStkServiceIsRunning) {
+ int serial = 0;
+
+ radio->reportStkServiceIsRunning(++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);
+ }
+}
+
+/*
+ * Test IRadio.sendEnvelopeWithStatus() for the response returned with empty string.
+ */
+TEST_F(RadioHidlTest, sendEnvelopeWithStatus) {
+ int serial = 0;
+
+ // Test with sending empty string
+ std::string 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);
+
+ if (cardStatus.cardState == CardState::ABSENT) {
+ EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+ }
+
+ // Test with sending random string
+ contents = "0";
+
+ 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);
+
+ if (cardStatus.cardState == CardState::ABSENT) {
+ ASSERT_FALSE(RadioError::NONE == radioRsp->rspInfo.error);
+ }
+}
}
Return<void> RadioResponse::getDataRegistrationStateResponse(
- const RadioResponseInfo& /*info*/, const DataRegStateResult& /*dataRegResponse*/) {
+ const RadioResponseInfo& info, const DataRegStateResult& /*dataRegResponse*/) {
+ rspInfo = info;
+ parent.notify();
return Void();
}
}
Return<void> RadioResponse::setupDataCallResponse(
- const RadioResponseInfo& /*info*/, const SetupDataCallResult& /*dcResponse*/) {
+ const RadioResponseInfo& info, const SetupDataCallResult& /*dcResponse*/) {
+ rspInfo = info;
+ parent.notify();
return Void();
}
return Void();
}
-Return<void> RadioResponse::getClirResponse(const RadioResponseInfo& /*info*/, int32_t /*n*/,
+Return<void> RadioResponse::getClirResponse(const RadioResponseInfo& info, int32_t /*n*/,
int32_t /*m*/) {
+ rspInfo = info;
+ parent.notify();
return Void();
}
-Return<void> RadioResponse::setClirResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse::setClirResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent.notify();
return Void();
}
return Void();
}
-Return<void> RadioResponse::deactivateDataCallResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse::deactivateDataCallResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent.notify();
return Void();
}
-Return<void> RadioResponse::getFacilityLockForAppResponse(const RadioResponseInfo& /*info*/,
+Return<void> RadioResponse::getFacilityLockForAppResponse(const RadioResponseInfo& info,
int32_t /*response*/) {
+ rspInfo = info;
+ parent.notify();
return Void();
}
-Return<void> RadioResponse::setFacilityLockForAppResponse(const RadioResponseInfo& /*info*/,
+Return<void> RadioResponse::setFacilityLockForAppResponse(const RadioResponseInfo& info,
int32_t /*retry*/) {
+ rspInfo = info;
+ parent.notify();
return Void();
}
-Return<void> RadioResponse::setBarringPasswordResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse::setBarringPasswordResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent.notify();
return Void();
}
return Void();
}
-Return<void> RadioResponse::getClipResponse(const RadioResponseInfo& /*info*/,
+Return<void> RadioResponse::getClipResponse(const RadioResponseInfo& info,
ClipStatus /*status*/) {
+ rspInfo = info;
+ parent.notify();
return Void();
}
Return<void> RadioResponse::getDataCallListResponse(
- const RadioResponseInfo& /*info*/,
+ const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<SetupDataCallResult>& /*dcResponse*/) {
+ rspInfo = info;
+ parent.notify();
return Void();
}
}
Return<void> RadioResponse::setSuppServiceNotificationsResponse(
- const RadioResponseInfo& /*info*/) {
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent.notify();
return Void();
}
return Void();
}
-Return<void> RadioResponse::sendEnvelopeResponse(const RadioResponseInfo& /*info*/,
+Return<void> RadioResponse::sendEnvelopeResponse(const RadioResponseInfo& info,
const ::android::hardware::hidl_string& /*commandResponse*/) {
+ rspInfo = info;
+ parent.notify();
return Void();
}
-Return<void> RadioResponse::sendTerminalResponseToSimResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse::sendTerminalResponseToSimResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent.notify();
return Void();
}
Return<void> RadioResponse::handleStkCallSetupRequestFromSimResponse(
- const RadioResponseInfo& /*info*/) {
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent.notify();
return Void();
}
}
Return<void> RadioResponse::getGsmBroadcastConfigResponse(
- const RadioResponseInfo& /*info*/,
+ const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<GsmBroadcastSmsConfigInfo>& /*configs*/) {
+ rspInfo = info;
+ parent.notify();
return Void();
}
-Return<void> RadioResponse::setGsmBroadcastConfigResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse::setGsmBroadcastConfigResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent.notify();
return Void();
}
-Return<void> RadioResponse::setGsmBroadcastActivationResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse::setGsmBroadcastActivationResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent.notify();
return Void();
}
Return<void> RadioResponse::getCdmaBroadcastConfigResponse(
- const RadioResponseInfo& /*info*/,
+ const RadioResponseInfo& info,
const ::android::hardware::hidl_vec<CdmaBroadcastSmsConfigInfo>& /*configs*/) {
+ rspInfo = info;
+ parent.notify();
return Void();
}
-Return<void> RadioResponse::setCdmaBroadcastConfigResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse::setCdmaBroadcastConfigResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent.notify();
return Void();
}
-Return<void> RadioResponse::setCdmaBroadcastActivationResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse::setCdmaBroadcastActivationResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent.notify();
return Void();
}
return Void();
}
-Return<void> RadioResponse::reportStkServiceIsRunningResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse::reportStkServiceIsRunningResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent.notify();
return Void();
}
}
Return<void> RadioResponse::requestIsimAuthenticationResponse(
- const RadioResponseInfo& /*info*/, const ::android::hardware::hidl_string& /*response*/) {
+ const RadioResponseInfo& info, const ::android::hardware::hidl_string& /*response*/) {
+ rspInfo = info;
+ parent.notify();
return Void();
}
}
Return<void> RadioResponse::sendEnvelopeWithStatusResponse(
- const RadioResponseInfo& /*info*/, const IccIoResult& /*iccIo*/) {
+ const RadioResponseInfo& info, const IccIoResult& /*iccIo*/) {
+ rspInfo = info;
+ parent.notify();
return Void();
}
return Void();
}
-Return<void> RadioResponse::setInitialAttachApnResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse::setInitialAttachApnResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent.notify();
return Void();
}
Return<void> RadioResponse::getImsRegistrationStateResponse(
- const RadioResponseInfo& /*info*/, bool /*isRegistered*/,
+ const RadioResponseInfo& info, bool /*isRegistered*/,
RadioTechnologyFamily /*ratFamily*/) {
+ rspInfo = info;
+ parent.notify();
return Void();
}
return Void();
}
-Return<void> RadioResponse::setDataAllowedResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse::setDataAllowedResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent.notify();
return Void();
}
return Void();
}
-Return<void> RadioResponse::setDataProfileResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse::setDataProfileResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent.notify();
return Void();
}