summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java15
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java16
2 files changed, 14 insertions, 17 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
index d551e7b94..fcc7c8764 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
@@ -132,7 +132,6 @@ public class WifiConfigManagerTest {
public static final String TAG = "WifiConfigManagerTest";
@Mock private Context mContext;
- @Mock private WifiStateMachine mWifiStateMachine;
@Mock private WifiNative mWifiNative;
@Mock private FrameworkFacade mFrameworkFacade;
@Mock private UserManager mUserManager;
@@ -156,8 +155,7 @@ public class WifiConfigManagerTest {
when(mContext.getResources()).thenReturn(realContext.getResources());
when(mContext.getPackageManager()).thenReturn(realContext.getPackageManager());
- when(mWifiStateMachine.getCurrentUserId()).thenReturn(UserHandle.USER_SYSTEM);
- when(mWifiStateMachine.getCurrentUserProfiles())
+ when(mUserManager.getProfiles(UserHandle.USER_SYSTEM))
.thenReturn(USER_PROFILES.get(UserHandle.USER_SYSTEM));
for (int userId : USER_IDS) {
@@ -166,8 +164,8 @@ public class WifiConfigManagerTest {
mMockKeyStore = new MockKeyStore();
- mWifiConfigManager = new WifiConfigManager(mContext, mWifiStateMachine, mWifiNative,
- mFrameworkFacade, mClock, mUserManager, mMockKeyStore.createMock());
+ mWifiConfigManager = new WifiConfigManager(mContext, mWifiNative, mFrameworkFacade, mClock,
+ mUserManager, mMockKeyStore.createMock());
final Field configuredNetworksField =
WifiConfigManager.class.getDeclaredField("mConfiguredNetworks");
@@ -203,10 +201,9 @@ public class WifiConfigManagerTest {
}
private void switchUser(int newUserId) {
- when(mWifiStateMachine.getCurrentUserId()).thenReturn(newUserId);
- when(mWifiStateMachine.getCurrentUserProfiles())
+ when(mUserManager.getProfiles(newUserId))
.thenReturn(USER_PROFILES.get(newUserId));
- mWifiConfigManager.handleUserSwitch();
+ mWifiConfigManager.handleUserSwitch(newUserId);
}
private void switchUserToCreatorOrParentOf(WifiConfiguration config) {
@@ -219,7 +216,7 @@ public class WifiConfigManagerTest {
}
private void addNetworks() throws Exception {
- final int originalUserId = mWifiStateMachine.getCurrentUserId();
+ final int originalUserId = mWifiConfigManager.getCurrentUserId();
when(mWifiNative.setNetworkVariable(anyInt(), anyString(), anyString())).thenReturn(true);
when(mWifiNative.setNetworkExtra(anyInt(), anyString(), (Map<String, String>) anyObject()))
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java
index df5de345c..73c1dfb40 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java
@@ -200,14 +200,14 @@ public class WifiStateMachineTest {
when(facade.checkUidPermission(eq(android.Manifest.permission.OVERRIDE_WIFI_CONFIG),
anyInt())).thenReturn(PackageManager.PERMISSION_GRANTED);
- when(facade.makeWifiConfigManager(any(Context.class), any(WifiStateMachine.class),
- any(WifiNative.class), any(FrameworkFacade.class), any(Clock.class),
+ when(facade.makeWifiConfigManager(any(Context.class), any(WifiNative.class),
+ any(FrameworkFacade.class), any(Clock.class),
any(UserManager.class), any(KeyStore.class))).then(new AnswerWithArguments() {
- public WifiConfigManager answer(Context context, WifiStateMachine wifiStateMachine,
- WifiNative wifiNative, FrameworkFacade frameworkFacade, Clock clock,
+ public WifiConfigManager answer(Context context, WifiNative wifiNative,
+ FrameworkFacade frameworkFacade, Clock clock,
UserManager userManager, KeyStore keyStore){
- mWifiConfigManager = new WifiConfigManager(context, wifiStateMachine, wifiNative,
- frameworkFacade, clock, userManager, keyStore);
+ mWifiConfigManager = new WifiConfigManager(context, wifiNative, frameworkFacade,
+ clock, userManager, keyStore);
return mWifiConfigManager;
}
});
@@ -920,12 +920,12 @@ public class WifiStateMachineTest {
@Test
public void handleUserSwitch() throws Exception {
- assertEquals(UserHandle.USER_SYSTEM, mWsm.getCurrentUserId());
+ assertEquals(UserHandle.USER_SYSTEM, mWifiConfigManager.getCurrentUserId());
mWsm.handleUserSwitch(10);
mLooper.dispatchAll();
- assertEquals(10, mWsm.getCurrentUserId());
+ assertEquals(10, mWifiConfigManager.getCurrentUserId());
}
@Test