1 /*
2  * Copyright (C) 2017 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 <android-base/logging.h>
18 #include <radio_hidl_hal_utils_v1_0.h>
19 
20 /*
21  * Test IRadio.getCurrentCalls() for the response returned.
22  */
TEST_P(RadioHidlTest,getCurrentCalls)23 TEST_P(RadioHidlTest, getCurrentCalls) {
24     LOG(DEBUG) << "getCurrentCalls";
25     serial = GetRandomSerialNumber();
26 
27     radio->getCurrentCalls(serial);
28     EXPECT_EQ(std::cv_status::no_timeout, wait());
29     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
30     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
31 
32     if (cardStatus.cardState == CardState::ABSENT) {
33         EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
34     }
35     LOG(DEBUG) << "getCurrentCalls finished";
36 }
37 
38 /*
39  * Test IRadio.dial() for the response returned.
40  */
TEST_P(RadioHidlTest,dial)41 TEST_P(RadioHidlTest, dial) {
42     LOG(DEBUG) << "dial";
43     serial = GetRandomSerialNumber();
44 
45     Dial dialInfo;
46     memset(&dialInfo, 0, sizeof(dialInfo));
47     dialInfo.address = hidl_string("123456789");
48 
49     radio->dial(serial, dialInfo);
50     EXPECT_EQ(std::cv_status::no_timeout, wait());
51     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
52     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
53 
54     if (cardStatus.cardState == CardState::ABSENT) {
55         ASSERT_TRUE(CheckAnyOfErrors(
56             radioRsp->rspInfo.error,
57             {RadioError::CANCELLED, RadioError::DEVICE_IN_USE, RadioError::FDN_CHECK_FAILURE,
58              RadioError::INVALID_ARGUMENTS, RadioError::INVALID_CALL_ID,
59              RadioError::INVALID_MODEM_STATE, RadioError::INVALID_STATE, RadioError::MODEM_ERR,
60              RadioError::NO_NETWORK_FOUND, RadioError::NO_SUBSCRIPTION,
61              RadioError::OPERATION_NOT_ALLOWED},
62             CHECK_GENERAL_ERROR));
63     }
64     LOG(DEBUG) << "dial finished";
65 }
66 
67 /*
68  * Test IRadio.hangup() for the response returned.
69  */
TEST_P(RadioHidlTest,hangup)70 TEST_P(RadioHidlTest, hangup) {
71     LOG(DEBUG) << "hangup";
72     serial = GetRandomSerialNumber();
73 
74     radio->hangup(serial, 1);
75     EXPECT_EQ(std::cv_status::no_timeout, wait());
76     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
77     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
78 
79     if (cardStatus.cardState == CardState::ABSENT) {
80         ASSERT_TRUE(CheckAnyOfErrors(
81             radioRsp->rspInfo.error,
82             {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR},
83             CHECK_GENERAL_ERROR));
84     }
85     LOG(DEBUG) << "hangup finished";
86 }
87 
88 /*
89  * Test IRadio.hangupWaitingOrBackground() for the response returned.
90  */
TEST_P(RadioHidlTest,hangupWaitingOrBackground)91 TEST_P(RadioHidlTest, hangupWaitingOrBackground) {
92     LOG(DEBUG) << "hangupWaitingOrBackground";
93     serial = GetRandomSerialNumber();
94 
95     radio->hangupWaitingOrBackground(serial);
96     EXPECT_EQ(std::cv_status::no_timeout, wait());
97     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
98     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
99 
100     if (cardStatus.cardState == CardState::ABSENT) {
101         ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error,
102                                      {RadioError::INVALID_STATE, RadioError::MODEM_ERR},
103                                      CHECK_GENERAL_ERROR));
104     }
105     LOG(DEBUG) << "hangupWaitingOrBackground finished";
106 }
107 
108 /*
109  * Test IRadio.hangupForegroundResumeBackground() for the response returned.
110  */
TEST_P(RadioHidlTest,hangupForegroundResumeBackground)111 TEST_P(RadioHidlTest, hangupForegroundResumeBackground) {
112     LOG(DEBUG) << "hangupForegroundResumeBackground";
113     serial = GetRandomSerialNumber();
114 
115     radio->hangupForegroundResumeBackground(serial);
116     EXPECT_EQ(std::cv_status::no_timeout, wait());
117     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
118     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
119 
120     if (cardStatus.cardState == CardState::ABSENT) {
121         ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error,
122                                      {RadioError::INVALID_STATE, RadioError::MODEM_ERR},
123                                      CHECK_GENERAL_ERROR));
124     }
125     LOG(DEBUG) << "hangupForegroundResumeBackground finished";
126 }
127 
128 /*
129  * Test IRadio.switchWaitingOrHoldingAndActive() for the response returned.
130  */
TEST_P(RadioHidlTest,switchWaitingOrHoldingAndActive)131 TEST_P(RadioHidlTest, switchWaitingOrHoldingAndActive) {
132     LOG(DEBUG) << "switchWaitingOrHoldingAndActive";
133     serial = GetRandomSerialNumber();
134 
135     radio->switchWaitingOrHoldingAndActive(serial);
136     EXPECT_EQ(std::cv_status::no_timeout, wait());
137     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
138     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
139 
140     if (cardStatus.cardState == CardState::ABSENT) {
141         ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error,
142                                      {RadioError::INVALID_STATE, RadioError::MODEM_ERR},
143                                      CHECK_GENERAL_ERROR));
144     }
145     LOG(DEBUG) << "switchWaitingOrHoldingAndActive finished";
146 }
147 
148 /*
149  * Test IRadio.conference() for the response returned.
150  */
TEST_P(RadioHidlTest,conference)151 TEST_P(RadioHidlTest, conference) {
152     LOG(DEBUG) << "conference";
153     serial = GetRandomSerialNumber();
154 
155     radio->conference(serial);
156     EXPECT_EQ(std::cv_status::no_timeout, wait());
157     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
158     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
159 
160     if (cardStatus.cardState == CardState::ABSENT) {
161         ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error,
162                                      {RadioError::INVALID_STATE, RadioError::MODEM_ERR},
163                                      CHECK_GENERAL_ERROR));
164     }
165     LOG(DEBUG) << "conference finished";
166 }
167 
168 /*
169  * Test IRadio.rejectCall() for the response returned.
170  */
TEST_P(RadioHidlTest,rejectCall)171 TEST_P(RadioHidlTest, rejectCall) {
172     LOG(DEBUG) << "rejectCall";
173     serial = GetRandomSerialNumber();
174 
175     radio->rejectCall(serial);
176     EXPECT_EQ(std::cv_status::no_timeout, wait());
177     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
178     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
179 
180     if (cardStatus.cardState == CardState::ABSENT) {
181         ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error,
182                                      {RadioError::INVALID_STATE, RadioError::MODEM_ERR},
183                                      CHECK_GENERAL_ERROR));
184     }
185     LOG(DEBUG) << "rejectCall finished";
186 }
187 
188 /*
189  * Test IRadio.getLastCallFailCause() for the response returned.
190  */
TEST_P(RadioHidlTest,getLastCallFailCause)191 TEST_P(RadioHidlTest, getLastCallFailCause) {
192     LOG(DEBUG) << "getLastCallFailCause";
193     serial = GetRandomSerialNumber();
194 
195     radio->getLastCallFailCause(serial);
196     EXPECT_EQ(std::cv_status::no_timeout, wait());
197     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
198     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
199 
200     if (cardStatus.cardState == CardState::ABSENT) {
201         ASSERT_TRUE(
202             CheckAnyOfErrors(radioRsp->rspInfo.error, {RadioError::NONE}, CHECK_GENERAL_ERROR));
203     }
204     LOG(DEBUG) << "getLastCallFailCause finished";
205 }
206 
207 /*
208  * Test IRadio.sendUssd() for the response returned.
209  */
TEST_P(RadioHidlTest,sendUssd)210 TEST_P(RadioHidlTest, sendUssd) {
211     LOG(DEBUG) << "sendUssd";
212     serial = GetRandomSerialNumber();
213     radio->sendUssd(serial, hidl_string("test"));
214     EXPECT_EQ(std::cv_status::no_timeout, wait());
215     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
216     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
217 
218     if (cardStatus.cardState == CardState::ABSENT) {
219         ASSERT_TRUE(CheckAnyOfErrors(
220             radioRsp->rspInfo.error,
221             {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR},
222             CHECK_GENERAL_ERROR));
223     }
224     LOG(DEBUG) << "sendUssd finished";
225 }
226 
227 /*
228  * Test IRadio.cancelPendingUssd() for the response returned.
229  */
TEST_P(RadioHidlTest,cancelPendingUssd)230 TEST_P(RadioHidlTest, cancelPendingUssd) {
231     LOG(DEBUG) << "cancelPendingUssd";
232     serial = GetRandomSerialNumber();
233 
234     radio->cancelPendingUssd(serial);
235     EXPECT_EQ(std::cv_status::no_timeout, wait());
236     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
237     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
238 
239     if (cardStatus.cardState == CardState::ABSENT) {
240         ASSERT_TRUE(
241             CheckAnyOfErrors(radioRsp->rspInfo.error,
242                              {RadioError::NONE, RadioError::INVALID_STATE, RadioError::MODEM_ERR},
243                              CHECK_GENERAL_ERROR));
244     }
245     LOG(DEBUG) << "cancelPendingUssd finished";
246 }
247 
248 /*
249  * Test IRadio.getCallForwardStatus() for the response returned.
250  */
TEST_P(RadioHidlTest,getCallForwardStatus)251 TEST_P(RadioHidlTest, getCallForwardStatus) {
252     LOG(DEBUG) << "getCallForwardStatus";
253     serial = GetRandomSerialNumber();
254     CallForwardInfo callInfo;
255     memset(&callInfo, 0, sizeof(callInfo));
256     callInfo.number = hidl_string();
257 
258     radio->getCallForwardStatus(serial, callInfo);
259     EXPECT_EQ(std::cv_status::no_timeout, wait());
260     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
261     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
262 
263     if (cardStatus.cardState == CardState::ABSENT) {
264         ASSERT_TRUE(CheckAnyOfErrors(
265             radioRsp->rspInfo.error,
266             {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR},
267             CHECK_GENERAL_ERROR));
268     }
269     LOG(DEBUG) << "getCallForwardStatus finished";
270 }
271 
272 /*
273  * Test IRadio.setCallForward() for the response returned.
274  */
TEST_P(RadioHidlTest,setCallForward)275 TEST_P(RadioHidlTest, setCallForward) {
276     LOG(DEBUG) << "setCallForward";
277     serial = GetRandomSerialNumber();
278     CallForwardInfo callInfo;
279     memset(&callInfo, 0, sizeof(callInfo));
280     callInfo.number = hidl_string();
281 
282     radio->setCallForward(serial, callInfo);
283     EXPECT_EQ(std::cv_status::no_timeout, wait());
284     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
285     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
286 
287     if (cardStatus.cardState == CardState::ABSENT) {
288         ASSERT_TRUE(CheckAnyOfErrors(
289             radioRsp->rspInfo.error,
290             {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR},
291             CHECK_GENERAL_ERROR));
292     }
293     LOG(DEBUG) << "setCallForward finished";
294 }
295 
296 /*
297  * Test IRadio.getCallWaiting() for the response returned.
298  */
TEST_P(RadioHidlTest,getCallWaiting)299 TEST_P(RadioHidlTest, getCallWaiting) {
300     LOG(DEBUG) << "getCallWaiting";
301     serial = GetRandomSerialNumber();
302 
303     radio->getCallWaiting(serial, 1);
304     EXPECT_EQ(std::cv_status::no_timeout, wait());
305     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
306     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
307 
308     if (cardStatus.cardState == CardState::ABSENT) {
309         ASSERT_TRUE(CheckAnyOfErrors(
310             radioRsp->rspInfo.error,
311             {RadioError::NONE, RadioError::INVALID_ARGUMENTS, RadioError::MODEM_ERR},
312             CHECK_GENERAL_ERROR));
313     }
314     LOG(DEBUG) << "getCallWaiting finished";
315 }
316 
317 /*
318  * Test IRadio.setCallWaiting() for the response returned.
319  */
TEST_P(RadioHidlTest,setCallWaiting)320 TEST_P(RadioHidlTest, setCallWaiting) {
321     LOG(DEBUG) << "setCallWaiting";
322     serial = GetRandomSerialNumber();
323 
324     radio->setCallWaiting(serial, true, 1);
325     EXPECT_EQ(std::cv_status::no_timeout, wait());
326     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
327     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
328 
329     if (cardStatus.cardState == CardState::ABSENT) {
330         ASSERT_TRUE(CheckAnyOfErrors(
331             radioRsp->rspInfo.error,
332             {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR},
333             CHECK_GENERAL_ERROR));
334     }
335     LOG(DEBUG) << "setCallWaiting finished";
336 }
337 
338 /*
339  * Test IRadio.acceptCall() for the response returned.
340  */
TEST_P(RadioHidlTest,acceptCall)341 TEST_P(RadioHidlTest, acceptCall) {
342     LOG(DEBUG) << "acceptCall";
343     serial = GetRandomSerialNumber();
344 
345     radio->acceptCall(serial);
346     EXPECT_EQ(std::cv_status::no_timeout, wait());
347     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
348     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
349 
350     if (cardStatus.cardState == CardState::ABSENT) {
351         ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error,
352                                      {RadioError::INVALID_STATE, RadioError::MODEM_ERR},
353                                      CHECK_GENERAL_ERROR));
354     }
355     LOG(DEBUG) << "acceptCall finished";
356 }
357 
358 /*
359  * Test IRadio.separateConnection() for the response returned.
360  */
TEST_P(RadioHidlTest,separateConnection)361 TEST_P(RadioHidlTest, separateConnection) {
362     LOG(DEBUG) << "separateConnection";
363     serial = GetRandomSerialNumber();
364 
365     radio->separateConnection(serial, 1);
366     EXPECT_EQ(std::cv_status::no_timeout, wait());
367     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
368     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
369 
370     if (cardStatus.cardState == CardState::ABSENT) {
371         ASSERT_TRUE(CheckAnyOfErrors(
372             radioRsp->rspInfo.error,
373             {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR},
374             CHECK_GENERAL_ERROR));
375     }
376     LOG(DEBUG) << "separateConnection finished";
377 }
378 
379 /*
380  * Test IRadio.explicitCallTransfer() for the response returned.
381  */
TEST_P(RadioHidlTest,explicitCallTransfer)382 TEST_P(RadioHidlTest, explicitCallTransfer) {
383     LOG(DEBUG) << "explicitCallTransfer";
384     serial = GetRandomSerialNumber();
385 
386     radio->explicitCallTransfer(serial);
387     EXPECT_EQ(std::cv_status::no_timeout, wait());
388     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
389     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
390 
391     if (cardStatus.cardState == CardState::ABSENT) {
392         ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error,
393                                      {RadioError::INVALID_STATE, RadioError::MODEM_ERR},
394                                      CHECK_GENERAL_ERROR));
395     }
396     LOG(DEBUG) << "explicitCallTransfer finished";
397 }
398 
399 /*
400  * Test IRadio.sendCDMAFeatureCode() for the response returned.
401  */
TEST_P(RadioHidlTest,sendCDMAFeatureCode)402 TEST_P(RadioHidlTest, sendCDMAFeatureCode) {
403     LOG(DEBUG) << "sendCDMAFeatureCode";
404     serial = GetRandomSerialNumber();
405 
406     radio->sendCDMAFeatureCode(serial, hidl_string());
407     EXPECT_EQ(std::cv_status::no_timeout, wait());
408     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
409     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
410 
411     if (cardStatus.cardState == CardState::ABSENT) {
412         ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error,
413                                      {RadioError::NONE, RadioError::INVALID_ARGUMENTS,
414                                       RadioError::INVALID_CALL_ID, RadioError::INVALID_MODEM_STATE,
415                                       RadioError::MODEM_ERR, RadioError::OPERATION_NOT_ALLOWED},
416                                      CHECK_GENERAL_ERROR));
417     }
418     LOG(DEBUG) << "sendCDMAFeatureCode finished";
419 }
420 
421 /*
422  * Test IRadio.sendDtmf() for the response returned.
423  */
TEST_P(RadioHidlTest,sendDtmf)424 TEST_P(RadioHidlTest, sendDtmf) {
425     LOG(DEBUG) << "sendDtmf";
426     serial = GetRandomSerialNumber();
427 
428     radio->sendDtmf(serial, "1");
429     EXPECT_EQ(std::cv_status::no_timeout, wait());
430     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
431     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
432 
433     if (cardStatus.cardState == CardState::ABSENT) {
434         ASSERT_TRUE(CheckAnyOfErrors(
435             radioRsp->rspInfo.error,
436             {RadioError::NONE, RadioError::INVALID_ARGUMENTS, RadioError::INVALID_CALL_ID,
437              RadioError::INVALID_MODEM_STATE, RadioError::MODEM_ERR},
438             CHECK_GENERAL_ERROR));
439     }
440     LOG(DEBUG) << "sendDtmf finished";
441 }
442 
443 /*
444  * Test IRadio.startDtmf() for the response returned.
445  */
TEST_P(RadioHidlTest,startDtmf)446 TEST_P(RadioHidlTest, startDtmf) {
447     LOG(DEBUG) << "startDtmf";
448     serial = GetRandomSerialNumber();
449 
450     radio->startDtmf(serial, "1");
451     EXPECT_EQ(std::cv_status::no_timeout, wait());
452     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
453     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
454 
455     if (cardStatus.cardState == CardState::ABSENT) {
456         ASSERT_TRUE(CheckAnyOfErrors(
457             radioRsp->rspInfo.error,
458             {RadioError::NONE, RadioError::INVALID_ARGUMENTS, RadioError::INVALID_CALL_ID,
459              RadioError::INVALID_MODEM_STATE, RadioError::MODEM_ERR},
460             CHECK_GENERAL_ERROR));
461     }
462     LOG(DEBUG) << "startDtmf finished";
463 }
464 
465 /*
466  * Test IRadio.stopDtmf() for the response returned.
467  */
TEST_P(RadioHidlTest,stopDtmf)468 TEST_P(RadioHidlTest, stopDtmf) {
469     LOG(DEBUG) << "stopDtmf";
470     serial = GetRandomSerialNumber();
471 
472     radio->stopDtmf(serial);
473     EXPECT_EQ(std::cv_status::no_timeout, wait());
474     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
475     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
476 
477     if (cardStatus.cardState == CardState::ABSENT) {
478         ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error,
479                                      {RadioError::NONE, RadioError::INVALID_CALL_ID,
480                                       RadioError::INVALID_MODEM_STATE, RadioError::MODEM_ERR},
481                                      CHECK_GENERAL_ERROR));
482     }
483     LOG(DEBUG) << "stopDtmf finished";
484 }
485 
486 /*
487  * Test IRadio.setMute() for the response returned.
488  */
TEST_P(RadioHidlTest,setMute)489 TEST_P(RadioHidlTest, setMute) {
490     LOG(DEBUG) << "setMute";
491     serial = GetRandomSerialNumber();
492 
493     radio->setMute(serial, true);
494     EXPECT_EQ(std::cv_status::no_timeout, wait());
495     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
496     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
497 
498     if (cardStatus.cardState == CardState::ABSENT) {
499         ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error,
500                                      {RadioError::NONE, RadioError::INVALID_ARGUMENTS},
501                                      CHECK_GENERAL_ERROR));
502     }
503     LOG(DEBUG) << "setMute finished";
504 }
505 
506 /*
507  * Test IRadio.getMute() for the response returned.
508  */
TEST_P(RadioHidlTest,getMute)509 TEST_P(RadioHidlTest, getMute) {
510     LOG(DEBUG) << "getMute";
511     serial = GetRandomSerialNumber();
512 
513     radio->getMute(serial);
514     EXPECT_EQ(std::cv_status::no_timeout, wait());
515     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
516     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
517 
518     if (cardStatus.cardState == CardState::ABSENT) {
519         EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
520     }
521     LOG(DEBUG) << "getMute finished";
522 }
523 
524 /*
525  * Test IRadio.sendBurstDtmf() for the response returned.
526  */
TEST_P(RadioHidlTest,sendBurstDtmf)527 TEST_P(RadioHidlTest, sendBurstDtmf) {
528     LOG(DEBUG) << "sendBurstDtmf";
529     serial = GetRandomSerialNumber();
530 
531     radio->sendBurstDtmf(serial, "1", 0, 0);
532     EXPECT_EQ(std::cv_status::no_timeout, wait());
533     EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
534     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
535 
536     if (cardStatus.cardState == CardState::ABSENT) {
537         ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error,
538                                      {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE,
539                                       RadioError::MODEM_ERR, RadioError::OPERATION_NOT_ALLOWED},
540                                      CHECK_GENERAL_ERROR));
541     }
542     LOG(DEBUG) << "sendBurstDtmf finished";
543 }
544