diff options
author | Samuel Tan <samueltan@google.com> | 2016-04-11 17:06:42 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2016-04-11 17:06:43 +0000 |
commit | a88d1b207c401c4510e635156442973a8e30ac95 (patch) | |
tree | 8fd6e5624e7d8b69ce6f8d61268e42de24403063 /tests | |
parent | e78a18cf874b4d9bb5db2ef7804b8ac576e56489 (diff) | |
parent | ac69b83c9cafb9a839b578c3b5b71eb3439244ad (diff) |
Merge changes I468f7425,I649dca1b,Ic7f97157,I06a8be88 into nyc-dev
* changes:
WifiConfigManager: remove WifiStateMachine field
Move wnmFrameReceived() from WifiConfigManager to WifiStateMachine
Move mActiveScanDetail from WifiStateMachine to WifiConfigManager
Remove getCurrentUserId() and getCurrentUserProfiles() from ...WifiStateMachine
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java | 15 | ||||
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java | 16 |
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 |