diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2020-06-11 23:21:34 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-06-11 23:21:34 +0000 |
commit | 9f5fc7ac7400f64ba6c5f1a376c3abd548a16caa (patch) | |
tree | 615fffaf851ee11dcfcbc8e408f92599937e2904 /tests | |
parent | 6b92c5ac8d9a087c7ccaf1d546810c3432611343 (diff) | |
parent | f2893a20c5ce5094b3838778de157943254b3586 (diff) |
Merge "WifiManager#getCurrentNetwork: return null if not L3 connected" into rvc-dev
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java index 20766898d..58f5b1ccc 100644 --- a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java +++ b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java @@ -421,6 +421,7 @@ public class ClientModeImplTest extends WifiBaseTest { @Mock ThroughputPredictor mThroughputPredictor; @Mock ScanRequestProxy mScanRequestProxy; @Mock DeviceConfigFacade mDeviceConfigFacade; + @Mock Network mNetwork; final ArgumentCaptor<WifiConfigManager.OnNetworkUpdateListener> mConfigUpdateListenerCaptor = ArgumentCaptor.forClass(WifiConfigManager.OnNetworkUpdateListener.class); @@ -533,10 +534,8 @@ public class ClientModeImplTest extends WifiBaseTest { return null; }).when(mIpClient).shutdown(); when(mConnectivityManager.registerNetworkAgent(any(), any(), any(), any(), anyInt(), any(), - anyInt())).thenReturn(mock(Network.class)); - List<SubscriptionInfo> subList = new ArrayList<>() {{ - add(mock(SubscriptionInfo.class)); - }}; + anyInt())).thenReturn(mNetwork); + List<SubscriptionInfo> subList = Arrays.asList(mock(SubscriptionInfo.class)); when(mSubscriptionManager.getActiveSubscriptionInfoList()).thenReturn(subList); when(mSubscriptionManager.getActiveSubscriptionIdList()) .thenReturn(new int[]{DATA_SUBID}); @@ -5266,4 +5265,19 @@ public class ClientModeImplTest extends WifiBaseTest { verifyNoMoreInteractions(mNetworkAgentHandler); } + + @Test + public void testSyncGetCurrentNetwork() throws Exception { + // syncGetCurrentNetwork() returns null when disconnected + mLooper.startAutoDispatch(); + assertNull(mCmi.syncGetCurrentNetwork(mCmiAsyncChannel)); + mLooper.stopAutoDispatch(); + + connect(); + + // syncGetCurrentNetwork() returns non-null Network when connected + mLooper.startAutoDispatch(); + assertEquals(mNetwork, mCmi.syncGetCurrentNetwork(mCmiAsyncChannel)); + mLooper.stopAutoDispatch(); + } } |