Fixup Fuchsia's waiting for no wifi connections
If there are already no client connections, no update will be generated
when the device is requested to disconnect (e.g. by unsaving a network).
In a test like HiddenNetworksTest:test_auto_connect_hidden_on_save,
this causes a timeout when we await this update.
Fixup by forcing the reading of a new update each time.
Bug: None
Test: act.py -c ... -tc HiddenNetworksTest
Change-Id: I24cdf1f3b0d1f4017f5310767b8cf7f146fc9c39
diff --git a/acts/framework/acts/controllers/fuchsia_lib/lib_controllers/wlan_policy_controller.py b/acts/framework/acts/controllers/fuchsia_lib/lib_controllers/wlan_policy_controller.py
index 7fe7aa3..e5b8fce 100644
--- a/acts/framework/acts/controllers/fuchsia_lib/lib_controllers/wlan_policy_controller.py
+++ b/acts/framework/acts/controllers/fuchsia_lib/lib_controllers/wlan_policy_controller.py
@@ -497,6 +497,10 @@
Returns:
True, if successful. False, if still connected after timeout.
"""
+ # If there are already no existing connections when this function is called,
+ # then an update won't be generated by the device, and we'll time out.
+ # Force an update by getting a new listener.
+ self.device.wlan_policy_lib.wlanSetNewListener()
end_time = time.time() + timeout
while time.time() < end_time:
time_left = max(1, int(end_time - time.time()))