summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNate Jiang <qiangjiang@google.com>2020-05-26 21:12:30 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-05-26 21:12:30 +0000
commitc11cd31f25516662ea9a8d6b774d9e591a3fda91 (patch)
treeb3fcd2a0c40abe4cfb99654fc22605c65bdb9ed3 /tests
parentc57a88d72e9d0f87d1bf4135ddb2bb02df67762c (diff)
parenta5876c400a1624ecfb3fda8d327dbf9ed4cf88d3 (diff)
Merge "[Passpoint] Pass the auto-join flag with WifiConfig" into rvc-dev
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.