diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2017-03-23 20:22:26 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-03-23 20:22:27 +0000 |
commit | 26b510e6306c9776e7a9fde5f800c9c58bc075d6 (patch) | |
tree | d97bcb6cd7705ad331d0ccaf926c56eec21c7558 /tests | |
parent | 4990cf1ecd9df8da76ea60b56c414ff3271b30ce (diff) | |
parent | 3a86cc60b6cd3a5eb7b4982ba98f7e71ad45915e (diff) |
Merge "hotspot2: allow Process.WIFI_UID to modify Passpoint networks"
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java index 61c74180e..20b89dfc3 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java @@ -35,6 +35,7 @@ import android.net.wifi.WifiEnterpriseConfig; import android.net.wifi.WifiManager; import android.net.wifi.WifiScanner; import android.net.wifi.WifiSsid; +import android.os.Process; import android.os.UserHandle; import android.os.UserManager; import android.telephony.TelephonyManager; @@ -477,6 +478,30 @@ public class WifiConfigManagerTest { } /** + * Verify that a Passpoint network that's added by an app with {@link #TEST_CREATOR_UID} can + * be removed by WiFi Service with {@link Process#WIFI_UID}. + * + * @throws Exception + */ + @Test + public void testRemovePasspointNetworkAddedByOther() throws Exception { + WifiConfiguration passpointNetwork = WifiConfigurationTestUtil.createPasspointNetwork(); + + // Passpoint network is added using TEST_CREATOR_UID. + verifyAddPasspointNetworkToWifiConfigManager(passpointNetwork); + // Ensure that configured network list is not empty. + assertFalse(mWifiConfigManager.getConfiguredNetworks().isEmpty()); + + assertTrue(mWifiConfigManager.removeNetwork(passpointNetwork.networkId, Process.WIFI_UID)); + + // Verify keys are not being removed. + verify(mWifiKeyStore, never()).removeKeys(any(WifiEnterpriseConfig.class)); + verifyNetworkRemoveBroadcast(passpointNetwork); + // Ensure that the write was not invoked for Passpoint network remove. + mContextConfigStoreMockOrder.verify(mWifiConfigStore, never()).write(anyBoolean()); + + } + /** * Verifies the addition & update of multiple networks using * {@link WifiConfigManager#addOrUpdateNetwork(WifiConfiguration, int)} and the * removal of networks using |