Add test for enable/disable auto join
Test auto join API for suggestion, saved network and passpoint network.
Bug: 139199957
Test: acts test_user_override_auto_join_on_passpoint_network
Test: acts test_enable_disable_auto_join_saved_network
Test: acts test_user_override_auto_join_on_network_suggestion
Change-Id: I3e709bd94fb147e08e87a1075da85d0e76afa198
diff --git a/acts/tests/google/wifi/WifiManagerTest.py b/acts/tests/google/wifi/WifiManagerTest.py
index 9e46a7b..9686a7f 100644
--- a/acts/tests/google/wifi/WifiManagerTest.py
+++ b/acts/tests/google/wifi/WifiManagerTest.py
@@ -964,3 +964,30 @@
except queue.Empty:
asserts.fail(
"Wi-Fi scan results did not become available within 60s.")
+
+ @test_tracker_info(uuid="")
+ def test_enable_disable_auto_join_saved_network(self):
+ """
+ Add a saved network, simulate user change the auto join to false, ensure the device doesn't
+ auto connect to this network
+
+ Steps:
+ 1. Create a saved network.
+ 2. Add this saved network, and ensure we connect to this network
+ 3. Simulate user change the auto join to false.
+ 4. Toggle the Wifi off and on
+ 4. Ensure device doesn't connect to his network
+ """
+ network = self.open_network_5g
+ wutils.connect_to_wifi_network(self.dut, network)
+ info = self.dut.droid.wifiGetConnectionInfo()
+ network_id = info[WifiEnums.NETID_KEY]
+ self.dut.log.info("Disable auto join on network")
+ self.dut.droid.wifiEnableAutojoin(network_id, False)
+ wutils.wifi_toggle_state(self.dut, False)
+ wutils.wifi_toggle_state(self.dut, True)
+ asserts.assert_false(
+ wutils.wait_for_connect(self.dut, network[WifiEnums.SSID_KEY],
+ assert_on_fail=False), "Device should not connect.")
+ self.dut.droid.wifiEnableAutojoin(network_id, True)
+ wutils.wait_for_connect(self.dut, network[WifiEnums.SSID_KEY], assert_on_fail=False)
diff --git a/acts/tests/google/wifi/WifiNetworkSuggestionTest.py b/acts/tests/google/wifi/WifiNetworkSuggestionTest.py
index 9e3981d..9adf236 100644
--- a/acts/tests/google/wifi/WifiNetworkSuggestionTest.py
+++ b/acts/tests/google/wifi/WifiNetworkSuggestionTest.py
@@ -149,7 +149,7 @@
if expect_post_connection_broadcast is not None:
self.dut.droid.wifiStartTrackingNetworkSuggestionStateChange()
- self.dut.log.info("Adding network suggestions");
+ self.dut.log.info("Adding network suggestions")
asserts.assert_true(
self.dut.droid.wifiAddNetworkSuggestions(network_suggestions),
"Failed to add suggestions")
@@ -580,3 +580,58 @@
self.dut, passpoint_config[WifiEnums.SSID_KEY])
time.sleep(PASSPOINT_TIMEOUT)
wutils.wait_for_connect(self.dut, passpoint_config[WifiEnums.SSID_KEY])
+
+ @test_tracker_info(uuid="")
+ def test_initial_auto_join_on_network_suggestion(self):
+ """
+ Add a network suggestion with enableAutojoin bit set to false, ensure the device doesn't
+ auto connect to this network
+
+ Steps:
+ 1. Create a network suggestion.
+ 2. Set EnableAutojoin to false.
+ 3. Add this suggestion
+ 4. Ensure device doesn't connect to his network
+ """
+ network_suggestion = self.open_5g
+ # Set suggestion auto join initial to false.
+ network_suggestion["enableAutojoin"] = False
+ self.dut.log.info("Adding network suggestions")
+ asserts.assert_true(
+ self.dut.droid.wifiAddNetworkSuggestions([network_suggestion]),
+ "Failed to add suggestions")
+ # Enable suggestions by the app.
+ self.dut.log.debug("Enabling suggestions from test")
+ self.set_approved(True)
+ wutils.start_wifi_connection_scan_and_return_status(self.dut)
+ asserts.assert_false(
+ wutils.wait_for_connect(self.dut, network_suggestion[WifiEnums.SSID_KEY],
+ assert_on_fail=False), "Device should not connect.")
+
+ @test_tracker_info(uuid="")
+ def test_user_override_auto_join_on_network_suggestion(self):
+ """
+ Add a network suggestion, user change the auto join to false, ensure the device doesn't
+ auto connect to this network
+
+ Steps:
+ 1. Create a network suggestion.
+ 2. Add this suggestion, and ensure we connect to this network
+ 3. Simulate user change the auto join to false.
+ 4. Toggle the Wifi off and on
+ 4. Ensure device doesn't connect to his network
+ """
+ network_suggestion = self.open_5g
+ self.add_suggestions_and_ensure_connection([network_suggestion],
+ network_suggestion[WifiEnums.SSID_KEY], False)
+ wifi_info = self.dut.droid.wifiGetConnectionInfo()
+ self.dut.log.info(wifi_info)
+ network_id = wifi_info[WifiEnums.NETID_KEY]
+ # Simulate user disable auto join through Settings.
+ self.dut.log.info("Disable auto join on suggestion")
+ self.dut.droid.wifiEnableAutojoin(network_id, False)
+ wutils.wifi_toggle_state(self.dut, False)
+ wutils.wifi_toggle_state(self.dut, True)
+ asserts.assert_false(
+ wutils.wait_for_connect(self.dut, network_suggestion[WifiEnums.SSID_KEY],
+ assert_on_fail=False), "Device should not connect.")
diff --git a/acts/tests/google/wifi/WifiPasspointTest.py b/acts/tests/google/wifi/WifiPasspointTest.py
index 94b3e18..cf72aab 100755
--- a/acts/tests/google/wifi/WifiPasspointTest.py
+++ b/acts/tests/google/wifi/WifiPasspointTest.py
@@ -391,3 +391,26 @@
@test_tracker_info(uuid="f43ea759-673f-4567-aa11-da3bc2cabf08")
def test_start_subscription_provisioning_and_toggle_wifi(self):
self.start_subscription_provisioning(TOGGLE)
+
+ @test_tracker_info(uuid="")
+ def test_user_override_auto_join_on_passpoint_network(self):
+ """Add a Passpoint network, simulate user change the auto join to false, ensure the device
+ doesn't auto connect to this passponit network
+
+ Steps:
+ 1. Install a Passpoint Profile.
+ 2. Verify the device connects to the required Passpoint SSID.
+ 3. Disable auto join Passpoint configuration using its FQDN.
+ 4. disable and enable Wifi toggle, ensure we don't connect back
+ """
+ passpoint_config = self.passpoint_networks[BOINGO]
+ self.install_passpoint_profile(passpoint_config)
+ ssid = passpoint_config[WifiEnums.SSID_KEY]
+ self.check_passpoint_connection(ssid)
+ self.dut.log.info("Disable auto join on passpoint")
+ self.dut.droid.wifiEnableAutojoinPasspoint(passpoint_config['fqdn'], False)
+ wutils.wifi_toggle_state(self.dut, False)
+ wutils.wifi_toggle_state(self.dut, True)
+ asserts.assert_false(
+ wutils.wait_for_connect(self.dut, ssid, assert_on_fail=False),
+ "Device should not connect.")