Home | History | Annotate | Download | only in live
      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 VT Data test
     18 """
     19 from acts.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest
     20 from acts.test_utils.tel.tel_defines import VT_STATE_BIDIRECTIONAL
     21 from acts.test_utils.tel.tel_test_utils import hangup_call
     22 from acts.test_utils.tel.tel_test_utils import multithread_func
     23 from acts.test_utils.tel.tel_test_utils import verify_http_connection
     24 from acts.test_utils.tel.tel_video_utils import \
     25     is_phone_in_call_video_bidirectional
     26 from acts.test_utils.tel.tel_video_utils import phone_setup_video
     27 from acts.test_utils.tel.tel_video_utils import video_call_setup_teardown
     28 from acts.utils import load_config
     29 
     30 
     31 class TelLiveVideoDataTest(TelephonyBaseTest):
     32     def __init__(self, controllers):
     33         TelephonyBaseTest.__init__(self, controllers)
     34         self.tests = (
     35             # Data during VT call
     36             "test_internet_access_during_video_call", )
     37 
     38         self.simconf = load_config(self.user_params["sim_conf_file"])
     39         self.stress_test_number = int(self.user_params["stress_test_number"])
     40         self.wifi_network_ssid = self.user_params["wifi_network_ssid"]
     41 
     42         try:
     43             self.wifi_network_pass = self.user_params["wifi_network_pass"]
     44         except KeyError:
     45             self.wifi_network_pass = None
     46 
     47     """ Tests Begin """
     48 
     49     @TelephonyBaseTest.tel_test_wrap
     50     def test_internet_access_during_video_call(self):
     51         """ Test Internet access during VT<->VT call.
     52 
     53         Make Sure PhoneA is in LTE mode (with Video Calling).
     54         Make Sure PhoneB is in LTE mode (with Video Calling).
     55         Call from PhoneA to PhoneB as Bi-Directional Video,
     56         Accept on PhoneB as video call.
     57         Verify PhoneA have Internet access.
     58         Hang up on PhoneA.
     59 
     60         Returns:
     61             True if pass; False if fail.
     62         """
     63         ads = self.android_devices
     64         tasks = [(phone_setup_video, (self.log, ads[0])), (phone_setup_video,
     65                                                            (self.log, ads[1]))]
     66         if not multithread_func(self.log, tasks):
     67             self.log.error("Phone Failed to Set Up Properly.")
     68             return False
     69 
     70         self.log.info("Step1: Make MO VT call.")
     71         if not video_call_setup_teardown(
     72                 self.log,
     73                 ads[0],
     74                 ads[1],
     75                 None,
     76                 video_state=VT_STATE_BIDIRECTIONAL,
     77                 verify_caller_func=is_phone_in_call_video_bidirectional,
     78                 verify_callee_func=is_phone_in_call_video_bidirectional):
     79             self.log.error("Failed to setup+teardown a call")
     80             return False
     81 
     82         self.log.info("Step2: Verify Internet on PhoneA.")
     83         if not verify_http_connection(self.log, ads[0]):
     84             self.log.error("Verify Internet on PhoneA failed.")
     85             return False
     86 
     87         return hangup_call(self.log, ads[0])
     88 
     89 
     90 """ Tests End """
     91