summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSamuel Tan <samueltan@google.com>2016-04-05 13:33:49 -0700
committerSamuel Tan <samueltan@google.com>2016-04-08 09:31:51 -0700
commit06636d2de935ad5d2e8fb6483c406fe922c75ff2 (patch)
tree7389a33c22ea21689df9d155f155a15cdd246bbd /tests
parent73a52d3336a40903965b946f6d3624a223ad5aac (diff)
Remove getCurrentUserId() and getCurrentUserProfiles() from
...WifiStateMachine Move getCurrentUserId() from WifiStateMachine to WifiConfigManager, and remove WifiStateMachine.getCurrentUserProfiles(), so that WifiConfigManager no longer makes calls to WifiStateMachine to perform these two tasks. Achieve this by moving the bookkeeping for the current user ID from WifiStateMachine to WifiConfigManager. BUG: 27405059 Change-Id: I06a8be88f24fd81cbfe785c4304883ddc44658f8 TEST: 'runtest frameworks-wifi' succeeds.
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java10
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java4
2 files changed, 6 insertions, 8 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..31ed99f15 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
@@ -156,8 +156,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) {
@@ -203,10 +202,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 +217,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..402103621 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java
@@ -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