1 #!/usr/bin/env python3.4 2 # 3 # Copyright 2016 - Google 4 # 5 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # you may not use this file except in compliance with the License. 7 # You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 """ 17 Test Script for Telephony Pre Check In Sanity 18 """ 19 20 import time 21 from queue import Empty 22 from acts.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest 23 from acts.test_utils.tel.tel_defines import GEN_3G 24 from acts.test_utils.tel.tel_defines import GEN_4G 25 from acts.test_utils.tel.tel_defines import PHONE_TYPE_CDMA 26 from acts.test_utils.tel.tel_defines import PHONE_TYPE_GSM 27 from acts.test_utils.tel.tel_defines import RAT_3G 28 from acts.test_utils.tel.tel_defines import VT_STATE_BIDIRECTIONAL 29 from acts.test_utils.tel.tel_defines import WAIT_TIME_ANDROID_STATE_SETTLING 30 from acts.test_utils.tel.tel_defines import WFC_MODE_WIFI_PREFERRED 31 from acts.test_utils.tel.tel_test_utils import call_setup_teardown 32 from acts.test_utils.tel.tel_test_utils import \ 33 ensure_network_generation_for_subscription 34 from acts.test_utils.tel.tel_test_utils import ensure_network_generation 35 from acts.test_utils.tel.tel_test_utils import mms_send_receive_verify 36 from acts.test_utils.tel.tel_test_utils import multithread_func 37 from acts.test_utils.tel.tel_test_utils import set_call_state_listen_level 38 from acts.test_utils.tel.tel_test_utils import setup_sim 39 from acts.test_utils.tel.tel_test_utils import sms_send_receive_verify 40 from acts.test_utils.tel.tel_video_utils import phone_setup_video 41 from acts.test_utils.tel.tel_video_utils import is_phone_in_call_video_bidirectional 42 from acts.test_utils.tel.tel_video_utils import video_call_setup_teardown 43 from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_1x 44 from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_2g 45 from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_3g 46 from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_csfb 47 from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_iwlan 48 from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_volte 49 from acts.test_utils.tel.tel_voice_utils import phone_setup_voice_2g 50 from acts.test_utils.tel.tel_voice_utils import phone_setup_3g 51 from acts.test_utils.tel.tel_voice_utils import phone_setup_csfb 52 from acts.test_utils.tel.tel_voice_utils import phone_setup_iwlan 53 from acts.test_utils.tel.tel_voice_utils import phone_setup_voice_3g 54 from acts.test_utils.tel.tel_voice_utils import phone_setup_volte 55 from acts.test_utils.tel.tel_voice_utils import phone_setup_voice_general 56 from acts.utils import load_config 57 from acts.utils import rand_ascii_str 58 59 60 class TelLiveSmsTest(TelephonyBaseTest): 61 def __init__(self, controllers): 62 TelephonyBaseTest.__init__(self, controllers) 63 self.tests = ("test_sms_mo_4g", 64 "test_sms_mt_4g", 65 "test_sms_mo_in_call_volte", 66 "test_sms_mt_in_call_volte", 67 "test_sms_mo_in_call_csfb", 68 "test_sms_mt_in_call_csfb", 69 "test_sms_mo_in_call_csfb_1x", 70 "test_sms_mt_in_call_csfb_1x", 71 "test_sms_mo_3g", 72 "test_sms_mt_3g", 73 "test_sms_mo_in_call_wcdma", 74 "test_sms_mt_in_call_wcdma", 75 "test_sms_mo_in_call_1x", 76 "test_sms_mt_in_call_1x", 77 "test_sms_mo_2g", 78 "test_sms_mt_2g", 79 "test_sms_mo_in_call_gsm", 80 "test_sms_mt_in_call_gsm", 81 "test_sms_mo_iwlan", 82 "test_sms_mt_iwlan", 83 "test_sms_mo_in_call_iwlan", 84 "test_sms_mt_in_call_iwlan", 85 "test_sms_mo_in_call_vt", 86 "test_sms_mt_in_call_vt", 87 ) 88 # The path for "sim config file" should be set 89 # in "testbed.config" entry "sim_conf_file". 90 self.simconf = load_config(self.user_params["sim_conf_file"]) 91 self.wifi_network_ssid = self.user_params["wifi_network_ssid"] 92 93 try: 94 self.wifi_network_pass = self.user_params["wifi_network_pass"] 95 except KeyError: 96 self.wifi_network_pass = None 97 98 def _sms_test(self, ads): 99 """Test SMS between two phones. 100 101 Returns: 102 True if success. 103 False if failed. 104 """ 105 106 sms_params = [(ads[0], ads[1])] 107 message_arrays = [[rand_ascii_str(50)], [rand_ascii_str(160)], 108 [rand_ascii_str(180)]] 109 110 for outer_param in sms_params: 111 outer_param = (self.log, ) + outer_param 112 for message_array in message_arrays: 113 inner_param = outer_param + (message_array, ) 114 if not sms_send_receive_verify(*inner_param): 115 return False 116 117 return True 118 119 def _sms_test_mo(self, ads): 120 return self._sms_test([ads[0], ads[1]]) 121 122 def _sms_test_mt(self, ads): 123 return self._sms_test([ads[1], ads[0]]) 124 125 def _mo_sms_in_3g_call(self, ads): 126 self.log.info("Begin In Call SMS Test.") 127 if not call_setup_teardown(self.log, 128 ads[0], 129 ads[1], 130 ad_hangup=None, 131 verify_caller_func=is_phone_in_call_3g, 132 verify_callee_func=None): 133 return False 134 135 if not self._sms_test_mo(ads): 136 self.log.error("SMS test fail.") 137 return False 138 139 return True 140 141 def _mt_sms_in_3g_call(self, ads): 142 self.log.info("Begin In Call SMS Test.") 143 if not call_setup_teardown(self.log, 144 ads[0], 145 ads[1], 146 ad_hangup=None, 147 verify_caller_func=is_phone_in_call_3g, 148 verify_callee_func=None): 149 return False 150 151 if not self._sms_test_mt(ads): 152 self.log.error("SMS test fail.") 153 return False 154 155 return True 156 157 def _mo_sms_in_2g_call(self, ads): 158 self.log.info("Begin In Call SMS Test.") 159 if not call_setup_teardown(self.log, 160 ads[0], 161 ads[1], 162 ad_hangup=None, 163 verify_caller_func=is_phone_in_call_2g, 164 verify_callee_func=None): 165 return False 166 167 if not self._sms_test_mo(ads): 168 self.log.error("SMS test fail.") 169 return False 170 171 return True 172 173 def _mt_sms_in_2g_call(self, ads): 174 self.log.info("Begin In Call SMS Test.") 175 if not call_setup_teardown(self.log, 176 ads[0], 177 ads[1], 178 ad_hangup=None, 179 verify_caller_func=is_phone_in_call_2g, 180 verify_callee_func=None): 181 return False 182 183 if not self._sms_test_mt(ads): 184 self.log.error("SMS test fail.") 185 return False 186 187 return True 188 189 @TelephonyBaseTest.tel_test_wrap 190 def test_sms_mo_general(self): 191 """Test SMS basic function between two phone. Phones in any network. 192 193 Airplane mode is off. 194 Send SMS from PhoneA to PhoneB. 195 Verify received message on PhoneB is correct. 196 197 Returns: 198 True if success. 199 False if failed. 200 """ 201 ads = self.android_devices 202 203 tasks = [(phone_setup_voice_general, (self.log, ads[0])), 204 (phone_setup_voice_general, (self.log, ads[1]))] 205 if not multithread_func(self.log, tasks): 206 self.log.error("Phone Failed to Set Up Properly.") 207 return False 208 209 return self._sms_test_mo(ads) 210 211 @TelephonyBaseTest.tel_test_wrap 212 def test_sms_mt_general(self): 213 """Test SMS basic function between two phone. Phones in any network. 214 215 Airplane mode is off. 216 Send SMS from PhoneB to PhoneA. 217 Verify received message on PhoneA is correct. 218 219 Returns: 220 True if success. 221 False if failed. 222 """ 223 ads = self.android_devices 224 225 tasks = [(phone_setup_voice_general, (self.log, ads[0])), 226 (phone_setup_voice_general, (self.log, ads[1]))] 227 if not multithread_func(self.log, tasks): 228 self.log.error("Phone Failed to Set Up Properly.") 229 return False 230 231 return self._sms_test_mt(ads) 232 233 @TelephonyBaseTest.tel_test_wrap 234 def test_sms_mo_2g(self): 235 """Test SMS basic function between two phone. Phones in 3g network. 236 237 Airplane mode is off. 238 Send SMS from PhoneA to PhoneB. 239 Verify received message on PhoneB is correct. 240 241 Returns: 242 True if success. 243 False if failed. 244 """ 245 ads = self.android_devices 246 247 tasks = [(phone_setup_voice_2g, (self.log, ads[0])), 248 (phone_setup_voice_general, (self.log, ads[1]))] 249 if not multithread_func(self.log, tasks): 250 self.log.error("Phone Failed to Set Up Properly.") 251 return False 252 253 return self._sms_test_mo(ads) 254 255 @TelephonyBaseTest.tel_test_wrap 256 def test_sms_mt_2g(self): 257 """Test SMS basic function between two phone. Phones in 3g network. 258 259 Airplane mode is off. 260 Send SMS from PhoneB to PhoneA. 261 Verify received message on PhoneA is correct. 262 263 Returns: 264 True if success. 265 False if failed. 266 """ 267 ads = self.android_devices 268 269 tasks = [(phone_setup_voice_2g, (self.log, ads[0])), 270 (phone_setup_voice_general, (self.log, ads[1]))] 271 if not multithread_func(self.log, tasks): 272 self.log.error("Phone Failed to Set Up Properly.") 273 return False 274 275 return self._sms_test_mt(ads) 276 277 @TelephonyBaseTest.tel_test_wrap 278 def test_sms_mo_3g(self): 279 """Test SMS basic function between two phone. Phones in 3g network. 280 281 Airplane mode is off. 282 Send SMS from PhoneA to PhoneB. 283 Verify received message on PhoneB is correct. 284 285 Returns: 286 True if success. 287 False if failed. 288 """ 289 290 ads = self.android_devices 291 292 tasks = [(phone_setup_3g, (self.log, ads[0])), 293 (phone_setup_voice_general, (self.log, ads[1]))] 294 if not multithread_func(self.log, tasks): 295 self.log.error("Phone Failed to Set Up Properly.") 296 return False 297 298 return self._sms_test_mo(ads) 299 300 @TelephonyBaseTest.tel_test_wrap 301 def test_sms_mt_3g(self): 302 """Test SMS basic function between two phone. Phones in 3g network. 303 304 Airplane mode is off. 305 Send SMS from PhoneB to PhoneA. 306 Verify received message on PhoneA is correct. 307 308 Returns: 309 True if success. 310 False if failed. 311 """ 312 313 ads = self.android_devices 314 315 tasks = [(phone_setup_3g, (self.log, ads[0])), 316 (phone_setup_voice_general, (self.log, ads[1]))] 317 if not multithread_func(self.log, tasks): 318 self.log.error("Phone Failed to Set Up Properly.") 319 return False 320 321 return self._sms_test_mt(ads) 322 323 @TelephonyBaseTest.tel_test_wrap 324 def test_sms_mo_4g(self): 325 """Test SMS basic function between two phone. Phones in LTE network. 326 327 Airplane mode is off. 328 Send SMS from PhoneA to PhoneB. 329 Verify received message on PhoneB is correct. 330 331 Returns: 332 True if success. 333 False if failed. 334 """ 335 336 ads = self.android_devices 337 # TODO: this is a temporary fix for this test case. 338 # A better fix will be introduced once pag/539845 is merged. 339 if not phone_setup_voice_general(self.log, ads[1]): 340 self.log.error("Failed to setup PhoneB.") 341 return False 342 if not ensure_network_generation(self.log, ads[0], GEN_4G): 343 self.log.error("DUT Failed to Set Up Properly.") 344 return False 345 346 return self._sms_test_mo(ads) 347 348 @TelephonyBaseTest.tel_test_wrap 349 def test_sms_mt_4g(self): 350 """Test SMS basic function between two phone. Phones in LTE network. 351 352 Airplane mode is off. 353 Send SMS from PhoneB to PhoneA. 354 Verify received message on PhoneA is correct. 355 356 Returns: 357 True if success. 358 False if failed. 359 """ 360 361 ads = self.android_devices 362 363 # TODO: this is a temporary fix for this test case. 364 # A better fix will be introduced once pag/539845 is merged. 365 if not phone_setup_voice_general(self.log, ads[1]): 366 self.log.error("Failed to setup PhoneB.") 367 return False 368 if not ensure_network_generation(self.log, ads[0], GEN_4G): 369 self.log.error("DUT Failed to Set Up Properly.") 370 return False 371 372 return self._sms_test_mt(ads) 373 374 @TelephonyBaseTest.tel_test_wrap 375 def test_sms_mo_in_call_volte(self): 376 """ Test MO SMS during a MO VoLTE call. 377 378 Make Sure PhoneA is in LTE mode (with VoLTE). 379 Make Sure PhoneB is able to make/receive call. 380 Call from PhoneA to PhoneB, accept on PhoneB, send SMS on PhoneA. 381 382 Returns: 383 True if pass; False if fail. 384 """ 385 ads = self.android_devices 386 387 tasks = [(phone_setup_volte, (self.log, ads[0])), (phone_setup_volte, 388 (self.log, ads[1]))] 389 if not multithread_func(self.log, tasks): 390 self.log.error("Phone Failed to Set Up Properly.") 391 return False 392 393 self.log.info("Begin In Call SMS Test.") 394 if not call_setup_teardown(self.log, 395 ads[0], 396 ads[1], 397 ad_hangup=None, 398 verify_caller_func=is_phone_in_call_volte, 399 verify_callee_func=None): 400 return False 401 402 if not self._sms_test_mo(ads): 403 self.log.error("SMS test fail.") 404 return False 405 406 return True 407 408 @TelephonyBaseTest.tel_test_wrap 409 def test_sms_mt_in_call_volte(self): 410 """ Test MT SMS during a MO VoLTE call. 411 412 Make Sure PhoneA is in LTE mode (with VoLTE). 413 Make Sure PhoneB is able to make/receive call. 414 Call from PhoneA to PhoneB, accept on PhoneB, receive SMS on PhoneA. 415 416 Returns: 417 True if pass; False if fail. 418 """ 419 ads = self.android_devices 420 421 tasks = [(phone_setup_volte, (self.log, ads[0])), (phone_setup_volte, 422 (self.log, ads[1]))] 423 if not multithread_func(self.log, tasks): 424 self.log.error("Phone Failed to Set Up Properly.") 425 return False 426 427 self.log.info("Begin In Call SMS Test.") 428 if not call_setup_teardown(self.log, 429 ads[0], 430 ads[1], 431 ad_hangup=None, 432 verify_caller_func=is_phone_in_call_volte, 433 verify_callee_func=None): 434 return False 435 436 if not self._sms_test_mt(ads): 437 self.log.error("SMS test fail.") 438 return False 439 440 return True 441 442 @TelephonyBaseTest.tel_test_wrap 443 def test_sms_mo_in_call_wcdma(self): 444 """ Test MO SMS during a MO wcdma call. 445 446 Make Sure PhoneA is in wcdma mode. 447 Make Sure PhoneB is able to make/receive call. 448 Call from PhoneA to PhoneB, accept on PhoneB, send SMS on PhoneA. 449 450 Returns: 451 True if pass; False if fail. 452 """ 453 ads = self.android_devices 454 # make sure PhoneA is GSM phone before proceed. 455 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_GSM): 456 self.log.error("Not GSM phone, abort this wcdma SMS test.") 457 return False 458 459 tasks = [(phone_setup_3g, (self.log, ads[0])), 460 (phone_setup_voice_general, (self.log, ads[1]))] 461 if not multithread_func(self.log, tasks): 462 self.log.error("Phone Failed to Set Up Properly.") 463 return False 464 465 return self._mo_sms_in_3g_call(ads) 466 467 @TelephonyBaseTest.tel_test_wrap 468 def test_sms_mt_in_call_wcdma(self): 469 """ Test MT SMS during a MO wcdma call. 470 471 Make Sure PhoneA is in wcdma mode. 472 Make Sure PhoneB is able to make/receive call. 473 Call from PhoneA to PhoneB, accept on PhoneB, receive SMS on PhoneA. 474 475 Returns: 476 True if pass; False if fail. 477 """ 478 ads = self.android_devices 479 # make sure PhoneA is GSM phone before proceed. 480 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_GSM): 481 self.log.error("Not GSM phone, abort this wcdma SMS test.") 482 return False 483 484 tasks = [(phone_setup_3g, (self.log, ads[0])), 485 (phone_setup_voice_general, (self.log, ads[1]))] 486 if not multithread_func(self.log, tasks): 487 self.log.error("Phone Failed to Set Up Properly.") 488 return False 489 490 return self._mt_sms_in_3g_call(ads) 491 492 @TelephonyBaseTest.tel_test_wrap 493 def test_sms_mo_in_call_csfb(self): 494 """ Test MO SMS during a MO csfb wcdma/gsm call. 495 496 Make Sure PhoneA is in LTE mode (no VoLTE). 497 Make Sure PhoneB is able to make/receive call. 498 Call from PhoneA to PhoneB, accept on PhoneB, send SMS on PhoneA. 499 500 Returns: 501 True if pass; False if fail. 502 """ 503 ads = self.android_devices 504 # make sure PhoneA is GSM phone before proceed. 505 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_GSM): 506 self.log.error("Not GSM phone, abort this csfb wcdma SMS test.") 507 return False 508 509 tasks = [(phone_setup_csfb, (self.log, ads[0])), 510 (phone_setup_voice_general, (self.log, ads[1]))] 511 if not multithread_func(self.log, tasks): 512 self.log.error("Phone Failed to Set Up Properly.") 513 return False 514 515 self.log.info("Begin In Call SMS Test.") 516 if not call_setup_teardown(self.log, 517 ads[0], 518 ads[1], 519 ad_hangup=None, 520 verify_caller_func=is_phone_in_call_csfb, 521 verify_callee_func=None): 522 return False 523 524 if not self._sms_test_mo(ads): 525 self.log.error("SMS test fail.") 526 return False 527 528 return True 529 530 @TelephonyBaseTest.tel_test_wrap 531 def test_sms_mt_in_call_csfb(self): 532 """ Test MT SMS during a MO csfb wcdma/gsm call. 533 534 Make Sure PhoneA is in LTE mode (no VoLTE). 535 Make Sure PhoneB is able to make/receive call. 536 Call from PhoneA to PhoneB, accept on PhoneB, receive receive on PhoneA. 537 538 Returns: 539 True if pass; False if fail. 540 """ 541 ads = self.android_devices 542 # make sure PhoneA is GSM phone before proceed. 543 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_GSM): 544 self.log.error("Not GSM phone, abort this csfb wcdma SMS test.") 545 return False 546 547 tasks = [(phone_setup_csfb, (self.log, ads[0])), 548 (phone_setup_voice_general, (self.log, ads[1]))] 549 if not multithread_func(self.log, tasks): 550 self.log.error("Phone Failed to Set Up Properly.") 551 return False 552 553 self.log.info("Begin In Call SMS Test.") 554 if not call_setup_teardown(self.log, 555 ads[0], 556 ads[1], 557 ad_hangup=None, 558 verify_caller_func=is_phone_in_call_csfb, 559 verify_callee_func=None): 560 return False 561 562 if not self._sms_test_mt(ads): 563 self.log.error("SMS test fail.") 564 return False 565 566 return True 567 568 @TelephonyBaseTest.tel_test_wrap 569 def test_sms_mo_in_call_1x(self): 570 """ Test MO SMS during a MO 1x call. 571 572 Make Sure PhoneA is in 1x mode. 573 Make Sure PhoneB is able to make/receive call. 574 Call from PhoneA to PhoneB, accept on PhoneB, send SMS on PhoneA. 575 576 Returns: 577 True if pass; False if fail. 578 """ 579 ads = self.android_devices 580 # make sure PhoneA is CDMA phone before proceed. 581 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_CDMA): 582 self.log.error("Not CDMA phone, abort this 1x SMS test.") 583 return False 584 585 tasks = [(phone_setup_3g, (self.log, ads[0])), 586 (phone_setup_voice_general, (self.log, ads[1]))] 587 if not multithread_func(self.log, tasks): 588 self.log.error("Phone Failed to Set Up Properly.") 589 return False 590 591 self.log.info("Begin In Call SMS Test.") 592 if not call_setup_teardown(self.log, 593 ads[0], 594 ads[1], 595 ad_hangup=None, 596 verify_caller_func=is_phone_in_call_1x, 597 verify_callee_func=None): 598 return False 599 600 if not self._sms_test_mo(ads): 601 self.log.error("SMS test fail.") 602 return False 603 604 return True 605 606 @TelephonyBaseTest.tel_test_wrap 607 def test_sms_mt_in_call_1x(self): 608 """ Test MT SMS during a MO 1x call. 609 610 Make Sure PhoneA is in 1x mode. 611 Make Sure PhoneB is able to make/receive call. 612 Call from PhoneA to PhoneB, accept on PhoneB, receive SMS on PhoneA. 613 614 Returns: 615 True if pass; False if fail. 616 """ 617 ads = self.android_devices 618 # make sure PhoneA is CDMA phone before proceed. 619 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_CDMA): 620 self.log.error("Not CDMA phone, abort this 1x SMS test.") 621 return False 622 623 tasks = [(phone_setup_3g, (self.log, ads[0])), 624 (phone_setup_voice_general, (self.log, ads[1]))] 625 if not multithread_func(self.log, tasks): 626 self.log.error("Phone Failed to Set Up Properly.") 627 return False 628 629 self.log.info("Begin In Call SMS Test.") 630 if not call_setup_teardown(self.log, 631 ads[0], 632 ads[1], 633 ad_hangup=None, 634 verify_caller_func=is_phone_in_call_1x, 635 verify_callee_func=None): 636 return False 637 638 if not self._sms_test_mt(ads): 639 self.log.error("SMS test fail.") 640 return False 641 642 return True 643 644 @TelephonyBaseTest.tel_test_wrap 645 def test_sms_mo_in_call_csfb_1x(self): 646 """ Test MO SMS during a MO csfb 1x call. 647 648 Make Sure PhoneA is in LTE mode (no VoLTE). 649 Make Sure PhoneB is able to make/receive call. 650 Call from PhoneA to PhoneB, accept on PhoneB, send SMS on PhoneA. 651 652 Returns: 653 True if pass; False if fail. 654 """ 655 ads = self.android_devices 656 # make sure PhoneA is CDMA phone before proceed. 657 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_CDMA): 658 self.log.error("Not CDMA phone, abort this csfb 1x SMS test.") 659 return False 660 661 tasks = [(phone_setup_csfb, (self.log, ads[0])), 662 (phone_setup_voice_general, (self.log, ads[1]))] 663 if not multithread_func(self.log, tasks): 664 self.log.error("Phone Failed to Set Up Properly.") 665 return False 666 667 self.log.info("Begin In Call SMS Test.") 668 if not call_setup_teardown(self.log, 669 ads[0], 670 ads[1], 671 ad_hangup=None, 672 verify_caller_func=is_phone_in_call_1x, 673 verify_callee_func=None): 674 return False 675 676 if not self._sms_test_mo(ads): 677 self.log.error("SMS test fail.") 678 return False 679 680 return True 681 682 @TelephonyBaseTest.tel_test_wrap 683 def test_sms_mt_in_call_csfb_1x(self): 684 """ Test MT SMS during a MO csfb 1x call. 685 686 Make Sure PhoneA is in LTE mode (no VoLTE). 687 Make Sure PhoneB is able to make/receive call. 688 Call from PhoneA to PhoneB, accept on PhoneB, receive SMS on PhoneA. 689 690 Returns: 691 True if pass; False if fail. 692 """ 693 ads = self.android_devices 694 # make sure PhoneA is CDMA phone before proceed. 695 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_CDMA): 696 self.log.error("Not CDMA phone, abort this csfb 1x SMS test.") 697 return False 698 699 tasks = [(phone_setup_csfb, (self.log, ads[0])), 700 (phone_setup_voice_general, (self.log, ads[1]))] 701 if not multithread_func(self.log, tasks): 702 self.log.error("Phone Failed to Set Up Properly.") 703 return False 704 705 self.log.info("Begin In Call SMS Test.") 706 if not call_setup_teardown(self.log, 707 ads[0], 708 ads[1], 709 ad_hangup=None, 710 verify_caller_func=is_phone_in_call_1x, 711 verify_callee_func=None): 712 return False 713 714 if not self._sms_test_mt(ads): 715 self.log.error("SMS test fail.") 716 return False 717 718 return True 719 720 @TelephonyBaseTest.tel_test_wrap 721 def test_sms_mo_iwlan(self): 722 """ Test MO SMS, Phone in APM, WiFi connected, WFC WiFi Preferred mode. 723 724 Make Sure PhoneA APM, WiFi connected, WFC WiFi preferred mode. 725 Make sure PhoneA report iwlan as data rat. 726 Make Sure PhoneB is able to make/receive call/sms. 727 Send SMS on PhoneA. 728 729 Returns: 730 True if pass; False if fail. 731 """ 732 733 ads = self.android_devices 734 735 tasks = [(phone_setup_iwlan, 736 (self.log, ads[0], True, WFC_MODE_WIFI_PREFERRED, 737 self.wifi_network_ssid, self.wifi_network_pass)), 738 (phone_setup_voice_general, (self.log, ads[1]))] 739 if not multithread_func(self.log, tasks): 740 self.log.error("Phone Failed to Set Up Properly.") 741 return False 742 743 return self._sms_test_mo(ads) 744 745 @TelephonyBaseTest.tel_test_wrap 746 def test_sms_mt_iwlan(self): 747 """ Test MT SMS, Phone in APM, WiFi connected, WFC WiFi Preferred mode. 748 749 Make Sure PhoneA APM, WiFi connected, WFC WiFi preferred mode. 750 Make sure PhoneA report iwlan as data rat. 751 Make Sure PhoneB is able to make/receive call/sms. 752 Receive SMS on PhoneA. 753 754 Returns: 755 True if pass; False if fail. 756 """ 757 758 ads = self.android_devices 759 760 tasks = [(phone_setup_iwlan, 761 (self.log, ads[0], True, WFC_MODE_WIFI_PREFERRED, 762 self.wifi_network_ssid, self.wifi_network_pass)), 763 (phone_setup_voice_general, (self.log, ads[1]))] 764 if not multithread_func(self.log, tasks): 765 self.log.error("Phone Failed to Set Up Properly.") 766 return False 767 768 return self._sms_test_mt(ads) 769 770 @TelephonyBaseTest.tel_test_wrap 771 def test_sms_mo_in_call_iwlan(self): 772 """ Test MO SMS, Phone in APM, WiFi connected, WFC WiFi Preferred mode. 773 774 Make Sure PhoneA APM, WiFi connected, WFC WiFi preferred mode. 775 Make sure PhoneA report iwlan as data rat. 776 Make Sure PhoneB is able to make/receive call/sms. 777 Call from PhoneA to PhoneB, accept on PhoneB. 778 Send SMS on PhoneA. 779 780 Returns: 781 True if pass; False if fail. 782 """ 783 784 ads = self.android_devices 785 786 tasks = [(phone_setup_iwlan, 787 (self.log, ads[0], True, WFC_MODE_WIFI_PREFERRED, 788 self.wifi_network_ssid, self.wifi_network_pass)), 789 (phone_setup_voice_general, (self.log, ads[1]))] 790 if not multithread_func(self.log, tasks): 791 self.log.error("Phone Failed to Set Up Properly.") 792 return False 793 794 self.log.info("Begin In Call SMS Test.") 795 if not call_setup_teardown(self.log, 796 ads[0], 797 ads[1], 798 ad_hangup=None, 799 verify_caller_func=is_phone_in_call_iwlan, 800 verify_callee_func=None): 801 return False 802 803 return self._sms_test_mo(ads) 804 805 @TelephonyBaseTest.tel_test_wrap 806 def test_sms_mt_in_call_iwlan(self): 807 """ Test MT SMS, Phone in APM, WiFi connected, WFC WiFi Preferred mode. 808 809 Make Sure PhoneA APM, WiFi connected, WFC WiFi preferred mode. 810 Make sure PhoneA report iwlan as data rat. 811 Make Sure PhoneB is able to make/receive call/sms. 812 Call from PhoneA to PhoneB, accept on PhoneB. 813 Receive SMS on PhoneA. 814 815 Returns: 816 True if pass; False if fail. 817 """ 818 819 ads = self.android_devices 820 821 tasks = [(phone_setup_iwlan, 822 (self.log, ads[0], True, WFC_MODE_WIFI_PREFERRED, 823 self.wifi_network_ssid, self.wifi_network_pass)), 824 (phone_setup_voice_general, (self.log, ads[1]))] 825 if not multithread_func(self.log, tasks): 826 self.log.error("Phone Failed to Set Up Properly.") 827 return False 828 829 self.log.info("Begin In Call SMS Test.") 830 if not call_setup_teardown(self.log, 831 ads[0], 832 ads[1], 833 ad_hangup=None, 834 verify_caller_func=is_phone_in_call_iwlan, 835 verify_callee_func=None): 836 return False 837 838 return self._sms_test_mt(ads) 839 840 @TelephonyBaseTest.tel_test_wrap 841 def test_sms_mo_in_call_vt(self): 842 """ Test MO SMS, Phone in ongoing VT call. 843 844 Make Sure PhoneA and PhoneB in LTE and can make VT call. 845 Make Video Call from PhoneA to PhoneB, accept on PhoneB as Video Call. 846 Send SMS on PhoneA. 847 848 Returns: 849 True if pass; False if fail. 850 """ 851 ads = self.android_devices 852 853 tasks = [(phone_setup_video, (self.log, ads[0])), (phone_setup_video, 854 (self.log, ads[1]))] 855 if not multithread_func(self.log, tasks): 856 self.log.error("Phone Failed to Set Up Properly.") 857 return False 858 859 if not video_call_setup_teardown( 860 self.log, 861 ads[0], 862 ads[1], 863 None, 864 video_state=VT_STATE_BIDIRECTIONAL, 865 verify_caller_func=is_phone_in_call_video_bidirectional, 866 verify_callee_func=is_phone_in_call_video_bidirectional): 867 self.log.error("Failed to setup a call") 868 return False 869 870 return self._sms_test_mo(ads) 871 872 @TelephonyBaseTest.tel_test_wrap 873 def test_sms_mt_in_call_vt(self): 874 """ Test MT SMS, Phone in ongoing VT call. 875 876 Make Sure PhoneA and PhoneB in LTE and can make VT call. 877 Make Video Call from PhoneA to PhoneB, accept on PhoneB as Video Call. 878 Receive SMS on PhoneA. 879 880 Returns: 881 True if pass; False if fail. 882 """ 883 ads = self.android_devices 884 885 tasks = [(phone_setup_video, (self.log, ads[0])), (phone_setup_video, 886 (self.log, ads[1]))] 887 if not multithread_func(self.log, tasks): 888 self.log.error("Phone Failed to Set Up Properly.") 889 return False 890 891 if not video_call_setup_teardown( 892 self.log, 893 ads[0], 894 ads[1], 895 None, 896 video_state=VT_STATE_BIDIRECTIONAL, 897 verify_caller_func=is_phone_in_call_video_bidirectional, 898 verify_callee_func=is_phone_in_call_video_bidirectional): 899 self.log.error("Failed to setup a call") 900 return False 901 902 return self._sms_test_mt(ads) 903 904 @TelephonyBaseTest.tel_test_wrap 905 def test_mms_mo_4g(self): 906 """Test MMS text function between two phone. Phones in LTE network. 907 908 Airplane mode is off. 909 Send SMS from PhoneA to PhoneB. 910 Verify received message on PhoneB is correct. 911 912 Returns: 913 True if success. 914 False if failed. 915 """ 916 917 self.log.error("Test Case is non-functional: b/21569494") 918 return False 919 920 ads = self.android_devices 921 922 tasks = [(phone_setup_csfb, (self.log, ads[0])), 923 (phone_setup_voice_general, (self.log, ads[1]))] 924 if not multithread_func(self.log, tasks): 925 self.log.error("Phone Failed to Set Up Properly.") 926 return False 927 928 return mms_send_receive_verify( 929 self.log, ads[0], ads[1], 930 [("Test Message", "Basic Message Body", None)]) 931 932 @TelephonyBaseTest.tel_test_wrap 933 def test_mms_mt_4g(self): 934 """Test MMS text function between two phone. Phones in LTE network. 935 936 Airplane mode is off. 937 Send SMS from PhoneB to PhoneA. 938 Verify received message on PhoneA is correct. 939 940 Returns: 941 True if success. 942 False if failed. 943 """ 944 945 self.log.error("Test Case is non-functional: b/21569494") 946 return False 947 948 ads = self.android_devices 949 950 tasks = [(phone_setup_csfb, (self.log, ads[0])), 951 (phone_setup_voice_general, (self.log, ads[1]))] 952 if not multithread_func(self.log, tasks): 953 self.log.error("Phone Failed to Set Up Properly.") 954 return False 955 956 return mms_send_receive_verify( 957 self.log, ads[1], ads[0], 958 [("Test Message", "Basic Message Body", None)]) 959 960 @TelephonyBaseTest.tel_test_wrap 961 def test_sms_mo_in_call_gsm(self): 962 """ Test MO SMS during a MO gsm call. 963 964 Make Sure PhoneA is in gsm mode. 965 Make Sure PhoneB is able to make/receive call. 966 Call from PhoneA to PhoneB, accept on PhoneB, send SMS on PhoneA. 967 968 Returns: 969 True if pass; False if fail. 970 """ 971 ads = self.android_devices 972 # make sure PhoneA is GSM phone before proceed. 973 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_GSM): 974 self.log.error("Not GSM phone, abort this gsm SMS test.") 975 return False 976 977 tasks = [(phone_setup_voice_2g, (self.log, ads[0])), 978 (phone_setup_voice_general, (self.log, ads[1]))] 979 if not multithread_func(self.log, tasks): 980 self.log.error("Phone Failed to Set Up Properly.") 981 return False 982 983 self.log.info("Begin In Call SMS Test.") 984 if not call_setup_teardown(self.log, 985 ads[0], 986 ads[1], 987 ad_hangup=None, 988 verify_caller_func=is_phone_in_call_2g, 989 verify_callee_func=None): 990 return False 991 992 if not self._sms_test_mo(ads): 993 self.log.error("SMS test fail.") 994 return False 995 996 return True 997 998 @TelephonyBaseTest.tel_test_wrap 999 def test_sms_mt_in_call_gsm(self): 1000 """ Test MT SMS during a MO gsm call. 1001 1002 Make Sure PhoneA is in gsm mode. 1003 Make Sure PhoneB is able to make/receive call. 1004 Call from PhoneA to PhoneB, accept on PhoneB, receive SMS on PhoneA. 1005 1006 Returns: 1007 True if pass; False if fail. 1008 """ 1009 ads = self.android_devices 1010 # make sure PhoneA is GSM phone before proceed. 1011 if (ads[0].droid.telephonyGetPhoneType() != PHONE_TYPE_GSM): 1012 self.log.error("Not GSM phone, abort this gsm SMS test.") 1013 return False 1014 1015 tasks = [(phone_setup_voice_2g, (self.log, ads[0])), 1016 (phone_setup_voice_general, (self.log, ads[1]))] 1017 if not multithread_func(self.log, tasks): 1018 self.log.error("Phone Failed to Set Up Properly.") 1019 return False 1020 1021 self.log.info("Begin In Call SMS Test.") 1022 if not call_setup_teardown(self.log, 1023 ads[0], 1024 ads[1], 1025 ad_hangup=None, 1026 verify_caller_func=is_phone_in_call_2g, 1027 verify_callee_func=None): 1028 return False 1029 1030 if not self._sms_test_mt(ads): 1031 self.log.error("SMS test fail.") 1032 return False 1033 1034 return True 1035 1036 """ Tests End """ 1037