Sarah Chin | d2a4119 | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2021 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include <aidl/android/hardware/radio/config/IRadioConfig.h> |
Sarah Chin | c9d3b7b | 2021-12-23 16:41:58 -0800 | [diff] [blame] | 18 | #include <aidl/android/hardware/radio/voice/EmergencyServiceCategory.h> |
Sarah Chin | d2a4119 | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 19 | #include <android/binder_manager.h> |
| 20 | |
| 21 | #include "radio_voice_utils.h" |
| 22 | |
| 23 | #define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk()) |
| 24 | |
| 25 | void RadioVoiceTest::SetUp() { |
Sarah Chin | a1efe7a | 2023-05-02 21:11:41 -0700 | [diff] [blame^] | 26 | RadioServiceTest::SetUp(); |
Sarah Chin | d2a4119 | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 27 | std::string serviceName = GetParam(); |
| 28 | |
| 29 | if (!isServiceValidForDeviceConfiguration(serviceName)) { |
| 30 | ALOGI("Skipped the test due to device configuration."); |
| 31 | GTEST_SKIP(); |
| 32 | } |
| 33 | |
| 34 | radio_voice = IRadioVoice::fromBinder( |
| 35 | ndk::SpAIBinder(AServiceManager_waitForService(GetParam().c_str()))); |
| 36 | ASSERT_NE(nullptr, radio_voice.get()); |
| 37 | |
| 38 | radioRsp_voice = ndk::SharedRefBase::make<RadioVoiceResponse>(*this); |
| 39 | ASSERT_NE(nullptr, radioRsp_voice.get()); |
| 40 | |
Sarah Chin | d2a4119 | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 41 | radioInd_voice = ndk::SharedRefBase::make<RadioVoiceIndication>(*this); |
| 42 | ASSERT_NE(nullptr, radioInd_voice.get()); |
| 43 | |
| 44 | radio_voice->setResponseFunctions(radioRsp_voice, radioInd_voice); |
| 45 | |
Sarah Chin | 91997ac | 2021-12-29 00:35:12 -0800 | [diff] [blame] | 46 | // Assert IRadioSim exists and SIM is present before testing |
| 47 | radio_sim = sim::IRadioSim::fromBinder(ndk::SpAIBinder( |
| 48 | AServiceManager_waitForService("android.hardware.radio.sim.IRadioSim/slot1"))); |
| 49 | ASSERT_NE(nullptr, radio_sim.get()); |
| 50 | updateSimCardStatus(); |
| 51 | EXPECT_EQ(CardStatus::STATE_PRESENT, cardStatus.cardState); |
| 52 | |
Sarah Chin | d2a4119 | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 53 | // Assert IRadioConfig exists before testing |
Sarah Chin | 91997ac | 2021-12-29 00:35:12 -0800 | [diff] [blame] | 54 | radio_config = config::IRadioConfig::fromBinder(ndk::SpAIBinder( |
| 55 | AServiceManager_waitForService("android.hardware.radio.config.IRadioConfig/default"))); |
| 56 | ASSERT_NE(nullptr, radio_config.get()); |
| 57 | |
| 58 | if (isDsDsEnabled() || isTsTsEnabled()) { |
| 59 | radio_network = IRadioNetwork::fromBinder(ndk::SpAIBinder(AServiceManager_waitForService( |
| 60 | "android.hardware.radio.network.IRadioNetwork/slot1"))); |
| 61 | ASSERT_NE(nullptr, radio_network.get()); |
| 62 | radioRsp_network = ndk::SharedRefBase::make<RadioNetworkResponse>(*this); |
| 63 | radioInd_network = ndk::SharedRefBase::make<RadioNetworkIndication>(*this); |
| 64 | radio_network->setResponseFunctions(radioRsp_network, radioInd_network); |
| 65 | } |
Sarah Chin | d2a4119 | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 66 | } |
| 67 | |
| 68 | ndk::ScopedAStatus RadioVoiceTest::clearPotentialEstablishedCalls() { |
| 69 | // Get the current call Id to hangup the established emergency call. |
| 70 | serial = GetRandomSerialNumber(); |
| 71 | radio_voice->getCurrentCalls(serial); |
| 72 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 73 | |
| 74 | // Hang up to disconnect the established call channels. |
| 75 | for (const Call& call : radioRsp_voice->currentCalls) { |
| 76 | serial = GetRandomSerialNumber(); |
| 77 | radio_voice->hangup(serial, call.index); |
| 78 | ALOGI("Hang up to disconnect the established call channel: %d", call.index); |
| 79 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 80 | // Give some time for modem to disconnect the established call channel. |
| 81 | sleep(MODEM_EMERGENCY_CALL_DISCONNECT_TIME); |
| 82 | } |
| 83 | |
| 84 | // Verify there are no more current calls. |
| 85 | serial = GetRandomSerialNumber(); |
| 86 | radio_voice->getCurrentCalls(serial); |
| 87 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 88 | EXPECT_EQ(0, radioRsp_voice->currentCalls.size()); |
| 89 | return ndk::ScopedAStatus::ok(); |
| 90 | } |
| 91 | |
| 92 | /* |
| 93 | * Test IRadioVoice.emergencyDial() for the response returned. |
| 94 | */ |
| 95 | TEST_P(RadioVoiceTest, emergencyDial) { |
| 96 | if (!deviceSupportsFeature(FEATURE_VOICE_CALL)) { |
| 97 | ALOGI("Skipping emergencyDial because voice call is not supported in device"); |
| 98 | return; |
| 99 | } else if (!deviceSupportsFeature(FEATURE_TELEPHONY_GSM) && |
| 100 | !deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) { |
| 101 | ALOGI("Skipping emergencyDial because gsm/cdma radio is not supported in device"); |
| 102 | return; |
| 103 | } else { |
| 104 | ALOGI("Running emergencyDial because voice call is supported in device"); |
| 105 | } |
| 106 | |
| 107 | serial = GetRandomSerialNumber(); |
| 108 | |
| 109 | Dial dialInfo; |
| 110 | dialInfo.address = std::string("911"); |
Sarah Chin | c9d3b7b | 2021-12-23 16:41:58 -0800 | [diff] [blame] | 111 | int32_t categories = static_cast<int32_t>(EmergencyServiceCategory::UNSPECIFIED); |
Sarah Chin | d2a4119 | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 112 | std::vector<std::string> urns = {""}; |
| 113 | EmergencyCallRouting routing = EmergencyCallRouting::UNKNOWN; |
| 114 | |
| 115 | ndk::ScopedAStatus res = |
| 116 | radio_voice->emergencyDial(serial, dialInfo, categories, urns, routing, true, true); |
| 117 | ASSERT_OK(res); |
| 118 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 119 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 120 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 121 | |
| 122 | ALOGI("emergencyDial, rspInfo.error = %s\n", toString(radioRsp_voice->rspInfo.error).c_str()); |
| 123 | |
| 124 | RadioError rspEmergencyDial = radioRsp_voice->rspInfo.error; |
| 125 | // In DSDS or TSTS, we only check the result if the current slot is IN_SERVICE |
| 126 | // or Emergency_Only. |
| 127 | if (isDsDsEnabled() || isTsTsEnabled()) { |
Sarah Chin | d2a4119 | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 128 | serial = GetRandomSerialNumber(); |
Sarah Chin | 91997ac | 2021-12-29 00:35:12 -0800 | [diff] [blame] | 129 | radio_network->getVoiceRegistrationState(serial); |
Sarah Chin | d2a4119 | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 130 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
Sarah Chin | 91997ac | 2021-12-29 00:35:12 -0800 | [diff] [blame] | 131 | if (isVoiceEmergencyOnly(radioRsp_network->voiceRegResp.regState) || |
| 132 | isVoiceInService(radioRsp_network->voiceRegResp.regState)) { |
Sarah Chin | d2a4119 | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 133 | EXPECT_EQ(RadioError::NONE, rspEmergencyDial); |
| 134 | } |
Sarah Chin | d2a4119 | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 135 | } else { |
| 136 | EXPECT_EQ(RadioError::NONE, rspEmergencyDial); |
| 137 | } |
| 138 | |
| 139 | // Give some time for modem to establish the emergency call channel. |
| 140 | sleep(MODEM_EMERGENCY_CALL_ESTABLISH_TIME); |
| 141 | |
| 142 | // Disconnect all the potential established calls to prevent them affecting other tests. |
| 143 | clearPotentialEstablishedCalls(); |
| 144 | } |
| 145 | |
| 146 | /* |
| 147 | * Test IRadioVoice.emergencyDial() with specified service and its response returned. |
| 148 | */ |
| 149 | TEST_P(RadioVoiceTest, emergencyDial_withServices) { |
| 150 | if (!deviceSupportsFeature(FEATURE_VOICE_CALL)) { |
| 151 | ALOGI("Skipping emergencyDial because voice call is not supported in device"); |
| 152 | return; |
| 153 | } else if (!deviceSupportsFeature(FEATURE_TELEPHONY_GSM) && |
| 154 | !deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) { |
| 155 | ALOGI("Skipping emergencyDial because gsm/cdma radio is not supported in device"); |
| 156 | return; |
| 157 | } else { |
| 158 | ALOGI("Running emergencyDial because voice call is supported in device"); |
| 159 | } |
| 160 | |
| 161 | serial = GetRandomSerialNumber(); |
| 162 | |
| 163 | Dial dialInfo; |
| 164 | dialInfo.address = std::string("911"); |
Sarah Chin | c9d3b7b | 2021-12-23 16:41:58 -0800 | [diff] [blame] | 165 | int32_t categories = static_cast<int32_t>(EmergencyServiceCategory::AMBULANCE); |
Sarah Chin | d2a4119 | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 166 | std::vector<std::string> urns = {"urn:service:sos.ambulance"}; |
| 167 | EmergencyCallRouting routing = EmergencyCallRouting::UNKNOWN; |
| 168 | |
| 169 | ndk::ScopedAStatus res = |
| 170 | radio_voice->emergencyDial(serial, dialInfo, categories, urns, routing, true, true); |
| 171 | ASSERT_OK(res); |
| 172 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 173 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 174 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 175 | |
| 176 | ALOGI("emergencyDial_withServices, rspInfo.error = %s\n", |
| 177 | toString(radioRsp_voice->rspInfo.error).c_str()); |
| 178 | RadioError rspEmergencyDial = radioRsp_voice->rspInfo.error; |
| 179 | |
| 180 | // In DSDS or TSTS, we only check the result if the current slot is IN_SERVICE |
| 181 | // or Emergency_Only. |
| 182 | if (isDsDsEnabled() || isTsTsEnabled()) { |
Sarah Chin | d2a4119 | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 183 | serial = GetRandomSerialNumber(); |
Sarah Chin | 91997ac | 2021-12-29 00:35:12 -0800 | [diff] [blame] | 184 | radio_network->getVoiceRegistrationState(serial); |
Sarah Chin | d2a4119 | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 185 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
Sarah Chin | 91997ac | 2021-12-29 00:35:12 -0800 | [diff] [blame] | 186 | if (isVoiceEmergencyOnly(radioRsp_network->voiceRegResp.regState) || |
| 187 | isVoiceInService(radioRsp_network->voiceRegResp.regState)) { |
Sarah Chin | d2a4119 | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 188 | EXPECT_EQ(RadioError::NONE, rspEmergencyDial); |
| 189 | } |
Sarah Chin | d2a4119 | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 190 | } else { |
| 191 | EXPECT_EQ(RadioError::NONE, rspEmergencyDial); |
| 192 | } |
| 193 | // Give some time for modem to establish the emergency call channel. |
| 194 | sleep(MODEM_EMERGENCY_CALL_ESTABLISH_TIME); |
| 195 | |
| 196 | // Disconnect all the potential established calls to prevent them affecting other tests. |
| 197 | clearPotentialEstablishedCalls(); |
| 198 | } |
| 199 | |
| 200 | /* |
| 201 | * Test IRadioVoice.emergencyDial() with known emergency call routing and its response returned. |
| 202 | */ |
| 203 | TEST_P(RadioVoiceTest, emergencyDial_withEmergencyRouting) { |
| 204 | if (!deviceSupportsFeature(FEATURE_VOICE_CALL)) { |
| 205 | ALOGI("Skipping emergencyDial because voice call is not supported in device"); |
| 206 | return; |
| 207 | } else if (!deviceSupportsFeature(FEATURE_TELEPHONY_GSM) && |
| 208 | !deviceSupportsFeature(FEATURE_TELEPHONY_CDMA)) { |
| 209 | ALOGI("Skipping emergencyDial because gsm/cdma radio is not supported in device"); |
| 210 | return; |
| 211 | } else { |
| 212 | ALOGI("Running emergencyDial because voice call is supported in device"); |
| 213 | } |
| 214 | |
| 215 | serial = GetRandomSerialNumber(); |
| 216 | |
| 217 | Dial dialInfo; |
| 218 | dialInfo.address = std::string("911"); |
Sarah Chin | c9d3b7b | 2021-12-23 16:41:58 -0800 | [diff] [blame] | 219 | int32_t categories = static_cast<int32_t>(EmergencyServiceCategory::UNSPECIFIED); |
Sarah Chin | d2a4119 | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 220 | std::vector<std::string> urns = {""}; |
| 221 | EmergencyCallRouting routing = EmergencyCallRouting::EMERGENCY; |
| 222 | |
| 223 | ndk::ScopedAStatus res = |
| 224 | radio_voice->emergencyDial(serial, dialInfo, categories, urns, routing, true, true); |
| 225 | ASSERT_OK(res); |
| 226 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 227 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 228 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 229 | |
| 230 | ALOGI("emergencyDial_withEmergencyRouting, rspInfo.error = %s\n", |
| 231 | toString(radioRsp_voice->rspInfo.error).c_str()); |
| 232 | RadioError rspEmergencyDial = radioRsp_voice->rspInfo.error; |
| 233 | |
| 234 | // In DSDS or TSTS, we only check the result if the current slot is IN_SERVICE |
| 235 | // or Emergency_Only. |
| 236 | if (isDsDsEnabled() || isTsTsEnabled()) { |
Sarah Chin | d2a4119 | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 237 | serial = GetRandomSerialNumber(); |
Sarah Chin | 91997ac | 2021-12-29 00:35:12 -0800 | [diff] [blame] | 238 | radio_network->getVoiceRegistrationState(serial); |
Sarah Chin | d2a4119 | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 239 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
Sarah Chin | 91997ac | 2021-12-29 00:35:12 -0800 | [diff] [blame] | 240 | if (isVoiceEmergencyOnly(radioRsp_network->voiceRegResp.regState) || |
| 241 | isVoiceInService(radioRsp_network->voiceRegResp.regState)) { |
Sarah Chin | d2a4119 | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 242 | EXPECT_EQ(RadioError::NONE, rspEmergencyDial); |
| 243 | } |
Sarah Chin | d2a4119 | 2021-12-21 11:34:00 -0800 | [diff] [blame] | 244 | } else { |
| 245 | EXPECT_EQ(RadioError::NONE, rspEmergencyDial); |
| 246 | } |
| 247 | |
| 248 | // Give some time for modem to establish the emergency call channel. |
| 249 | sleep(MODEM_EMERGENCY_CALL_ESTABLISH_TIME); |
| 250 | |
| 251 | // Disconnect all the potential established calls to prevent them affecting other tests. |
| 252 | clearPotentialEstablishedCalls(); |
| 253 | } |
| 254 | |
| 255 | /* |
| 256 | * Test IRadioVoice.getCurrentCalls() for the response returned. |
| 257 | */ |
| 258 | TEST_P(RadioVoiceTest, getCurrentCalls) { |
| 259 | serial = GetRandomSerialNumber(); |
| 260 | radio_voice->getCurrentCalls(serial); |
| 261 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 262 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 263 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 264 | EXPECT_EQ(RadioError::NONE, radioRsp_voice->rspInfo.error); |
| 265 | } |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 266 | |
| 267 | /* |
| 268 | * Test IRadioVoice.getClir() for the response returned. |
| 269 | */ |
| 270 | TEST_P(RadioVoiceTest, getClir) { |
| 271 | serial = GetRandomSerialNumber(); |
| 272 | |
| 273 | radio_voice->getClir(serial); |
| 274 | |
| 275 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 276 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 277 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 278 | |
| 279 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 280 | ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error, {RadioError::MODEM_ERR}, |
| 281 | CHECK_GENERAL_ERROR)); |
| 282 | } |
| 283 | } |
| 284 | |
| 285 | /* |
| 286 | * Test IRadioVoice.setClir() for the response returned. |
| 287 | */ |
| 288 | TEST_P(RadioVoiceTest, setClir) { |
| 289 | serial = GetRandomSerialNumber(); |
| 290 | int32_t status = 1; |
| 291 | |
| 292 | radio_voice->setClir(serial, status); |
| 293 | |
| 294 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 295 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 296 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 297 | |
| 298 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 299 | EXPECT_EQ(RadioError::NONE, radioRsp_voice->rspInfo.error); |
| 300 | } |
| 301 | } |
| 302 | |
| 303 | /* |
| 304 | * Test IRadioVoice.getClip() for the response returned. |
| 305 | */ |
| 306 | TEST_P(RadioVoiceTest, getClip) { |
| 307 | serial = GetRandomSerialNumber(); |
| 308 | |
| 309 | radio_voice->getClip(serial); |
| 310 | |
| 311 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 312 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 313 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 314 | |
| 315 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 316 | ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error, {RadioError::MODEM_ERR}, |
| 317 | CHECK_GENERAL_ERROR)); |
| 318 | } |
| 319 | } |
| 320 | |
| 321 | /* |
| 322 | * Test IRadioVoice.getTtyMode() for the response returned. |
| 323 | */ |
| 324 | TEST_P(RadioVoiceTest, getTtyMode) { |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 325 | serial = GetRandomSerialNumber(); |
| 326 | |
| 327 | radio_voice->getTtyMode(serial); |
| 328 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 329 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 330 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 331 | |
| 332 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 333 | EXPECT_EQ(RadioError::NONE, radioRsp_voice->rspInfo.error); |
| 334 | } |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 335 | } |
| 336 | |
| 337 | /* |
| 338 | * Test IRadioVoice.setTtyMode() for the response returned. |
| 339 | */ |
| 340 | TEST_P(RadioVoiceTest, setTtyMode) { |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 341 | serial = GetRandomSerialNumber(); |
| 342 | |
| 343 | radio_voice->setTtyMode(serial, TtyMode::OFF); |
| 344 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 345 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 346 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 347 | |
| 348 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 349 | EXPECT_EQ(RadioError::NONE, radioRsp_voice->rspInfo.error); |
| 350 | } |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 351 | } |
| 352 | |
| 353 | /* |
| 354 | * Test IRadioVoice.setPreferredVoicePrivacy() for the response returned. |
| 355 | */ |
| 356 | TEST_P(RadioVoiceTest, setPreferredVoicePrivacy) { |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 357 | serial = GetRandomSerialNumber(); |
| 358 | |
| 359 | radio_voice->setPreferredVoicePrivacy(serial, true); |
| 360 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 361 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 362 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 363 | |
| 364 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 365 | ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error, |
| 366 | {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED})); |
| 367 | } |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 368 | } |
| 369 | |
| 370 | /* |
| 371 | * Test IRadioVoice.getPreferredVoicePrivacy() for the response returned. |
| 372 | */ |
| 373 | TEST_P(RadioVoiceTest, getPreferredVoicePrivacy) { |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 374 | serial = GetRandomSerialNumber(); |
| 375 | |
| 376 | radio_voice->getPreferredVoicePrivacy(serial); |
| 377 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 378 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 379 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 380 | |
| 381 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 382 | ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error, |
| 383 | {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED})); |
| 384 | } |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 385 | } |
| 386 | |
| 387 | /* |
| 388 | * Test IRadioVoice.exitEmergencyCallbackMode() for the response returned. |
| 389 | */ |
| 390 | TEST_P(RadioVoiceTest, exitEmergencyCallbackMode) { |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 391 | serial = GetRandomSerialNumber(); |
| 392 | |
| 393 | radio_voice->exitEmergencyCallbackMode(serial); |
| 394 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 395 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 396 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 397 | |
| 398 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 399 | ASSERT_TRUE(CheckAnyOfErrors( |
| 400 | radioRsp_voice->rspInfo.error, |
| 401 | {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::SIM_ABSENT})); |
| 402 | } |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 403 | } |
| 404 | |
| 405 | /* |
| 406 | * Test IRadioVoice.handleStkCallSetupRequestFromSim() for the response returned. |
| 407 | */ |
| 408 | TEST_P(RadioVoiceTest, handleStkCallSetupRequestFromSim) { |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 409 | serial = GetRandomSerialNumber(); |
| 410 | bool accept = false; |
| 411 | |
| 412 | radio_voice->handleStkCallSetupRequestFromSim(serial, accept); |
| 413 | |
| 414 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 415 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 416 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 417 | |
| 418 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 419 | ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error, |
| 420 | {RadioError::NONE, RadioError::INVALID_ARGUMENTS, |
| 421 | RadioError::MODEM_ERR, RadioError::SIM_ABSENT}, |
| 422 | CHECK_GENERAL_ERROR)); |
| 423 | } |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 424 | } |
| 425 | |
| 426 | /* |
| 427 | * Test IRadioVoice.dial() for the response returned. |
| 428 | */ |
| 429 | TEST_P(RadioVoiceTest, dial) { |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 430 | serial = GetRandomSerialNumber(); |
| 431 | |
| 432 | Dial dialInfo; |
| 433 | memset(&dialInfo, 0, sizeof(dialInfo)); |
| 434 | dialInfo.address = std::string("123456789"); |
| 435 | |
| 436 | radio_voice->dial(serial, dialInfo); |
| 437 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 438 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 439 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 440 | |
| 441 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 442 | ASSERT_TRUE(CheckAnyOfErrors( |
| 443 | radioRsp_voice->rspInfo.error, |
| 444 | {RadioError::CANCELLED, RadioError::DEVICE_IN_USE, RadioError::FDN_CHECK_FAILURE, |
| 445 | RadioError::INVALID_ARGUMENTS, RadioError::INVALID_CALL_ID, |
| 446 | RadioError::INVALID_MODEM_STATE, RadioError::INVALID_STATE, RadioError::MODEM_ERR, |
| 447 | RadioError::NO_NETWORK_FOUND, RadioError::NO_SUBSCRIPTION, |
| 448 | RadioError::OPERATION_NOT_ALLOWED}, |
| 449 | CHECK_GENERAL_ERROR)); |
| 450 | } |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 451 | } |
| 452 | |
| 453 | /* |
| 454 | * Test IRadioVoice.hangup() for the response returned. |
| 455 | */ |
| 456 | TEST_P(RadioVoiceTest, hangup) { |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 457 | serial = GetRandomSerialNumber(); |
| 458 | |
| 459 | radio_voice->hangup(serial, 1); |
| 460 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 461 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 462 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 463 | |
| 464 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 465 | ASSERT_TRUE(CheckAnyOfErrors( |
| 466 | radioRsp_voice->rspInfo.error, |
| 467 | {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR}, |
| 468 | CHECK_GENERAL_ERROR)); |
| 469 | } |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 470 | } |
| 471 | |
| 472 | /* |
| 473 | * Test IRadioVoice.hangupWaitingOrBackground() for the response returned. |
| 474 | */ |
| 475 | TEST_P(RadioVoiceTest, hangupWaitingOrBackground) { |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 476 | serial = GetRandomSerialNumber(); |
| 477 | |
| 478 | radio_voice->hangupWaitingOrBackground(serial); |
| 479 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 480 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 481 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 482 | |
| 483 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 484 | ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error, |
| 485 | {RadioError::INVALID_STATE, RadioError::MODEM_ERR}, |
| 486 | CHECK_GENERAL_ERROR)); |
| 487 | } |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 488 | } |
| 489 | |
| 490 | /* |
| 491 | * Test IRadioVoice.hangupForegroundResumeBackground() for the response returned. |
| 492 | */ |
| 493 | TEST_P(RadioVoiceTest, hangupForegroundResumeBackground) { |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 494 | serial = GetRandomSerialNumber(); |
| 495 | |
| 496 | radio_voice->hangupForegroundResumeBackground(serial); |
| 497 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 498 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 499 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 500 | |
| 501 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 502 | ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error, |
| 503 | {RadioError::INVALID_STATE, RadioError::MODEM_ERR}, |
| 504 | CHECK_GENERAL_ERROR)); |
| 505 | } |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 506 | } |
| 507 | |
| 508 | /* |
| 509 | * Test IRadioVoice.switchWaitingOrHoldingAndActive() for the response returned. |
| 510 | */ |
| 511 | TEST_P(RadioVoiceTest, switchWaitingOrHoldingAndActive) { |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 512 | serial = GetRandomSerialNumber(); |
| 513 | |
| 514 | radio_voice->switchWaitingOrHoldingAndActive(serial); |
| 515 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 516 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 517 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 518 | |
| 519 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 520 | ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error, |
| 521 | {RadioError::INVALID_STATE, RadioError::MODEM_ERR}, |
| 522 | CHECK_GENERAL_ERROR)); |
| 523 | } |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 524 | } |
| 525 | |
| 526 | /* |
| 527 | * Test IRadioVoice.conference() for the response returned. |
| 528 | */ |
| 529 | TEST_P(RadioVoiceTest, conference) { |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 530 | serial = GetRandomSerialNumber(); |
| 531 | |
| 532 | radio_voice->conference(serial); |
| 533 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 534 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 535 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 536 | |
| 537 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 538 | ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error, |
| 539 | {RadioError::INVALID_STATE, RadioError::MODEM_ERR}, |
| 540 | CHECK_GENERAL_ERROR)); |
| 541 | } |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 542 | } |
| 543 | |
| 544 | /* |
| 545 | * Test IRadioVoice.rejectCall() for the response returned. |
| 546 | */ |
| 547 | TEST_P(RadioVoiceTest, rejectCall) { |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 548 | serial = GetRandomSerialNumber(); |
| 549 | |
| 550 | radio_voice->rejectCall(serial); |
| 551 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 552 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 553 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 554 | |
| 555 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 556 | ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error, |
| 557 | {RadioError::INVALID_STATE, RadioError::MODEM_ERR}, |
| 558 | CHECK_GENERAL_ERROR)); |
| 559 | } |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 560 | } |
| 561 | |
| 562 | /* |
| 563 | * Test IRadioVoice.getLastCallFailCause() for the response returned. |
| 564 | */ |
| 565 | TEST_P(RadioVoiceTest, getLastCallFailCause) { |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 566 | serial = GetRandomSerialNumber(); |
| 567 | |
| 568 | radio_voice->getLastCallFailCause(serial); |
| 569 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 570 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 571 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 572 | |
| 573 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 574 | ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error, {RadioError::NONE}, |
| 575 | CHECK_GENERAL_ERROR)); |
| 576 | } |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 577 | } |
| 578 | |
| 579 | /* |
| 580 | * Test IRadioVoice.getCallForwardStatus() for the response returned. |
| 581 | */ |
| 582 | TEST_P(RadioVoiceTest, getCallForwardStatus) { |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 583 | serial = GetRandomSerialNumber(); |
| 584 | CallForwardInfo callInfo; |
| 585 | memset(&callInfo, 0, sizeof(callInfo)); |
| 586 | callInfo.number = std::string(); |
| 587 | |
| 588 | radio_voice->getCallForwardStatus(serial, callInfo); |
| 589 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 590 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 591 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 592 | |
| 593 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 594 | ASSERT_TRUE(CheckAnyOfErrors( |
| 595 | radioRsp_voice->rspInfo.error, |
| 596 | {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR}, |
| 597 | CHECK_GENERAL_ERROR)); |
| 598 | } |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 599 | } |
| 600 | |
| 601 | /* |
| 602 | * Test IRadioVoice.setCallForward() for the response returned. |
| 603 | */ |
| 604 | TEST_P(RadioVoiceTest, setCallForward) { |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 605 | serial = GetRandomSerialNumber(); |
| 606 | CallForwardInfo callInfo; |
| 607 | memset(&callInfo, 0, sizeof(callInfo)); |
| 608 | callInfo.number = std::string(); |
| 609 | |
| 610 | radio_voice->setCallForward(serial, callInfo); |
| 611 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 612 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 613 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 614 | |
| 615 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 616 | ASSERT_TRUE(CheckAnyOfErrors( |
| 617 | radioRsp_voice->rspInfo.error, |
| 618 | {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR}, |
| 619 | CHECK_GENERAL_ERROR)); |
| 620 | } |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 621 | } |
| 622 | |
| 623 | /* |
| 624 | * Test IRadioVoice.getCallWaiting() for the response returned. |
| 625 | */ |
| 626 | TEST_P(RadioVoiceTest, getCallWaiting) { |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 627 | serial = GetRandomSerialNumber(); |
| 628 | |
| 629 | radio_voice->getCallWaiting(serial, 1); |
| 630 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 631 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 632 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 633 | |
| 634 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 635 | ASSERT_TRUE(CheckAnyOfErrors( |
| 636 | radioRsp_voice->rspInfo.error, |
| 637 | {RadioError::NONE, RadioError::INVALID_ARGUMENTS, RadioError::MODEM_ERR}, |
| 638 | CHECK_GENERAL_ERROR)); |
| 639 | } |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 640 | } |
| 641 | |
| 642 | /* |
| 643 | * Test IRadioVoice.setCallWaiting() for the response returned. |
| 644 | */ |
| 645 | TEST_P(RadioVoiceTest, setCallWaiting) { |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 646 | serial = GetRandomSerialNumber(); |
| 647 | |
| 648 | radio_voice->setCallWaiting(serial, true, 1); |
| 649 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 650 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 651 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 652 | |
| 653 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 654 | ASSERT_TRUE(CheckAnyOfErrors( |
| 655 | radioRsp_voice->rspInfo.error, |
| 656 | {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR}, |
| 657 | CHECK_GENERAL_ERROR)); |
| 658 | } |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 659 | } |
| 660 | |
| 661 | /* |
| 662 | * Test IRadioVoice.acceptCall() for the response returned. |
| 663 | */ |
| 664 | TEST_P(RadioVoiceTest, acceptCall) { |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 665 | serial = GetRandomSerialNumber(); |
| 666 | |
| 667 | radio_voice->acceptCall(serial); |
| 668 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 669 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 670 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 671 | |
| 672 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 673 | ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error, |
| 674 | {RadioError::INVALID_STATE, RadioError::MODEM_ERR}, |
| 675 | CHECK_GENERAL_ERROR)); |
| 676 | } |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 677 | } |
| 678 | |
| 679 | /* |
| 680 | * Test IRadioVoice.separateConnection() for the response returned. |
| 681 | */ |
| 682 | TEST_P(RadioVoiceTest, separateConnection) { |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 683 | serial = GetRandomSerialNumber(); |
| 684 | |
| 685 | radio_voice->separateConnection(serial, 1); |
| 686 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 687 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 688 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 689 | |
| 690 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 691 | ASSERT_TRUE(CheckAnyOfErrors( |
| 692 | radioRsp_voice->rspInfo.error, |
| 693 | {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR}, |
| 694 | CHECK_GENERAL_ERROR)); |
| 695 | } |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 696 | } |
| 697 | |
| 698 | /* |
| 699 | * Test IRadioVoice.explicitCallTransfer() for the response returned. |
| 700 | */ |
| 701 | TEST_P(RadioVoiceTest, explicitCallTransfer) { |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 702 | serial = GetRandomSerialNumber(); |
| 703 | |
| 704 | radio_voice->explicitCallTransfer(serial); |
| 705 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 706 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 707 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 708 | |
| 709 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 710 | ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error, |
| 711 | {RadioError::INVALID_STATE, RadioError::MODEM_ERR}, |
| 712 | CHECK_GENERAL_ERROR)); |
| 713 | } |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 714 | } |
| 715 | |
| 716 | /* |
| 717 | * Test IRadioVoice.sendCdmaFeatureCode() for the response returned. |
| 718 | */ |
| 719 | TEST_P(RadioVoiceTest, sendCdmaFeatureCode) { |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 720 | serial = GetRandomSerialNumber(); |
| 721 | |
| 722 | radio_voice->sendCdmaFeatureCode(serial, std::string()); |
| 723 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 724 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 725 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 726 | |
| 727 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 728 | ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error, |
| 729 | {RadioError::NONE, RadioError::INVALID_ARGUMENTS, |
| 730 | RadioError::INVALID_CALL_ID, RadioError::INVALID_MODEM_STATE, |
| 731 | RadioError::MODEM_ERR, RadioError::OPERATION_NOT_ALLOWED}, |
| 732 | CHECK_GENERAL_ERROR)); |
| 733 | } |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 734 | } |
| 735 | |
| 736 | /* |
| 737 | * Test IRadioVoice.sendDtmf() for the response returned. |
| 738 | */ |
| 739 | TEST_P(RadioVoiceTest, sendDtmf) { |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 740 | serial = GetRandomSerialNumber(); |
| 741 | |
| 742 | radio_voice->sendDtmf(serial, "1"); |
| 743 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 744 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 745 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 746 | |
| 747 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 748 | ASSERT_TRUE(CheckAnyOfErrors( |
| 749 | radioRsp_voice->rspInfo.error, |
| 750 | {RadioError::NONE, RadioError::INVALID_ARGUMENTS, RadioError::INVALID_CALL_ID, |
| 751 | RadioError::INVALID_MODEM_STATE, RadioError::MODEM_ERR}, |
| 752 | CHECK_GENERAL_ERROR)); |
| 753 | } |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 754 | } |
| 755 | |
| 756 | /* |
| 757 | * Test IRadioVoice.startDtmf() for the response returned. |
| 758 | */ |
| 759 | TEST_P(RadioVoiceTest, startDtmf) { |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 760 | serial = GetRandomSerialNumber(); |
| 761 | |
| 762 | radio_voice->startDtmf(serial, "1"); |
| 763 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 764 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 765 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 766 | |
| 767 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 768 | ASSERT_TRUE(CheckAnyOfErrors( |
| 769 | radioRsp_voice->rspInfo.error, |
| 770 | {RadioError::NONE, RadioError::INVALID_ARGUMENTS, RadioError::INVALID_CALL_ID, |
| 771 | RadioError::INVALID_MODEM_STATE, RadioError::MODEM_ERR}, |
| 772 | CHECK_GENERAL_ERROR)); |
| 773 | } |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 774 | } |
| 775 | |
| 776 | /* |
| 777 | * Test IRadioVoice.stopDtmf() for the response returned. |
| 778 | */ |
| 779 | TEST_P(RadioVoiceTest, stopDtmf) { |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 780 | serial = GetRandomSerialNumber(); |
| 781 | |
| 782 | radio_voice->stopDtmf(serial); |
| 783 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 784 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 785 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 786 | |
| 787 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 788 | ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error, |
| 789 | {RadioError::NONE, RadioError::INVALID_CALL_ID, |
| 790 | RadioError::INVALID_MODEM_STATE, RadioError::MODEM_ERR}, |
| 791 | CHECK_GENERAL_ERROR)); |
| 792 | } |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 793 | } |
| 794 | |
| 795 | /* |
| 796 | * Test IRadioVoice.setMute() for the response returned. |
| 797 | */ |
| 798 | TEST_P(RadioVoiceTest, setMute) { |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 799 | serial = GetRandomSerialNumber(); |
| 800 | |
| 801 | radio_voice->setMute(serial, true); |
| 802 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 803 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 804 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 805 | |
| 806 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 807 | ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error, |
| 808 | {RadioError::NONE, RadioError::INVALID_ARGUMENTS}, |
| 809 | CHECK_GENERAL_ERROR)); |
| 810 | } |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 811 | } |
| 812 | |
| 813 | /* |
| 814 | * Test IRadioVoice.getMute() for the response returned. |
| 815 | */ |
| 816 | TEST_P(RadioVoiceTest, getMute) { |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 817 | serial = GetRandomSerialNumber(); |
| 818 | |
| 819 | radio_voice->getMute(serial); |
| 820 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 821 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 822 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 823 | |
| 824 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 825 | EXPECT_EQ(RadioError::NONE, radioRsp_voice->rspInfo.error); |
| 826 | } |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 827 | } |
| 828 | |
| 829 | /* |
| 830 | * Test IRadioVoice.sendBurstDtmf() for the response returned. |
| 831 | */ |
| 832 | TEST_P(RadioVoiceTest, sendBurstDtmf) { |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 833 | serial = GetRandomSerialNumber(); |
| 834 | |
| 835 | radio_voice->sendBurstDtmf(serial, "1", 0, 0); |
| 836 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 837 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 838 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 839 | |
| 840 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 841 | ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error, |
| 842 | {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, |
| 843 | RadioError::MODEM_ERR, RadioError::OPERATION_NOT_ALLOWED}, |
| 844 | CHECK_GENERAL_ERROR)); |
| 845 | } |
Sarah Chin | 52de0ad | 2022-01-28 01:02:16 -0800 | [diff] [blame] | 846 | } |
Sarah Chin | f746a91 | 2022-01-28 15:54:36 -0800 | [diff] [blame] | 847 | |
| 848 | /* |
| 849 | * Test IRadioVoice.sendUssd() for the response returned. |
| 850 | */ |
| 851 | TEST_P(RadioVoiceTest, sendUssd) { |
Sarah Chin | f746a91 | 2022-01-28 15:54:36 -0800 | [diff] [blame] | 852 | serial = GetRandomSerialNumber(); |
| 853 | radio_voice->sendUssd(serial, std::string("test")); |
| 854 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 855 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 856 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 857 | |
| 858 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 859 | ASSERT_TRUE(CheckAnyOfErrors( |
| 860 | radioRsp_voice->rspInfo.error, |
| 861 | {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR}, |
| 862 | CHECK_GENERAL_ERROR)); |
| 863 | } |
Sarah Chin | f746a91 | 2022-01-28 15:54:36 -0800 | [diff] [blame] | 864 | } |
| 865 | |
| 866 | /* |
| 867 | * Test IRadioVoice.cancelPendingUssd() for the response returned. |
| 868 | */ |
| 869 | TEST_P(RadioVoiceTest, cancelPendingUssd) { |
Sarah Chin | f746a91 | 2022-01-28 15:54:36 -0800 | [diff] [blame] | 870 | serial = GetRandomSerialNumber(); |
| 871 | |
| 872 | radio_voice->cancelPendingUssd(serial); |
| 873 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 874 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 875 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 876 | |
| 877 | if (cardStatus.cardState == CardStatus::STATE_ABSENT) { |
| 878 | ASSERT_TRUE(CheckAnyOfErrors( |
| 879 | radioRsp_voice->rspInfo.error, |
| 880 | {RadioError::NONE, RadioError::INVALID_STATE, RadioError::MODEM_ERR}, |
| 881 | CHECK_GENERAL_ERROR)); |
| 882 | } |
Sarah Chin | f746a91 | 2022-01-28 15:54:36 -0800 | [diff] [blame] | 883 | } |
Gary Jian | 66db5dd | 2022-02-11 14:51:57 +0800 | [diff] [blame] | 884 | |
| 885 | /* |
| 886 | * Test IRadioVoice.isVoNrEnabled() for the response returned. |
| 887 | */ |
| 888 | TEST_P(RadioVoiceTest, isVoNrEnabled) { |
Gary Jian | 66db5dd | 2022-02-11 14:51:57 +0800 | [diff] [blame] | 889 | serial = GetRandomSerialNumber(); |
| 890 | |
| 891 | radio_voice->isVoNrEnabled(serial); |
| 892 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 893 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 894 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 895 | |
| 896 | ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error, |
| 897 | {RadioError::REQUEST_NOT_SUPPORTED, RadioError::NONE})); |
Gary Jian | 66db5dd | 2022-02-11 14:51:57 +0800 | [diff] [blame] | 898 | } |
| 899 | |
| 900 | /* |
| 901 | * Test IRadioVoice.setVoNrEnabled() for the response returned. |
| 902 | */ |
| 903 | TEST_P(RadioVoiceTest, setVoNrEnabled) { |
Gary Jian | 66db5dd | 2022-02-11 14:51:57 +0800 | [diff] [blame] | 904 | serial = GetRandomSerialNumber(); |
| 905 | |
| 906 | radio_voice->setVoNrEnabled(serial, true); |
| 907 | EXPECT_EQ(std::cv_status::no_timeout, wait()); |
| 908 | EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_voice->rspInfo.type); |
| 909 | EXPECT_EQ(serial, radioRsp_voice->rspInfo.serial); |
| 910 | |
| 911 | ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error, |
| 912 | {RadioError::REQUEST_NOT_SUPPORTED, RadioError::NONE})); |
Gary Jian | 66db5dd | 2022-02-11 14:51:57 +0800 | [diff] [blame] | 913 | } |