From 6dcd883acd0ff4d6314a5f58885abb55ba9e4cbf Mon Sep 17 00:00:00 2001 From: Etan Cohen Date: Sun, 24 Nov 2019 11:04:15 -0800 Subject: [WIFI][MAINLINE] Transition WificondControl interfaces: SoftApListener Transition WificondControl public interfaces to that class itself. Preparation for the class being extracted to an official API. Classes shifted: SoftApListener Bug: 140062898 Test: atest android.net.wifi Test: atest com.android.server.wifi Change-Id: Ib160df81a9792b3934176583db2c89b6919c2995 --- .../com/android/server/wifi/HostapdHalTest.java | 36 ++++++++++++++-------- .../android/server/wifi/WificondControlTest.java | 2 +- 2 files changed, 24 insertions(+), 14 deletions(-) (limited to 'tests') diff --git a/tests/wifitests/src/com/android/server/wifi/HostapdHalTest.java b/tests/wifitests/src/com/android/server/wifi/HostapdHalTest.java index 49c6123a1..6fdffa26f 100644 --- a/tests/wifitests/src/com/android/server/wifi/HostapdHalTest.java +++ b/tests/wifitests/src/com/android/server/wifi/HostapdHalTest.java @@ -64,7 +64,7 @@ public class HostapdHalTest extends WifiBaseTest { private @Mock IServiceManager mServiceManagerMock; private @Mock IHostapd mIHostapdMock; private @Mock WifiNative.HostapdDeathEventHandler mHostapdHalDeathHandler; - private @Mock WifiNative.SoftApListener mSoftApListener; + private @Mock WificondControl.SoftApListener mSoftApListener; private android.hardware.wifi.hostapd.V1_1.IHostapd mIHostapdMockV1_1; private IHostapdCallback mIHostapdCallback; private MockResources mResources; @@ -229,7 +229,8 @@ public class HostapdHalTest extends WifiBaseTest { configurationBuilder.setBand(SoftApConfiguration.BAND_2GHZ); assertTrue(mHostapdHal.addAccessPoint(IFACE_NAME, - configurationBuilder.build(), mSoftApListener)); + configurationBuilder.build(), + () -> mSoftApListener.onFailure())); verify(mIHostapdMock).addAccessPoint(any(), any()); assertEquals(IFACE_NAME, mIfaceParamsCaptor.getValue().ifaceName); @@ -262,7 +263,8 @@ public class HostapdHalTest extends WifiBaseTest { configurationBuilder.setBand(SoftApConfiguration.BAND_5GHZ); assertTrue(mHostapdHal.addAccessPoint(IFACE_NAME, - configurationBuilder.build(), mSoftApListener)); + configurationBuilder.build(), + () -> mSoftApListener.onFailure())); verify(mIHostapdMock).addAccessPoint(any(), any()); assertEquals(IFACE_NAME, mIfaceParamsCaptor.getValue().ifaceName); @@ -296,7 +298,8 @@ public class HostapdHalTest extends WifiBaseTest { configurationBuilder.setBand(SoftApConfiguration.BAND_5GHZ); assertTrue(mHostapdHal.addAccessPoint(IFACE_NAME, - configurationBuilder.build(), mSoftApListener)); + configurationBuilder.build(), + () -> mSoftApListener.onFailure())); verify(mIHostapdMock).addAccessPoint(any(), any()); assertEquals(IFACE_NAME, mIfaceParamsCaptor.getValue().ifaceName); @@ -334,7 +337,8 @@ public class HostapdHalTest extends WifiBaseTest { configurationBuilder.setBand(SoftApConfiguration.BAND_2GHZ); assertTrue(mHostapdHal.addAccessPoint(IFACE_NAME, - configurationBuilder.build(), mSoftApListener)); + configurationBuilder.build(), + () -> mSoftApListener.onFailure())); verify(mIHostapdMock).addAccessPoint(any(), any()); assertEquals(IFACE_NAME, mIfaceParamsCaptor.getValue().ifaceName); @@ -372,7 +376,8 @@ public class HostapdHalTest extends WifiBaseTest { configurationBuilder.setBand(SoftApConfiguration.BAND_2GHZ); assertTrue(mHostapdHal.addAccessPoint(IFACE_NAME, - configurationBuilder.build(), mSoftApListener)); + configurationBuilder.build(), + () -> mSoftApListener.onFailure())); verify(mIHostapdMock).addAccessPoint(any(), any()); assertEquals(IFACE_NAME, mIfaceParamsCaptor.getValue().ifaceName); @@ -409,7 +414,8 @@ public class HostapdHalTest extends WifiBaseTest { configurationBuilder.setBand(SoftApConfiguration.BAND_ANY); assertTrue(mHostapdHal.addAccessPoint(IFACE_NAME, - configurationBuilder.build(), mSoftApListener)); + configurationBuilder.build(), + () -> mSoftApListener.onFailure())); verify(mIHostapdMock).addAccessPoint(any(), any()); assertEquals(IFACE_NAME, mIfaceParamsCaptor.getValue().ifaceName); @@ -447,7 +453,8 @@ public class HostapdHalTest extends WifiBaseTest { configurationBuilder.setBand(SoftApConfiguration.BAND_ANY); assertTrue(mHostapdHal.addAccessPoint(IFACE_NAME, - configurationBuilder.build(), mSoftApListener)); + configurationBuilder.build(), + () -> mSoftApListener.onFailure())); verify(mIHostapdMock).addAccessPoint(any(), any()); assertEquals(IFACE_NAME, mIfaceParamsCaptor.getValue().ifaceName); @@ -511,9 +518,9 @@ public class HostapdHalTest extends WifiBaseTest { configurationBuilder.setWpa2Passphrase(NETWORK_PSK); configurationBuilder.setBand(SoftApConfiguration.BAND_ANY); - assertTrue(mHostapdHal.addAccessPoint(IFACE_NAME, - configurationBuilder.build(), mSoftApListener)); + configurationBuilder.build(), + () -> mSoftApListener.onFailure())); verify(mIHostapdMockV1_1).addAccessPoint_1_1(any(), any()); assertEquals(IFACE_NAME, mIfaceParamsCaptorV1_1.getValue().V1_0.ifaceName); @@ -548,7 +555,8 @@ public class HostapdHalTest extends WifiBaseTest { configurationBuilder.setBand(SoftApConfiguration.BAND_2GHZ); assertFalse(mHostapdHal.addAccessPoint(IFACE_NAME, - configurationBuilder.build(), mSoftApListener)); + configurationBuilder.build(), + () -> mSoftApListener.onFailure())); verify(mIHostapdMock).addAccessPoint(any(), any()); } @@ -566,7 +574,8 @@ public class HostapdHalTest extends WifiBaseTest { configurationBuilder.setChannel(6); assertFalse(mHostapdHal.addAccessPoint(IFACE_NAME, - configurationBuilder.build(), mSoftApListener)); + configurationBuilder.build(), + () -> mSoftApListener.onFailure())); verify(mIHostapdMock).addAccessPoint(any(), any()); } @@ -623,7 +632,8 @@ public class HostapdHalTest extends WifiBaseTest { configurationBuilder.setBand(SoftApConfiguration.BAND_2GHZ); assertTrue(mHostapdHal.addAccessPoint(IFACE_NAME, - configurationBuilder.build(), mSoftApListener)); + configurationBuilder.build(), + () -> mSoftApListener.onFailure())); verify(mIHostapdMockV1_1).addAccessPoint_1_1(any(), any()); // Trigger on failure. diff --git a/tests/wifitests/src/com/android/server/wifi/WificondControlTest.java b/tests/wifitests/src/com/android/server/wifi/WificondControlTest.java index 1b7a7a1ce..5a0d91488 100644 --- a/tests/wifitests/src/com/android/server/wifi/WificondControlTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WificondControlTest.java @@ -99,7 +99,7 @@ public class WificondControlTest extends WifiBaseTest { @Mock private IWifiScannerImpl mWifiScannerImpl; @Mock private CarrierNetworkConfig mCarrierNetworkConfig; @Mock private IApInterface mApInterface; - @Mock private WifiNative.SoftApListener mSoftApListener; + @Mock private WificondControl.SoftApListener mSoftApListener; @Mock private AlarmManager mAlarmManager; @Mock private Clock mClock; @Mock private SendMgmtFrameCallback mSendMgmtFrameCallback; -- cgit v1.2.3