blob: adb1379b0b6a0db41e60b6d6f219752fd2431f25 [file] [log] [blame]
#!/usr/bin/env python3.4
#
# Copyright 2016 - Google
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Test Script for Telephony Pre Flight check.
"""
import time
from queue import Empty
from acts.test_decorators import test_tracker_info
from acts.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest
from acts.test_utils.tel.tel_defines import AOSP_PREFIX
from acts.test_utils.tel.tel_defines import CAPABILITY_PHONE
from acts.test_utils.tel.tel_defines import CAPABILITY_VOLTE
from acts.test_utils.tel.tel_defines import CAPABILITY_VT
from acts.test_utils.tel.tel_defines import CAPABILITY_WFC
from acts.test_utils.tel.tel_defines import CAPABILITY_MSIM
from acts.test_utils.tel.tel_defines import CAPABILITY_OMADM
from acts.test_utils.tel.tel_defines import INVALID_SUB_ID
from acts.test_utils.tel.tel_defines import MAX_WAIT_TIME_NW_SELECTION
from acts.test_utils.tel.tel_defines import PRECISE_CALL_STATE_LISTEN_LEVEL_BACKGROUND
from acts.test_utils.tel.tel_defines import PRECISE_CALL_STATE_LISTEN_LEVEL_FOREGROUND
from acts.test_utils.tel.tel_defines import PRECISE_CALL_STATE_LISTEN_LEVEL_RINGING
from acts.test_utils.tel.tel_defines import WAIT_TIME_AFTER_REBOOT
from acts.test_utils.tel.tel_lookup_tables import device_capabilities
from acts.test_utils.tel.tel_lookup_tables import operator_capabilities
from acts.test_utils.tel.tel_test_utils import abort_all_tests
from acts.test_utils.tel.tel_test_utils import ensure_phones_default_state
from acts.test_utils.tel.tel_test_utils import ensure_phone_subscription
from acts.test_utils.tel.tel_test_utils import ensure_wifi_connected
from acts.test_utils.tel.tel_test_utils import get_operator_name
from acts.test_utils.tel.tel_test_utils import setup_droid_properties
from acts.test_utils.tel.tel_test_utils import set_phone_screen_on
from acts.test_utils.tel.tel_test_utils import set_phone_silent_mode
from acts.test_utils.tel.tel_test_utils import toggle_airplane_mode
from acts.test_utils.tel.tel_test_utils import verify_http_connection
from acts.test_utils.tel.tel_test_utils import wait_for_voice_attach_for_subscription
from acts.test_utils.tel.tel_test_utils import wait_for_wifi_data_connection
from acts.test_utils.tel.tel_test_utils import wifi_toggle_state
from acts.test_utils.tel.tel_voice_utils import phone_setup_volte
from acts.asserts import abort_all
from acts.asserts import fail
class TelLivePreflightTest(TelephonyBaseTest):
def __init__(self, controllers):
TelephonyBaseTest.__init__(self, controllers)
self.wifi_network_ssid = self.user_params.get(
"wifi_network_ssid") or self.user_params.get("wifi_network_ssid_2g")
self.wifi_network_pass = self.user_params.get(
"wifi_network_pass") or self.user_params.get("wifi_network_pass_2g")
def setup_class(self):
pass
def setup_test(self):
pass
""" Tests Begin """
@test_tracker_info(uuid="8390a2eb-a744-4cda-bade-f94a2cc83f02")
@TelephonyBaseTest.tel_test_wrap
def test_check_environment(self):
ad = self.android_devices[0]
# Check WiFi environment.
# 1. Connect to WiFi.
# 2. Check WiFi have Internet access.
toggle_airplane_mode(self.log, ad, False, strict_checking=False)
try:
if not ensure_wifi_connected(self.log, ad, self.wifi_network_ssid,
self.wifi_network_pass):
abort_all_tests(ad.log, "WiFi connect fail")
if (not wait_for_wifi_data_connection(self.log, ad, True) or
not verify_http_connection(self.log, ad)):
abort_all_tests(ad.log, "Data not available on WiFi")
finally:
wifi_toggle_state(self.log, ad, False)
# TODO: add more environment check here.
return True
@test_tracker_info(uuid="7bb23ac7-6b7b-4d5e-b8d6-9dd10032b9ad")
@TelephonyBaseTest.tel_test_wrap
def test_pre_flight_check(self):
for ad in self.android_devices:
#check for sim and service
if not ensure_phone_subscription(self.log, ad):
abort_all_tests(ad.log, "Unable to find a valid subscription!")
return True
@test_tracker_info(uuid="1070b160-902b-43bf-92a0-92cc2d05bb13")
@TelephonyBaseTest.tel_test_wrap
def test_check_crash(self):
for ad in self.android_devices:
ad.crash_report_preflight = ad.check_crash_report(
self.test_id, None, True)
if ad.crash_report_preflight:
msg = "Find crash reports %s before test starts" % (
ad.crash_report_preflight)
ad.log.warn(msg)
return True