diff options
author | Etan Cohen <etancohen@google.com> | 2018-03-01 17:55:14 -0800 |
---|---|---|
committer | Etan Cohen <etancohen@google.com> | 2018-03-01 18:56:05 -0800 |
commit | 7dadc4d68ea820779ec513073347890b842a6f9c (patch) | |
tree | 3635e4c02ac9c594b6d868dca616eee3d19ba4f8 /tests | |
parent | f889b032189894962c283b003f9f63fadde4c592 (diff) |
[HDM] Pipe through argument to create low priority STA (scanning STA)
Add argument to specify creation of a low priority STA (scanning STA)
or not (normal STA). The CL only adds the argument and modifies all
calling code and test code.
No functional change in behavior!
Bug: 74078114
Test: unit tests pass
Change-Id: Ic4f5c153dd3a4dd68930b40f5e2cd25315f91a90
Diffstat (limited to 'tests')
5 files changed, 91 insertions, 62 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/HalDeviceManagerTest.java b/tests/wifitests/src/com/android/server/wifi/HalDeviceManagerTest.java index fbcbca764..3b62d809e 100644 --- a/tests/wifitests/src/com/android/server/wifi/HalDeviceManagerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/HalDeviceManagerTest.java @@ -769,7 +769,7 @@ public class HalDeviceManagerTest { any(IWifiIface.getTypeCallback.class)); doAnswer(new CreateXxxIfaceAnswer(chipMock, mStatusOk, staIface)).when( chipMock.chip).createStaIface(any(IWifiChip.createStaIfaceCallback.class)); - assertEquals(staIface, mDut.createStaIface(staIdl, null)); + assertEquals(staIface, mDut.createStaIface(false, staIdl, null)); mInOrder.verify(chipMock.chip).configureChip(TestChipV1.STA_CHIP_MODE_ID); mInOrder.verify(staIafrl).onAvailabilityChanged(false); @@ -932,7 +932,7 @@ public class HalDeviceManagerTest { inOrderAvail.verify(staAvailListener).onAvailabilityChanged(false); // request STA2: should fail - IWifiIface staIface2 = mDut.createStaIface(null, null); + IWifiIface staIface2 = mDut.createStaIface(false, null, null); collector.checkThat("STA2 should not be created", staIface2, IsNull.nullValue()); // register additional InterfaceDestroyedListeners - including a duplicate (verify that @@ -1115,7 +1115,7 @@ public class HalDeviceManagerTest { verify(staAvailListener1).onAvailabilityChanged(false); // get STA interface again - IWifiIface staIface2 = mDut.createStaIface(staDestroyedListener2, mHandler); + IWifiIface staIface2 = mDut.createStaIface(false, staDestroyedListener2, mHandler); collector.checkThat("STA created", staIface2, IsNull.nullValue()); verifyNoMoreInteractions(mManagerStatusListenerMock, staDestroyedListener1, @@ -1291,7 +1291,7 @@ public class HalDeviceManagerTest { inOrderAvail.verify(staAvailListener).onAvailabilityChanged(false); // request STA2: should fail - IWifiIface staIface2 = mDut.createStaIface(null, null); + IWifiIface staIface2 = mDut.createStaIface(false, null, null); collector.checkThat("STA2 should not be created", staIface2, IsNull.nullValue()); // request AP2: should fail @@ -1324,7 +1324,7 @@ public class HalDeviceManagerTest { inOrderAvail.verify(staAvailListener).onAvailabilityChanged(false); // request STA3: should fail - IWifiIface staIface3 = mDut.createStaIface(null, null); + IWifiIface staIface3 = mDut.createStaIface(false, null, null); collector.checkThat("STA3 should not be created", staIface3, IsNull.nullValue()); // create AP - this will destroy the last STA created, i.e. STA2 @@ -1564,7 +1564,7 @@ public class HalDeviceManagerTest { inOrderAvail.verify(apAvailListener).onAvailabilityChanged(false); // request STA2: should fail - IWifiIface staIface2 = mDut.createStaIface(null, null); + IWifiIface staIface2 = mDut.createStaIface(false, null, null); collector.checkThat("STA2 should not be created", staIface2, IsNull.nullValue()); // request AP2: should fail @@ -1603,7 +1603,7 @@ public class HalDeviceManagerTest { inOrderAvail.verify(staAvailListener).onAvailabilityChanged(false); // request STA3: should fail - IWifiIface staIface3 = mDut.createStaIface(null, null); + IWifiIface staIface3 = mDut.createStaIface(false, null, null); collector.checkThat("STA3 should not be created", staIface3, IsNull.nullValue()); // create NAN: should destroy the last created STA (STA2) @@ -1626,7 +1626,7 @@ public class HalDeviceManagerTest { verify(staDestroyedListener2).onDestroyed(getName(staIface2)); // request STA2: should fail - staIface2 = mDut.createStaIface(null, null); + staIface2 = mDut.createStaIface(false, null, null); collector.checkThat("STA2 should not be created", staIface2, IsNull.nullValue()); verifyNoMoreInteractions(mManagerStatusListenerMock, staDestroyedListener, @@ -1823,7 +1823,7 @@ public class HalDeviceManagerTest { inOrderAvail.verify(apAvailListener).onAvailabilityChanged(false); // request STA2: should fail - IWifiIface staIface2 = mDut.createStaIface(null, null); + IWifiIface staIface2 = mDut.createStaIface(false, null, null); collector.checkThat("STA2 should not be created", staIface2, IsNull.nullValue()); // request AP2: should fail @@ -1845,7 +1845,7 @@ public class HalDeviceManagerTest { verify(apDestroyedListener).onDestroyed(getName(apIface)); // request STA2: should fail - staIface2 = mDut.createStaIface(null, null); + staIface2 = mDut.createStaIface(false, null, null); collector.checkThat("STA2 should not be created", staIface2, IsNull.nullValue()); // create NAN @@ -1864,7 +1864,7 @@ public class HalDeviceManagerTest { inOrderAvail.verify(nanAvailListener).onAvailabilityChanged(false); // request STA2: should fail - staIface2 = mDut.createStaIface(null, null); + staIface2 = mDut.createStaIface(false, null, null); collector.checkThat("STA2 should not be created", staIface2, IsNull.nullValue()); // tear down STA @@ -2213,7 +2213,7 @@ public class HalDeviceManagerTest { doAnswer(new CreateXxxIfaceAnswer(chipMock, mStatusOk, iface)).when( chipMock.chip).createStaIface(any(IWifiChip.createStaIfaceCallback.class)); - mDut.createStaIface(destroyedListener, mHandler); + mDut.createStaIface(false, destroyedListener, mHandler); break; case IfaceType.AP: iface = mock(IWifiApIface.class); diff --git a/tests/wifitests/src/com/android/server/wifi/ScanOnlyModeManagerTest.java b/tests/wifitests/src/com/android/server/wifi/ScanOnlyModeManagerTest.java index 20a2d6880..2556dfcf4 100644 --- a/tests/wifitests/src/com/android/server/wifi/ScanOnlyModeManagerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/ScanOnlyModeManagerTest.java @@ -23,7 +23,17 @@ import static android.net.wifi.WifiManager.WIFI_STATE_ENABLED; import static android.net.wifi.WifiManager.WIFI_STATE_UNKNOWN; import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.*; +import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.anyInt; +import static org.mockito.Mockito.atLeastOnce; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.reset; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.when; import android.content.Context; import android.content.Intent; @@ -79,12 +89,14 @@ public class ScanOnlyModeManagerTest { } private void startScanOnlyModeAndVerifyEnabled() throws Exception { - when(mWifiNative.setupInterfaceForClientMode(any())).thenReturn(TEST_INTERFACE_NAME); + when(mWifiNative.setupInterfaceForClientMode(anyBoolean(), any())).thenReturn( + TEST_INTERFACE_NAME); mScanOnlyModeManager.start(); mLooper.dispatchAll(); verify(mWifiNative).registerStatusListener(mStatusListenerCaptor.capture()); - verify(mWifiNative).setupInterfaceForClientMode(mInterfaceCallbackCaptor.capture()); + verify(mWifiNative).setupInterfaceForClientMode(eq(true), + mInterfaceCallbackCaptor.capture()); // now mark the interface as up mInterfaceCallbackCaptor.getValue().onUp(TEST_INTERFACE_NAME); @@ -138,7 +150,7 @@ public class ScanOnlyModeManagerTest { */ @Test public void detectAndReportErrorWhenSetupForClientWifiNativeFailure() throws Exception { - when(mWifiNative.setupInterfaceForClientMode(any())).thenReturn(null); + when(mWifiNative.setupInterfaceForClientMode(anyBoolean(), any())).thenReturn(null); mScanOnlyModeManager.start(); mLooper.dispatchAll(); @@ -155,7 +167,7 @@ public class ScanOnlyModeManagerTest { @Test public void scanModeStartDoesNotSendScanningActiveWhenClientInterfaceNameIsEmpty() throws Exception { - when(mWifiNative.setupInterfaceForClientMode(any())).thenReturn(""); + when(mWifiNative.setupInterfaceForClientMode(anyBoolean(), any())).thenReturn(""); mScanOnlyModeManager.start(); mLooper.dispatchAll(); diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNativeInterfaceManagementTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNativeInterfaceManagementTest.java index e1d109e15..be8c393ab 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiNativeInterfaceManagementTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiNativeInterfaceManagementTest.java @@ -22,7 +22,17 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.*; +import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.Mockito.atLeastOnce; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.when; import android.app.test.MockAnswerUtil; import android.net.InterfaceConfiguration; @@ -96,7 +106,7 @@ public class WifiNativeInterfaceManagementTest { .thenReturn(true); when(mWifiVendorHal.isVendorHalSupported()).thenReturn(true); when(mWifiVendorHal.startVendorHal()).thenReturn(true); - when(mWifiVendorHal.createStaIface(any())).thenReturn(IFACE_NAME_0); + when(mWifiVendorHal.createStaIface(anyBoolean(), any())).thenReturn(IFACE_NAME_0); when(mWifiVendorHal.createApIface(any())).thenReturn(IFACE_NAME_0); when(mWifiVendorHal.removeStaIface(any())).thenReturn(true); when(mWifiVendorHal.removeApIface(any())).thenReturn(true); @@ -416,13 +426,14 @@ public class WifiNativeInterfaceManagementTest { // Trigger the AP interface teardown when STA interface is created. // The iface name will remain the same. doAnswer(new MockAnswerUtil.AnswerWithArguments() { - public String answer(InterfaceDestroyedListener destroyedListener) { + public String answer(boolean lowPrioritySta, + InterfaceDestroyedListener destroyedListener) { mIfaceDestroyedListenerCaptor0.getValue().onDestroyed(IFACE_NAME_0); return IFACE_NAME_0; } - }).when(mWifiVendorHal).createStaIface(any()); + }).when(mWifiVendorHal).createStaIface(anyBoolean(), any()); - assertEquals(IFACE_NAME_0, mWifiNative.setupInterfaceForClientMode(mIfaceCallback1)); + assertEquals(IFACE_NAME_0, mWifiNative.setupInterfaceForClientMode(false, mIfaceCallback1)); mInOrder.verify(mWificondControl).enableSupplicant(); mInOrder.verify(mSupplicantStaIfaceHal).isInitializationStarted(); @@ -430,7 +441,8 @@ public class WifiNativeInterfaceManagementTest { mInOrder.verify(mSupplicantStaIfaceHal).isInitializationComplete(); mInOrder.verify(mSupplicantStaIfaceHal).registerDeathHandler(any()); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); - mInOrder.verify(mWifiVendorHal).createStaIface(mIfaceDestroyedListenerCaptor1.capture()); + mInOrder.verify(mWifiVendorHal).createStaIface(eq(false), + mIfaceDestroyedListenerCaptor1.capture()); // Creation of STA interface should trigger the AP interface destroy. validateOnDestroyedSoftApInterface( true, false, IFACE_NAME_0, mIfaceCallback0, mNetworkObserverCaptor0.getValue()); @@ -585,7 +597,7 @@ public class WifiNativeInterfaceManagementTest { @Test public void testSetupClientInterfaceFailureInStartHal() throws Exception { when(mWifiVendorHal.startVendorHal()).thenReturn(false); - assertNull(mWifiNative.setupInterfaceForClientMode(mIfaceCallback0)); + assertNull(mWifiNative.setupInterfaceForClientMode(false, mIfaceCallback0)); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); mInOrder.verify(mWifiVendorHal).startVendorHal(); @@ -606,7 +618,7 @@ public class WifiNativeInterfaceManagementTest { @Test public void testSetupClientInterfaceFailureInStartSupplicant() throws Exception { when(mWificondControl.enableSupplicant()).thenReturn(false); - assertNull(mWifiNative.setupInterfaceForClientMode(mIfaceCallback0)); + assertNull(mWifiNative.setupInterfaceForClientMode(false, mIfaceCallback0)); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); mInOrder.verify(mWifiVendorHal).startVendorHal(); @@ -627,8 +639,8 @@ public class WifiNativeInterfaceManagementTest { */ @Test public void testSetupClientInterfaceFailureInHalCreateStaIface() throws Exception { - when(mWifiVendorHal.createStaIface(any())).thenReturn(null); - assertNull(mWifiNative.setupInterfaceForClientMode(mIfaceCallback0)); + when(mWifiVendorHal.createStaIface(anyBoolean(), any())).thenReturn(null); + assertNull(mWifiNative.setupInterfaceForClientMode(false, mIfaceCallback0)); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); mInOrder.verify(mWifiVendorHal).startVendorHal(); @@ -638,7 +650,7 @@ public class WifiNativeInterfaceManagementTest { mInOrder.verify(mSupplicantStaIfaceHal).isInitializationComplete(); mInOrder.verify(mSupplicantStaIfaceHal).registerDeathHandler(any()); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); - mInOrder.verify(mWifiVendorHal).createStaIface(any()); + mInOrder.verify(mWifiVendorHal).createStaIface(eq(false), any()); mInOrder.verify(mWifiMetrics).incrementNumWifiOnFailureDueToHal(); // To test if the failure is handled cleanly, invoke teardown and ensure that @@ -657,7 +669,7 @@ public class WifiNativeInterfaceManagementTest { public void testSetupClientInterfaceFailureInWificondSetupInterfaceForClientMode() throws Exception { when(mWificondControl.setupInterfaceForClientMode(any())).thenReturn(null); - assertNull(mWifiNative.setupInterfaceForClientMode(mIfaceCallback0)); + assertNull(mWifiNative.setupInterfaceForClientMode(false, mIfaceCallback0)); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); mInOrder.verify(mWifiVendorHal).startVendorHal(); @@ -667,7 +679,8 @@ public class WifiNativeInterfaceManagementTest { mInOrder.verify(mSupplicantStaIfaceHal).isInitializationComplete(); mInOrder.verify(mSupplicantStaIfaceHal).registerDeathHandler(any()); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); - mInOrder.verify(mWifiVendorHal).createStaIface(mIfaceDestroyedListenerCaptor0.capture()); + mInOrder.verify(mWifiVendorHal).createStaIface(eq(false), + mIfaceDestroyedListenerCaptor0.capture()); mInOrder.verify(mWificondControl).setupInterfaceForClientMode(any()); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); mInOrder.verify(mWifiVendorHal).removeStaIface(any()); @@ -693,7 +706,7 @@ public class WifiNativeInterfaceManagementTest { @Test public void testSetupClientInterfaceFailureInSupplicantSetupIface() throws Exception { when(mSupplicantStaIfaceHal.setupIface(any())).thenReturn(false); - assertNull(mWifiNative.setupInterfaceForClientMode(mIfaceCallback0)); + assertNull(mWifiNative.setupInterfaceForClientMode(false, mIfaceCallback0)); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); mInOrder.verify(mWifiVendorHal).startVendorHal(); @@ -703,7 +716,8 @@ public class WifiNativeInterfaceManagementTest { mInOrder.verify(mSupplicantStaIfaceHal).isInitializationComplete(); mInOrder.verify(mSupplicantStaIfaceHal).registerDeathHandler(any()); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); - mInOrder.verify(mWifiVendorHal).createStaIface(mIfaceDestroyedListenerCaptor0.capture()); + mInOrder.verify(mWifiVendorHal).createStaIface(eq(false), + mIfaceDestroyedListenerCaptor0.capture()); mInOrder.verify(mWificondControl).setupInterfaceForClientMode(any()); mInOrder.verify(mSupplicantStaIfaceHal).setupIface(any()); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); @@ -730,7 +744,7 @@ public class WifiNativeInterfaceManagementTest { @Test public void testSetupClientInterfaceFailureInNetworkObserverRegister() throws Exception { doThrow(new RemoteException()).when(mNwManagementService).registerObserver(any()); - assertNull(mWifiNative.setupInterfaceForClientMode(mIfaceCallback0)); + assertNull(mWifiNative.setupInterfaceForClientMode(false, mIfaceCallback0)); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); mInOrder.verify(mWifiVendorHal).startVendorHal(); @@ -740,7 +754,8 @@ public class WifiNativeInterfaceManagementTest { mInOrder.verify(mSupplicantStaIfaceHal).isInitializationComplete(); mInOrder.verify(mSupplicantStaIfaceHal).registerDeathHandler(any()); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); - mInOrder.verify(mWifiVendorHal).createStaIface(mIfaceDestroyedListenerCaptor0.capture()); + mInOrder.verify(mWifiVendorHal).createStaIface(eq(false), + mIfaceDestroyedListenerCaptor0.capture()); mInOrder.verify(mWificondControl).setupInterfaceForClientMode(any()); mInOrder.verify(mSupplicantStaIfaceHal).setupIface(any()); mInOrder.verify(mNwManagementService).registerObserver(mNetworkObserverCaptor0.capture()); @@ -922,7 +937,7 @@ public class WifiNativeInterfaceManagementTest { when(mPropertyService.getString(any(), any())).thenReturn(IFACE_NAME_0); // First setup a STA interface and verify. - assertEquals(IFACE_NAME_0, mWifiNative.setupInterfaceForClientMode(mIfaceCallback0)); + assertEquals(IFACE_NAME_0, mWifiNative.setupInterfaceForClientMode(false, mIfaceCallback0)); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); mInOrder.verify(mWificondControl).enableSupplicant(); @@ -977,7 +992,7 @@ public class WifiNativeInterfaceManagementTest { mInOrder.verify(mNwManagementService).registerObserver(mNetworkObserverCaptor0.capture()); // Now setup a STA interface. - assertEquals(IFACE_NAME_0, mWifiNative.setupInterfaceForClientMode(mIfaceCallback1)); + assertEquals(IFACE_NAME_0, mWifiNative.setupInterfaceForClientMode(false, mIfaceCallback1)); mInOrder.verify(mWificondControl).enableSupplicant(); mInOrder.verify(mSupplicantStaIfaceHal).isInitializationStarted(); @@ -1008,8 +1023,8 @@ public class WifiNativeInterfaceManagementTest { String ifaceName, @Mock WifiNative.InterfaceCallback callback, ArgumentCaptor<InterfaceDestroyedListener> destroyedListenerCaptor, ArgumentCaptor<BaseNetworkObserver> networkObserverCaptor) throws Exception { - when(mWifiVendorHal.createStaIface(any())).thenReturn(ifaceName); - assertEquals(ifaceName, mWifiNative.setupInterfaceForClientMode(callback)); + when(mWifiVendorHal.createStaIface(anyBoolean(), any())).thenReturn(ifaceName); + assertEquals(ifaceName, mWifiNative.setupInterfaceForClientMode(false, callback)); validateSetupClientInterface( existingStaIface, existingApIface, ifaceName, destroyedListenerCaptor, @@ -1032,7 +1047,8 @@ public class WifiNativeInterfaceManagementTest { mInOrder.verify(mSupplicantStaIfaceHal).registerDeathHandler(any()); } mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); - mInOrder.verify(mWifiVendorHal).createStaIface(destroyedListenerCaptor.capture()); + mInOrder.verify(mWifiVendorHal).createStaIface(eq(false), + destroyedListenerCaptor.capture()); mInOrder.verify(mWificondControl).setupInterfaceForClientMode(ifaceName); mInOrder.verify(mSupplicantStaIfaceHal).setupIface(ifaceName); mInOrder.verify(mNwManagementService).registerObserver(networkObserverCaptor.capture()); diff --git a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java index 29f8b4847..fe1c2286b 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java @@ -410,7 +410,7 @@ public class WifiStateMachineTest { when(mWifiInjector.getWakeupController()).thenReturn(mWakeupController); when(mWifiInjector.getScanRequestProxy()).thenReturn(mScanRequestProxy); - when(mWifiNative.setupInterfaceForClientMode(any())) + when(mWifiNative.setupInterfaceForClientMode(anyBoolean(), any())) .thenReturn(WIFI_IFACE_NAME); when(mWifiNative.initialize()).thenReturn(true); @@ -578,7 +578,7 @@ public class WifiStateMachineTest { @Test public void shouldRequireSupplicantStartupToLeaveInitialState() throws Exception { - when(mWifiNative.setupInterfaceForClientMode(any())).thenReturn(null); + when(mWifiNative.setupInterfaceForClientMode(anyBoolean(), any())).thenReturn(null); mWsm.setOperationalMode(WifiStateMachine.CONNECT_MODE); mLooper.dispatchAll(); assertEquals("DefaultState", getCurrentState().getName()); @@ -589,7 +589,7 @@ public class WifiStateMachineTest { @Test public void loadComponentsFailure() throws Exception { - when(mWifiNative.setupInterfaceForClientMode(any())).thenReturn(null); + when(mWifiNative.setupInterfaceForClientMode(anyBoolean(), any())).thenReturn(null); mWsm.setOperationalMode(WifiStateMachine.CONNECT_MODE); mLooper.dispatchAll(); @@ -859,7 +859,7 @@ public class WifiStateMachineTest { mLooper.dispatchAll(); verify(mWifiNative, atLeastOnce()) - .setupInterfaceForClientMode(mInterfaceCallbackCaptor.capture()); + .setupInterfaceForClientMode(eq(false), mInterfaceCallbackCaptor.capture()); verify(mWifiLastResortWatchdog, atLeastOnce()).clearAllFailureCounts(); } diff --git a/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java b/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java index 2665b8aa1..875cd1b76 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java @@ -221,7 +221,7 @@ public class WifiVendorHalTest { mHalDeviceManagerStatusCallbacks.onStatusChanged(); } }).when(mHalDeviceManager).stop(); - when(mHalDeviceManager.createStaIface(any(), eq(null))) + when(mHalDeviceManager.createStaIface(anyBoolean(), any(), eq(null))) .thenReturn(mIWifiStaIface); when(mHalDeviceManager.createApIface(any(), eq(null))) .thenReturn(mIWifiApIface); @@ -292,7 +292,7 @@ public class WifiVendorHalTest { assertTrue(mWifiVendorHal.isHalStarted()); verify(mHalDeviceManager).start(); - verify(mHalDeviceManager).createStaIface(any(), eq(null)); + verify(mHalDeviceManager).createStaIface(eq(false), any(), eq(null)); verify(mHalDeviceManager).getChip(eq(mIWifiStaIface)); verify(mHalDeviceManager).createRttController(); verify(mHalDeviceManager).isReady(); @@ -318,7 +318,7 @@ public class WifiVendorHalTest { verify(mHalDeviceManager).isReady(); verify(mHalDeviceManager).isStarted(); - verify(mHalDeviceManager, never()).createStaIface(any(), eq(null)); + verify(mHalDeviceManager, never()).createStaIface(anyBoolean(), any(), eq(null)); verify(mHalDeviceManager, never()).createRttController(); } @@ -340,7 +340,7 @@ public class WifiVendorHalTest { verify(mHalDeviceManager).start(); - verify(mHalDeviceManager, never()).createStaIface(any(), eq(null)); + verify(mHalDeviceManager, never()).createStaIface(anyBoolean(), any(), eq(null)); verify(mHalDeviceManager, never()).createApIface(any(), eq(null)); verify(mHalDeviceManager, never()).getChip(any(IWifiIface.class)); verify(mHalDeviceManager, never()).createRttController(); @@ -354,12 +354,12 @@ public class WifiVendorHalTest { */ @Test public void testStartHalFailureInIfaceCreationInStaMode() throws Exception { - when(mHalDeviceManager.createStaIface(any(), eq(null))).thenReturn(null); + when(mHalDeviceManager.createStaIface(anyBoolean(), any(), eq(null))).thenReturn(null); assertFalse(mWifiVendorHal.startVendorHalSta()); assertFalse(mWifiVendorHal.isHalStarted()); verify(mHalDeviceManager).start(); - verify(mHalDeviceManager).createStaIface(any(), eq(null)); + verify(mHalDeviceManager).createStaIface(eq(false), any(), eq(null)); verify(mHalDeviceManager).stop(); verify(mHalDeviceManager, never()).createApIface(any(), eq(null)); @@ -380,7 +380,7 @@ public class WifiVendorHalTest { assertFalse(mWifiVendorHal.isHalStarted()); verify(mHalDeviceManager).start(); - verify(mHalDeviceManager).createStaIface(any(), eq(null)); + verify(mHalDeviceManager).createStaIface(eq(false), any(), eq(null)); verify(mHalDeviceManager).createRttController(); verify(mHalDeviceManager).stop(); verify(mIWifiStaIface).registerEventCallback(any(IWifiStaIfaceEventCallback.class)); @@ -400,7 +400,7 @@ public class WifiVendorHalTest { assertFalse(mWifiVendorHal.isHalStarted()); verify(mHalDeviceManager).start(); - verify(mHalDeviceManager).createStaIface(any(), eq(null)); + verify(mHalDeviceManager).createStaIface(eq(false), any(), eq(null)); verify(mHalDeviceManager).createRttController(); verify(mHalDeviceManager).getChip(any(IWifiIface.class)); verify(mHalDeviceManager).stop(); @@ -421,7 +421,7 @@ public class WifiVendorHalTest { assertFalse(mWifiVendorHal.isHalStarted()); verify(mHalDeviceManager).start(); - verify(mHalDeviceManager).createStaIface(any(), eq(null)); + verify(mHalDeviceManager).createStaIface(eq(false), any(), eq(null)); verify(mHalDeviceManager).stop(); verify(mIWifiStaIface).registerEventCallback(any(IWifiStaIfaceEventCallback.class)); @@ -442,7 +442,7 @@ public class WifiVendorHalTest { assertFalse(mWifiVendorHal.isHalStarted()); verify(mHalDeviceManager).start(); - verify(mHalDeviceManager).createStaIface(any(), eq(null)); + verify(mHalDeviceManager).createStaIface(eq(false), any(), eq(null)); verify(mHalDeviceManager).createRttController(); verify(mHalDeviceManager).getChip(any(IWifiIface.class)); verify(mHalDeviceManager).stop(); @@ -466,7 +466,7 @@ public class WifiVendorHalTest { verify(mHalDeviceManager).createApIface(any(), eq(null)); verify(mHalDeviceManager).stop(); - verify(mHalDeviceManager, never()).createStaIface(any(), eq(null)); + verify(mHalDeviceManager, never()).createStaIface(anyBoolean(), any(), eq(null)); verify(mHalDeviceManager, never()).getChip(any(IWifiIface.class)); verify(mHalDeviceManager, never()).createRttController(); } @@ -485,7 +485,7 @@ public class WifiVendorHalTest { verify(mHalDeviceManager).start(); verify(mHalDeviceManager).stop(); - verify(mHalDeviceManager).createStaIface(any(), eq(null)); + verify(mHalDeviceManager).createStaIface(eq(false), any(), eq(null)); verify(mHalDeviceManager).getChip(eq(mIWifiStaIface)); verify(mHalDeviceManager).createRttController(); verify(mHalDeviceManager, times(2)).isReady(); @@ -513,7 +513,7 @@ public class WifiVendorHalTest { verify(mHalDeviceManager, times(2)).isReady(); verify(mHalDeviceManager, times(2)).isStarted(); - verify(mHalDeviceManager, never()).createStaIface(any(), eq(null)); + verify(mHalDeviceManager, never()).createStaIface(anyBoolean(), any(), eq(null)); verify(mHalDeviceManager, never()).createRttController(); } @@ -527,11 +527,12 @@ public class WifiVendorHalTest { InterfaceDestroyedListener externalLister = mock(InterfaceDestroyedListener.class); assertTrue(mWifiVendorHal.startVendorHal()); - assertNotNull(mWifiVendorHal.createStaIface(externalLister)); + assertNotNull(mWifiVendorHal.createStaIface(false, externalLister)); assertTrue(mWifiVendorHal.isHalStarted()); verify(mHalDeviceManager).start(); - verify(mHalDeviceManager).createStaIface(internalListenerCaptor.capture(), eq(null)); + verify(mHalDeviceManager).createStaIface(eq(false), internalListenerCaptor.capture(), + eq(null)); verify(mHalDeviceManager).getChip(eq(mIWifiStaIface)); verify(mHalDeviceManager).createRttController(); verify(mHalDeviceManager).isReady(); @@ -2027,8 +2028,8 @@ public class WifiVendorHalTest { }).when(mIWifiStaIface).getName(any(IWifiIface.getNameCallback.class)); assertTrue(mWifiVendorHal.startVendorHal()); - assertNull(mWifiVendorHal.createStaIface(null)); - verify(mHalDeviceManager).createStaIface(any(), eq(null)); + assertNull(mWifiVendorHal.createStaIface(true, null)); + verify(mHalDeviceManager).createStaIface(eq(true), any(), eq(null)); } /** @@ -2054,8 +2055,8 @@ public class WifiVendorHalTest { @Test public void testCreateRemoveStaIface() throws RemoteException { assertTrue(mWifiVendorHal.startVendorHal()); - String ifaceName = mWifiVendorHal.createStaIface(null); - verify(mHalDeviceManager).createStaIface(any(), eq(null)); + String ifaceName = mWifiVendorHal.createStaIface(false, null); + verify(mHalDeviceManager).createStaIface(eq(false), any(), eq(null)); assertEquals(TEST_IFACE_NAME, ifaceName); assertTrue(mWifiVendorHal.removeStaIface(ifaceName)); verify(mHalDeviceManager).removeIface(eq(mIWifiStaIface)); |