summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNate Jiang <qiangjiang@google.com>2020-05-21 10:17:40 -0700
committerNate Jiang <qiangjiang@google.com>2020-05-21 17:08:02 -0700
commita5876c400a1624ecfb3fda8d327dbf9ed4cf88d3 (patch)
tree4fcfe2279abfe489a7e5011fa807d4eef834d5bc /tests
parentfc548645bcae1106c15d51b840b7a630ac8572dd (diff)
[Passpoint] Pass the auto-join flag with WifiConfig
Set autojoin when update passpoin network in WifiConfigManager Bug: 157213975 Test: atest com.android.server.wifi Test: manually test Change-Id: If7807297073dcf0faaf31d62cc465c21cc7c5bd3
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointManagerTest.java4
-rw-r--r--tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointProviderTest.java11
2 files changed, 14 insertions, 1 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointManagerTest.java b/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointManagerTest.java
index 885cf87a3..94fe673c3 100644
--- a/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointManagerTest.java
@@ -32,7 +32,6 @@ import static android.net.wifi.WifiManager.EXTRA_SUBSCRIPTION_REMEDIATION_METHOD
import static android.net.wifi.WifiManager.EXTRA_URL;
import static com.android.server.wifi.WifiConfigurationTestUtil.SECURITY_EAP;
-import static com.android.server.wifi.WifiConfigurationTestUtil.TEST_NETWORK_ID;
import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder;
import static org.junit.Assert.assertEquals;
@@ -174,6 +173,7 @@ public class PasspointManagerTest extends WifiBaseTest {
private static final int TEST_CREATOR_UID = 1234;
private static final int TEST_CREATOR_UID1 = 1235;
private static final int TEST_UID = 1500;
+ private static final int TEST_NETWORK_ID = 2;
@Mock Context mContext;
@Mock WifiNative mWifiNative;
@@ -921,6 +921,7 @@ public class PasspointManagerTest extends WifiBaseTest {
origWifiConfig.getKey());
verify(mWifiConfigManager).addOrUpdateNetwork(
argThat((c) -> c.FQDN.equals(TEST_FQDN)), eq(TEST_CREATOR_UID), eq(TEST_PACKAGE));
+ verify(mWifiConfigManager).allowAutojoin(TEST_NETWORK_ID, origWifiConfig.allowAutojoin);
verify(mWifiConfigManager).saveToStore(true);
verify(mWifiMetrics).incrementNumPasspointProviderInstallation();
verify(mWifiMetrics).incrementNumPasspointProviderInstallSuccess();
@@ -2123,6 +2124,7 @@ public class PasspointManagerTest extends WifiBaseTest {
origWifiConfig.getKey());
verify(mWifiConfigManager).addOrUpdateNetwork(
argThat((c) -> c.FQDN.equals(TEST_FQDN)), eq(TEST_CREATOR_UID), eq(TEST_PACKAGE));
+ verify(mWifiConfigManager).allowAutojoin(TEST_NETWORK_ID, origWifiConfig.allowAutojoin);
verify(mWifiConfigManager).saveToStore(true);
verify(mWifiMetrics).incrementNumPasspointProviderInstallation();
verify(mWifiMetrics).incrementNumPasspointProviderInstallSuccess();
diff --git a/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointProviderTest.java b/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointProviderTest.java
index 19ced12fc..936a8c4c9 100644
--- a/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointProviderTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointProviderTest.java
@@ -1250,6 +1250,17 @@ public class PasspointProviderTest extends WifiBaseTest {
verifyWifiConfigWithTestData(config, mProvider.getWifiConfig());
}
+ @Test
+ public void getWifiConfigWithWithAutojoinDisable() throws Exception {
+ PasspointConfiguration config = generateTestPasspointConfiguration(
+ CredentialType.USER, false);
+ mProvider = createProvider(config);
+
+ assertTrue(mProvider.getWifiConfig().allowAutojoin);
+ mProvider.setAutojoinEnabled(false);
+ assertFalse(mProvider.getWifiConfig().allowAutojoin);
+ }
+
/**
* Verify that the mac randomization setting will be included in the generated
* WifiConfiguration.