summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEcco Park <eccopark@google.com>2019-04-05 16:50:19 -0700
committerEcco Park <eccopark@google.com>2019-04-08 13:41:45 -0700
commitcc083922b9871f1ca522972f1bafc8060a55e32e (patch)
tree83854fef2749f915cc720cb36a8d04970dd09a3f /tests
parent89bce6ef926ea42e0b77b9098e8bb41b6568c4da (diff)
Passpoint: allow Carrier Provisioning App to remove Passpoint profile.
Whenever sim is inserted/deleted, the app needs to add/remove the profiles for the carrier. Bug: 130053265 Test: ./frameworks/opt/net/wifi/tests/wifitests/runtests.sh Change-Id: I3c232c7f3d6404669a0b4594f845b72710eae909 Signed-off-by: Ecco Park <eccopark@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java20
1 files changed, 12 insertions, 8 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java
index dff73a9a3..ca5366b30 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java
@@ -2582,28 +2582,31 @@ public class WifiServiceImplTest {
/**
* Verify that the call to removePasspointConfiguration is not redirected to specific API
- * syncRemovePasspointConfig when the caller doesn't have NETWORK_SETTINGS permission.
+ * syncRemovePasspointConfig when the caller doesn't have NETWORK_SETTINGS and
+ * NETWORK_CARRIER_PROVISIONING permission.
*/
@Test(expected = SecurityException.class)
public void testRemovePasspointConfigurationWithOutPermissions() {
- when(mContext.checkCallingOrSelfPermission(
- eq(android.Manifest.permission.NETWORK_SETTINGS))).thenReturn(
- PackageManager.PERMISSION_DENIED);
+ when(mWifiPermissionsUtil.checkNetworkSettingsPermission(anyInt())).thenReturn(false);
+ when(mWifiPermissionsUtil.checkNetworkCarrierProvisioningPermission(anyInt())).thenReturn(
+ false);
mWifiServiceImpl.removePasspointConfiguration(null, null);
}
/**
* Verify that the call to removePasspointConfiguration for apps targeting below Q SDK will
- * return false if the caller doesn't have NETWORK_SETTINGS permission.
+ * return false if the caller doesn't have NETWORK_SETTINGS and NETWORK_CARRIER_PROVISIONING
+ * permission.
*/
@Test
public void testRemovePasspointConfigurationForAppsTargetingBelowQSDK() {
- when(mContext.checkCallingOrSelfPermission(
- eq(android.Manifest.permission.NETWORK_SETTINGS))).thenReturn(
- PackageManager.PERMISSION_DENIED);
+ when(mWifiPermissionsUtil.checkNetworkSettingsPermission(anyInt())).thenReturn(false);
+ when(mWifiPermissionsUtil.checkNetworkCarrierProvisioningPermission(anyInt())).thenReturn(
+ false);
when(mWifiPermissionsUtil.isTargetSdkLessThan(isNull(),
eq(Build.VERSION_CODES.Q))).thenReturn(true);
+
assertFalse(mWifiServiceImpl.removePasspointConfiguration(null, null));
}
@@ -3382,6 +3385,7 @@ public class WifiServiceImplTest {
when(mContext.checkPermission(eq(android.Manifest.permission.NETWORK_SETTINGS),
anyInt(), anyInt())).thenReturn(PackageManager.PERMISSION_GRANTED);
+ when(mWifiPermissionsUtil.checkNetworkSettingsPermission(anyInt())).thenReturn(true);
final String fqdn = "example.com";
WifiConfiguration network = WifiConfigurationTestUtil.createOpenNetwork();
PasspointConfiguration config = new PasspointConfiguration();