summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNate Jiang <qiangjiang@google.com>2019-05-23 21:46:12 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-05-23 21:46:12 +0000
commita30605165bd83649083c484bd7e993c5043093ce (patch)
tree1bf649a3ab029bd01f944e43359ac6a191b48043
parentabf302c71911ba433e9895e5cbadbfc28cdb5664 (diff)
parentfe44291222d89a1aaba67329a46e494e8f6e38b4 (diff)
downloadplatform_tools_test_connectivity-a30605165bd83649083c484bd7e993c5043093ce.tar.gz
platform_tools_test_connectivity-a30605165bd83649083c484bd7e993c5043093ce.tar.bz2
platform_tools_test_connectivity-a30605165bd83649083c484bd7e993c5043093ce.zip
Merge "[ACTS][AWARE] test Aware service break by iff down&up" into qt-dev
-rw-r--r--acts/tests/google/wifi/aware/functional/NonConcurrencyTest.py72
1 files changed, 72 insertions, 0 deletions
diff --git a/acts/tests/google/wifi/aware/functional/NonConcurrencyTest.py b/acts/tests/google/wifi/aware/functional/NonConcurrencyTest.py
index c418c691ac..369d5d0633 100644
--- a/acts/tests/google/wifi/aware/functional/NonConcurrencyTest.py
+++ b/acts/tests/google/wifi/aware/functional/NonConcurrencyTest.py
@@ -15,11 +15,17 @@
# limitations under the License.
from acts import asserts
+import queue
+from acts import utils
from acts.test_utils.wifi import wifi_test_utils as wutils
+from acts.test_utils.wifi import wifi_constants as wconsts
from acts.test_utils.wifi.aware import aware_const as aconsts
from acts.test_utils.wifi.aware import aware_test_utils as autils
from acts.test_utils.wifi.aware.AwareBaseTest import AwareBaseTest
+# arbitrary timeout for events
+EVENT_TIMEOUT = 10
+
class NonConcurrencyTest(AwareBaseTest):
"""Tests lack of concurrency scenarios Wi-Fi Aware with WFD (p2p) and
@@ -95,6 +101,68 @@ class NonConcurrencyTest(AwareBaseTest):
dut.droid.wifiAwareAttach()
autils.wait_for_event(dut, aconsts.EVENT_CB_ON_ATTACHED)
+ def run_aware_then_connect_to_new_ap(self):
+ """Validate interaction of Wi-Fi Aware and infra (STA) association with randomized MAC
+ address. Such an association may trigger interface down and up - possibly disrupting a Wi-Fi
+ Aware session.
+
+ Test behavior:
+ - Start Aware
+ - Associate STA
+ - Check if an Aware state change Broadcast received
+ - If necessary (Broadcast received) restart Aware
+ - Start publish
+ - Start Subscribe on peer
+ - Verify discovery
+ """
+ dut = self.android_devices[0]
+ dut_ap = self.android_devices[1]
+ wutils.reset_wifi(dut)
+ wutils.reset_wifi(dut_ap)
+ p_config = autils.create_discovery_config(self.SERVICE_NAME,
+ aconsts.PUBLISH_TYPE_UNSOLICITED)
+ s_config = autils.create_discovery_config(self.SERVICE_NAME,
+ aconsts.SUBSCRIBE_TYPE_PASSIVE)
+
+ # create random SSID and start softAp on dut_ap
+ ap_ssid = self.TETHER_SSID + utils.rand_ascii_str(8)
+ ap_password = utils.rand_ascii_str(8)
+ config = {wutils.WifiEnums.SSID_KEY: ap_ssid, wutils.WifiEnums.PWD_KEY: ap_password}
+ wutils.start_wifi_tethering(dut_ap, ap_ssid, ap_password)
+ asserts.assert_true(dut_ap.droid.wifiIsApEnabled(),
+ "SoftAp is not reported as running")
+
+ # dut start Aware attach and connect to softAp on dut_ap
+ p_id = dut.droid.wifiAwareAttach()
+ autils.wait_for_event(dut, aconsts.EVENT_CB_ON_ATTACHED)
+
+ wutils.wifi_connect(dut, config, check_connectivity=False)
+ autils.wait_for_event(dut, wconsts.WIFI_STATE_CHANGED)
+
+ # Check if the WifiAwareState changes then restart the Aware
+ try:
+ dut.ed.pop_event(aconsts.BROADCAST_WIFI_AWARE_AVAILABLE, EVENT_TIMEOUT)
+ dut.log.info(aconsts.BROADCAST_WIFI_AWARE_AVAILABLE)
+ p_id = dut.droid.wifiAwareAttach()
+ autils.wait_for_event(dut, aconsts.EVENT_CB_ON_ATTACHED)
+ except queue.Empty:
+ dut.log.info('WifiAware state was not changed')
+
+ # dut start Publish
+ p_disc_id = dut.droid.wifiAwarePublish(p_id, p_config)
+ autils.wait_for_event(dut, aconsts.SESSION_CB_ON_PUBLISH_STARTED)
+
+ # dut_ap stop softAp and start Subscribe
+ wutils.stop_wifi_tethering(dut_ap)
+ autils.wait_for_event(dut_ap, aconsts.BROADCAST_WIFI_AWARE_AVAILABLE)
+ s_id = dut_ap.droid.wifiAwareAttach()
+ autils.wait_for_event(dut_ap, aconsts.EVENT_CB_ON_ATTACHED)
+ s_disc_id = dut_ap.droid.wifiAwareSubscribe(s_id, s_config)
+ autils.wait_for_event(dut_ap, aconsts.SESSION_CB_ON_SUBSCRIBE_STARTED)
+
+ # Check discovery session
+ autils.wait_for_event(dut_ap, aconsts.SESSION_CB_ON_SERVICE_DISCOVERED)
+
##########################################################################
def test_run_p2p_then_aware(self):
@@ -113,3 +181,7 @@ class NonConcurrencyTest(AwareBaseTest):
"""Validate that a running Aware session terminates when softAp is
started"""
self.run_aware_then_incompat_service(is_p2p=False)
+
+ def test_run_aware_then_connect_new_ap(self):
+ """Validate connect new ap during Aware session"""
+ self.run_aware_then_connect_to_new_ap()