diff options
author | Roshan Pius <rpius@google.com> | 2017-03-01 17:03:15 -0800 |
---|---|---|
committer | Roshan Pius <rpius@google.com> | 2017-03-06 16:37:23 -0800 |
commit | 3a0679d411c5eb889d38ed32181446c82d5bd825 (patch) | |
tree | 01764f487051ca9da08e64b0776163a31fb4d3b4 /tests | |
parent | 3b7def108eeb23b7350038f2defc966ee23e9952 (diff) |
WifiNative: Use Vendor HAL for mode change
Restructure the WifiNative setup/teardown operations so that vendor HAL
can start & configure the chip in the correct mode and then inform
wificond about it.
Bug: 35765841
Test: Will send for integration tests.
Change-Id: I14ef0011117f83bed99c21fb459f00263a90a793
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java | 21 | ||||
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java | 4 |
2 files changed, 15 insertions, 10 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java index ef33b656f..a9a32bd40 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java @@ -20,6 +20,7 @@ import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.anyBoolean; import static org.mockito.Mockito.anyInt; import static org.mockito.Mockito.anyString; import static org.mockito.Mockito.eq; @@ -157,6 +158,7 @@ public class WifiNativeTest { wifiNativeConstructor.setAccessible(true); mWifiNative = spy(wifiNativeConstructor.newInstance("test", true)); mWifiVendorHal = mock(WifiVendorHal.class); + when(mWifiVendorHal.startVendorHal(anyBoolean())).thenReturn(true); mWifiNative.setWifiVendorHal(mWifiVendorHal); } @@ -517,10 +519,10 @@ public class WifiNativeTest { when(wificondControl.setupDriverForClientMode()).thenReturn(clientInterface); mWifiNative.setWificondControl(wificondControl); - IClientInterface returnedClientInterface = mWifiNative.setupDriverForClientMode(); + IClientInterface returnedClientInterface = mWifiNative.setupForClientMode(); assertEquals(clientInterface, returnedClientInterface); - verify(wificondControl).setupDriverForClientMode(); verify(mWifiNative).startHal(eq(true)); + verify(wificondControl).setupDriverForClientMode(); } /** @@ -535,8 +537,9 @@ public class WifiNativeTest { when(wificondControl.setupDriverForClientMode()).thenReturn(null); mWifiNative.setWificondControl(wificondControl); - IClientInterface returnedClientInterface = mWifiNative.setupDriverForClientMode(); + IClientInterface returnedClientInterface = mWifiNative.setupForClientMode(); assertEquals(null, returnedClientInterface); + verify(mWifiNative).startHal(eq(true)); verify(wificondControl).setupDriverForClientMode(); } @@ -552,10 +555,10 @@ public class WifiNativeTest { when(wificondControl.setupDriverForSoftApMode()).thenReturn(apInterface); mWifiNative.setWificondControl(wificondControl); - IApInterface returnedApInterface = mWifiNative.setupDriverForSoftApMode(); + IApInterface returnedApInterface = mWifiNative.setupForSoftApMode(); assertEquals(apInterface, returnedApInterface); - verify(wificondControl).setupDriverForSoftApMode(); verify(mWifiNative).startHal(eq(false)); + verify(wificondControl).setupDriverForSoftApMode(); } /** @@ -570,8 +573,9 @@ public class WifiNativeTest { when(wificondControl.setupDriverForSoftApMode()).thenReturn(null); mWifiNative.setWificondControl(wificondControl); - IApInterface returnedApInterface = mWifiNative.setupDriverForSoftApMode(); + IApInterface returnedApInterface = mWifiNative.setupForSoftApMode(); assertEquals(null, returnedApInterface); + verify(mWifiNative).startHal(eq(false)); verify(wificondControl).setupDriverForSoftApMode(); } @@ -607,14 +611,15 @@ public class WifiNativeTest { * Verifies that tearDownInterfaces() calls underlying WificondControl. */ @Test - public void testTearDownInterfaces() { + public void testTearDown() { WificondControl wificondControl = mock(WificondControl.class); when(wificondControl.tearDownInterfaces()).thenReturn(true); mWifiNative.setWificondControl(wificondControl); - assertTrue(mWifiNative.tearDownInterfaces()); + assertTrue(mWifiNative.tearDown()); verify(wificondControl).tearDownInterfaces(); + verify(mWifiVendorHal).stopVendorHal(); } /** diff --git a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java index 45874ac80..9ab24c56b 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java @@ -367,8 +367,8 @@ public class WifiStateMachineTest { .thenReturn(mSoftApManager); when(mWifiInjector.getPasspointManager()).thenReturn(mPasspointManager); - when(mWifiNative.setupDriverForClientMode()).thenReturn(mClientInterface); - when(mWifiNative.setupDriverForSoftApMode()).thenReturn(mApInterface); + when(mWifiNative.setupForClientMode()).thenReturn(mClientInterface); + when(mWifiNative.setupForSoftApMode()).thenReturn(mApInterface); when(mWifiInjector.getWifiStateTracker()).thenReturn(mWifiStateTracker); when(mWifiNative.getInterfaceName()).thenReturn("mockWlan"); when(mWifiNative.enableSupplicant()).thenReturn(true); |