Adding data use case on wifiTeleCoexTest
Bug: 190484310
Test: Local test
Change-Id: I42ee71b50da02b4983ddac9eab2b7013b37c56e6
diff --git a/acts_tests/tests/google/wifi/WifiTeleCoexTest.py b/acts_tests/tests/google/wifi/WifiTeleCoexTest.py
index 9e93a9d..6619ba4 100644
--- a/acts_tests/tests/google/wifi/WifiTeleCoexTest.py
+++ b/acts_tests/tests/google/wifi/WifiTeleCoexTest.py
@@ -14,6 +14,13 @@
from acts_contrib.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest
from acts_contrib.test_utils.tel.tel_voice_utils import phone_setup_voice_general
from acts_contrib.test_utils.tel.tel_voice_utils import two_phone_call_short_seq
+from acts_contrib.test_utils.tel.tel_voice_utils import is_phone_in_call_iwlan
+from acts_contrib.test_utils.tel.tel_voice_utils import phone_idle_iwlan
+from acts_contrib.test_utils.tel.tel_defines import DIRECTION_MOBILE_ORIGINATED
+from acts_contrib.test_utils.tel.tel_defines import WFC_MODE_WIFI_PREFERRED
+from acts_contrib.test_utils.tel.tel_defines import GEN_4G
+from acts_contrib.test_utils.tel.tel_defines import NETWORK_SERVICE_DATA
+from acts_contrib.test_utils.net import net_test_utils as nutil
WifiEnums = wifi_utils.WifiEnums
@@ -46,11 +53,18 @@
def setup_test(self):
+ """ Setup test make sure the DUT is wake and screen unlock"""
+ for ad in self.android_devices:
+ ad.droid.wakeLockAcquireBright()
+ ad.droid.wakeUpNow()
wifi_utils.wifi_toggle_state(self.dut, True)
def teardown_test(self):
- wifi_utils.reset_wifi(self.dut)
+ """ End test make sure the DUT return idle"""
+ for ad in self.android_devices:
+ wifi_utils.reset_wifi(ad)
+ tele_utils.ensure_phones_idle(self.log, self.android_devices)
"""Helper Functions"""
@@ -170,6 +184,48 @@
two_phone_call_short_seq(self.log, self.ads[0], None, None, self.ads[1],
None, None)
+ def _phone_idle_iwlan(self):
+ return phone_idle_iwlan(self.log, self.android_devices[0])
+
+ def _wfc_phone_setup_apm_wifi_preferred(self):
+ return self._wfc_phone_setup(True, WFC_MODE_WIFI_PREFERRED)
+
+ def _wfc_phone_setup(self, is_airplane_mode, wfc_mode, volte_mode=True):
+ """Enables WiFi calling by turning off Airplane Mode and setting up volte
+
+ Args:
+ is_airplane_mode: boolean, True/False to turn on/off Airplane Mode.
+ wfc_mode: str, String stating what WFC Mode is used.
+ volte_mode: boolean, True/False to turn on/off VoLTE Mode.
+
+ Returns:
+ False, when 4G fails or wrong wfc_mode or WiFi does not connect,
+ (failure is logged) True otherwise.
+
+ """
+ tele_utils.toggle_airplane_mode(self.log, self.android_devices[0], False)
+ tele_utils.toggle_volte(self.log, self.android_devices[0], volte_mode)
+ if not tele_utils.ensure_network_generation(
+ self.log,
+ self.android_devices[0],
+ GEN_4G,
+ voice_or_data=NETWORK_SERVICE_DATA):
+ return False
+ if not tele_utils.set_wfc_mode(self.log, self.android_devices[0], wfc_mode):
+ self.log.error("{} set WFC mode failed.".format(
+ self.android_devices[0].serial))
+ return False
+ tele_utils.toggle_airplane_mode(self.log, self.android_devices[0],
+ is_airplane_mode)
+ if not tele_utils.ensure_wifi_connected(self.log, self.android_devices[0],
+ self.wifi_network_ssid,
+ self.wifi_network_pass):
+ self.log.error("{} connect WiFI failed".format(
+ self.android_devices[0].serial))
+ return False
+ return True
+
+
"""Tests"""
@@ -308,3 +364,93 @@
self.stress_toggle_airplane_and_wifi(self.stress_count)
self.validate_cellular_and_wifi()
return True
+
+ @test_tracker_info(uuid="7cd9698c-7cde-4c99-b73a-67a2246ca4ec")
+ @TelephonyBaseTest.tel_test_wrap
+ def test_toggle_WFC_call(self):
+
+ """Test to toggle WiFi and then perform WiFi connection and
+ cellular calls.
+
+ Raises:
+ signals.TestFailure:The Wifi calling test is failed.
+
+ Steps:
+ 1. Attach device to voice subscription network.
+ 2. Connect to a WiFi network.
+ 3. Turn on airplane mode
+ 4. Toggle WiFi OFF and ON.
+ 5. Make WiFi calling
+ 6. Verify device is in WiFi calling
+ 5. Hang up the call
+
+ Verification:
+ The device is using WiFi calling to call out.
+
+ """
+ mo_mt=[]
+ if mo_mt == DIRECTION_MOBILE_ORIGINATED:
+ ad_caller = self.ads[0]
+ ad_callee = self.ads[1]
+ else:
+ ad_caller = self.ads[1]
+ ad_callee = self.ads[0]
+ caller_number = tele_utils.get_phone_number(self.log, ad_caller)
+ callee_number = tele_utils.get_phone_number(self.log, ad_callee)
+ self._wfc_phone_setup_apm_wifi_preferred()
+
+ self.connect_to_wifi(self.dut, self.network)
+ asserts.assert_true(
+ acts.utils.force_airplane_mode(self.dut, True),
+ "Can not turn on airplane mode on: %s" % self.dut.serial)
+ time.sleep(1)
+ self.log.info("Toggling wifi ON")
+ wifi_utils.wifi_toggle_state(self.dut, True)
+ time.sleep(10)
+ tele_utils.initiate_call(self.log, ad_caller, callee_number)
+ tele_utils.wait_and_answer_call(self.log, ad_callee, caller_number)
+ if not self._phone_idle_iwlan():
+ self.log.error("no in wifi calling")
+ raise signals.TestFailure("The Wifi calling test is failed."
+ "WiFi State = %d" %self.dut.droid.wifiCheckState())
+ tele_utils.hangup_call(self.log, self.ads[0])
+
+ @test_tracker_info(uuid="c1f0e0a7-b651-4d6c-a4a5-f946cabf56ef")
+ @TelephonyBaseTest.tel_test_wrap
+ def test_back_to_back_of_the_modem_restart(self):
+
+ """Make sure DUT can connect to AP after modem restart
+
+ Raises:
+ signals.TestFailure: The Wifi connect failed after modem restart.
+
+ From b/171275893:
+ b/170702695 has modem back to back restart,
+ it causes WIFi failure and only reboot device can recover.
+ Currently modem team has this test case but they only check modem status.
+ Therefore, we need to add the same test case and the criteria is to check
+ if WiFi works well after back to back modem restart.
+ For the interval setting between 2 restarts, we suggest to use 20s.
+ We can change to different interval if necessary.
+
+ Steps:
+ 1.Restart the modem once
+ 2.Waiting for 20s
+ 3.Restart the modem again
+ 4.Go to Settings ->Network & internet ->Wi-Fi
+ 5.To check the DUT can find WiFi AP then connect it
+ Verification:
+ DUT can connect to AP successfully
+ DUT can access the Internet after connect to AP.
+
+ """
+ self.dut = self.android_devices[0]
+ try:
+ tele_utils.trigger_modem_crash_by_modem(self.dut)
+ time.sleep(20)
+ tele_utils.trigger_modem_crash_by_modem(self.dut)
+ time.sleep(20)
+ self.connect_to_wifi(self.dut, self.network)
+ except:
+ raise signals.TestFailure("The Wifi connect failed after modem restart."
+ "WiFi State = %d" %self.dut.droid.wifiCheckState())
\ No newline at end of file