summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/MockWifiMonitor.java49
-rw-r--r--tests/wifitests/src/com/android/server/wifi/RttServiceTest.java6
-rw-r--r--tests/wifitests/src/com/android/server/wifi/SupplicantStaNetworkHalTest.java19
-rw-r--r--tests/wifitests/src/com/android/server/wifi/TestUtil.java15
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiBackupRestoreTest.java6
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiConfigStoreLegacyTest.java33
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiDiagnosticsTest.java17
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiMonitorTest.java8
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java183
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java4
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiSupplicantControlTest.java243
-rw-r--r--tests/wifitests/src/com/android/server/wifi/scanner/HalWifiScannerTest.java3
-rw-r--r--tests/wifitests/src/com/android/server/wifi/scanner/SupplicantPnoScannerTest.java7
-rw-r--r--tests/wifitests/src/com/android/server/wifi/scanner/SupplicantWifiScannerTest.java2
14 files changed, 95 insertions, 500 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/MockWifiMonitor.java b/tests/wifitests/src/com/android/server/wifi/MockWifiMonitor.java
index 678650444..fc3418c09 100644
--- a/tests/wifitests/src/com/android/server/wifi/MockWifiMonitor.java
+++ b/tests/wifitests/src/com/android/server/wifi/MockWifiMonitor.java
@@ -17,51 +17,40 @@
package com.android.server.wifi;
import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.any;
-import static org.mockito.Mockito.anyInt;
-import static org.mockito.Mockito.anyString;
-import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
-import android.app.test.MockAnswerUtil.AnswerWithArguments;
import android.os.Handler;
import android.os.Message;
import android.util.SparseArray;
-import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;
/**
- * Creates a WifiMonitor and installs it as the current WifiMonitor instance
+ * Creates a mock WifiMonitor.
* WARNING: This does not perfectly mock the behavior of WifiMonitor at the moment
- * ex. startMoniroting does nothing and will not send a connection/disconnection event
+ * ex. startMonitoring does nothing and will not send a connection/disconnection event
*/
-public class MockWifiMonitor {
- private final WifiMonitor mWifiMonitor;
-
- public MockWifiMonitor() throws Exception {
- mWifiMonitor = mock(WifiMonitor.class);
-
- Field field = WifiMonitor.class.getDeclaredField("sWifiMonitor");
- field.setAccessible(true);
- field.set(null, mWifiMonitor);
-
- doAnswer(new RegisterHandlerAnswer())
- .when(mWifiMonitor).registerHandler(anyString(), anyInt(), any(Handler.class));
+public class MockWifiMonitor extends WifiMonitor {
+ private final Map<String, SparseArray<Handler>> mHandlerMap = new HashMap<>();
+ public MockWifiMonitor() {
+ super(mock(WifiInjector.class));
}
- private final Map<String, SparseArray<Handler>> mHandlerMap = new HashMap<>();
- private class RegisterHandlerAnswer extends AnswerWithArguments {
- public void answer(String iface, int what, Handler handler) {
- SparseArray<Handler> ifaceHandlers = mHandlerMap.get(iface);
- if (ifaceHandlers == null) {
- ifaceHandlers = new SparseArray<>();
- mHandlerMap.put(iface, ifaceHandlers);
- }
- ifaceHandlers.put(what, handler);
+ @Override
+ public void registerHandler(String iface, int what, Handler handler) {
+ SparseArray<Handler> ifaceHandlers = mHandlerMap.get(iface);
+ if (ifaceHandlers == null) {
+ ifaceHandlers = new SparseArray<>();
+ mHandlerMap.put(iface, ifaceHandlers);
}
+ ifaceHandlers.put(what, handler);
+ }
+
+ @Override
+ public synchronized void startMonitoring(String iface, boolean isStaIface) {
+ return;
}
/**
@@ -70,6 +59,7 @@ public class MockWifiMonitor {
public void sendMessage(String iface, int what) {
sendMessage(iface, Message.obtain(null, what));
}
+
public void sendMessage(String iface, Message message) {
SparseArray<Handler> ifaceHandlers = mHandlerMap.get(iface);
if (ifaceHandlers != null) {
@@ -86,6 +76,7 @@ public class MockWifiMonitor {
+ ",what=" + message.what, sent);
}
}
+
private boolean sendMessage(SparseArray<Handler> ifaceHandlers, Message message) {
Handler handler = ifaceHandlers.get(message.what);
if (handler != null) {
diff --git a/tests/wifitests/src/com/android/server/wifi/RttServiceTest.java b/tests/wifitests/src/com/android/server/wifi/RttServiceTest.java
index 093182120..689ade80a 100644
--- a/tests/wifitests/src/com/android/server/wifi/RttServiceTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/RttServiceTest.java
@@ -77,11 +77,11 @@ public class RttServiceTest {
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
- TestUtil.installWlanWifiNative(mWifiNative);
mLooper = new TestLooper();
when(mWifiInjector.makeWificond()).thenReturn(mWificond);
- mRttServiceImpl = new RttService.RttServiceImpl(mContext,
- mLooper.getLooper(), mWifiInjector);
+ when(mWifiInjector.getWifiNative()).thenReturn(mWifiNative);
+ mRttServiceImpl = new RttService.RttServiceImpl(mContext, mLooper.getLooper(),
+ mWifiInjector);
mRttServiceImpl.startService();
}
diff --git a/tests/wifitests/src/com/android/server/wifi/SupplicantStaNetworkHalTest.java b/tests/wifitests/src/com/android/server/wifi/SupplicantStaNetworkHalTest.java
index b48d2b667..302104854 100644
--- a/tests/wifitests/src/com/android/server/wifi/SupplicantStaNetworkHalTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/SupplicantStaNetworkHalTest.java
@@ -58,6 +58,13 @@ import java.util.Random;
*/
public class SupplicantStaNetworkHalTest {
private static final String IFACE_NAME = "wlan0";
+ private static final Map<String, String> NETWORK_EXTRAS_VALUES = new HashMap<>();
+ static {
+ NETWORK_EXTRAS_VALUES.put("key1", "value1");
+ NETWORK_EXTRAS_VALUES.put("key2", "value2");
+ }
+ private static final String NETWORK_EXTRAS_SERIALIZED =
+ "%7B%22key1%22%3A%22value1%22%2C%22key2%22%3A%22value2%22%7D";
private SupplicantStaNetworkHal mSupplicantNetwork;
private SupplicantStatus mStatusSuccess;
@@ -779,6 +786,18 @@ public class SupplicantStaNetworkHalTest {
}
/**
+ * Verifies that createNetworkExtra() & parseNetworkExtra correctly writes a serialized and
+ * URL-encoded JSON object.
+ */
+ @Test
+ public void testNetworkExtra() {
+ assertEquals(NETWORK_EXTRAS_SERIALIZED,
+ SupplicantStaNetworkHal.createNetworkExtra(NETWORK_EXTRAS_VALUES));
+ assertEquals(NETWORK_EXTRAS_VALUES,
+ SupplicantStaNetworkHal.parseNetworkExtra(NETWORK_EXTRAS_SERIALIZED));
+ }
+
+ /**
* Sets up the HIDL interface mock with all the setters/getter values.
* Note: This only sets up the mock to return success on all methods.
*/
diff --git a/tests/wifitests/src/com/android/server/wifi/TestUtil.java b/tests/wifitests/src/com/android/server/wifi/TestUtil.java
index 453cfa882..3b43ad8c5 100644
--- a/tests/wifitests/src/com/android/server/wifi/TestUtil.java
+++ b/tests/wifitests/src/com/android/server/wifi/TestUtil.java
@@ -16,8 +16,6 @@
package com.android.server.wifi;
-import static org.mockito.Mockito.when;
-
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -25,25 +23,12 @@ import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.wifi.WifiManager;
-import java.lang.reflect.Field;
import java.util.ArrayList;
/**
* Utils for wifi tests.
*/
public class TestUtil {
-
- /**
- * Override wifi interface using {@code wifiNative}.
- */
- public static void installWlanWifiNative(WifiNative wifiNative) throws Exception {
- Field field = WifiNative.class.getDeclaredField("wlanNativeInterface");
- field.setAccessible(true);
- field.set(null, wifiNative);
-
- when(wifiNative.getInterfaceName()).thenReturn("mockWlan");
- }
-
/**
* Send {@link WifiManager#NETWORK_STATE_CHANGED_ACTION} broadcast.
*/
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiBackupRestoreTest.java b/tests/wifitests/src/com/android/server/wifi/WifiBackupRestoreTest.java
index 9c33bfee7..10b5117ca 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiBackupRestoreTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiBackupRestoreTest.java
@@ -711,10 +711,10 @@ public class WifiBackupRestoreTest {
out.write(" " + "wep_tx_keyidx=" + configuration.wepTxKeyIndex + "\n");
}
Map<String, String> extras = new HashMap<>();
- extras.put(WifiSupplicantControl.ID_STRING_KEY_CONFIG_KEY, configuration.configKey());
- extras.put(WifiSupplicantControl.ID_STRING_KEY_CREATOR_UID,
+ extras.put(SupplicantStaNetworkHal.ID_STRING_KEY_CONFIG_KEY, configuration.configKey());
+ extras.put(SupplicantStaNetworkHal.ID_STRING_KEY_CREATOR_UID,
Integer.toString(configuration.creatorUid));
- String idString = "\"" + WifiNative.createNetworkExtra(extras) + "\"";
+ String idString = "\"" + SupplicantStaNetworkHal.createNetworkExtra(extras) + "\"";
if (idString != null) {
out.write(" " + "id_str=" + idString + "\n");
}
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigStoreLegacyTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigStoreLegacyTest.java
index 906c895ef..d30ad57de 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiConfigStoreLegacyTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigStoreLegacyTest.java
@@ -22,7 +22,6 @@ import static org.mockito.Mockito.*;
import android.app.test.MockAnswerUtil.AnswerWithArguments;
import android.net.IpConfiguration;
import android.net.wifi.WifiConfiguration;
-import android.net.wifi.WifiEnterpriseConfig;
import android.test.suitebuilder.annotation.SmallTest;
import android.text.TextUtils;
import android.util.SparseArray;
@@ -139,26 +138,6 @@ public class WifiConfigStoreLegacyTest {
}
}).when(mWifiNative).migrateNetworksFromSupplicant(any(Map.class), any(SparseArray.class));
- // Return the unmasked values during file parsing.
- doAnswer(new AnswerWithArguments() {
- public Map<String, String> answer(String fieldName) {
- if (fieldName.equals(WifiConfiguration.pskVarName)) {
- return createPskMap(networks);
- } else if (fieldName.equals(WifiConfiguration.wepKeyVarNames[0])) {
- return createWepKey0Map(networks);
- } else if (fieldName.equals(WifiConfiguration.wepKeyVarNames[1])) {
- return createWepKey1Map(networks);
- } else if (fieldName.equals(WifiConfiguration.wepKeyVarNames[2])) {
- return createWepKey2Map(networks);
- } else if (fieldName.equals(WifiConfiguration.wepKeyVarNames[3])) {
- return createWepKey3Map(networks);
- } else if (fieldName.equals(WifiEnterpriseConfig.PASSWORD_KEY)) {
- return createEapPasswordMap(networks);
- }
- return new HashMap<>();
- }
- }).when(mWifiNative).readNetworkVariablesFromSupplicantFile(anyString());
-
when(mPasspointConfigParser.parseConfig(anyString())).thenReturn(passpointConfigs);
WifiConfigStoreLegacy.WifiConfigStoreDataLegacy storeData = mWifiConfigStore.read();
@@ -246,16 +225,8 @@ public class WifiConfigStoreLegacyTest {
private Map<String, WifiConfiguration> createWpaSupplicantLoadData(
List<WifiConfiguration> configurations) {
- List<WifiConfiguration> newConfigurations;
- // When HIDL is enabled, all the config params are directly read from the HIDL interface,
- // no need to read masked variables from wpa_supplicant.conf file.
- if (WifiNative.HIDL_SUP_ENABLE) {
- newConfigurations = configurations;
- } else {
- newConfigurations = createMaskedWifiConfigurations(configurations);
- }
Map<String, WifiConfiguration> configurationMap = new HashMap<>();
- for (WifiConfiguration config : newConfigurations) {
+ for (WifiConfiguration config : configurations) {
configurationMap.put(config.configKey(true), config);
}
return configurationMap;
@@ -295,7 +266,7 @@ public class WifiConfigStoreLegacyTest {
private Map<String, String> createNetworkExtrasForPasspointConfig(String fqdn) {
Map<String, String> extras = new HashMap<>();
- extras.put(WifiSupplicantControl.ID_STRING_KEY_FQDN, fqdn);
+ extras.put(SupplicantStaNetworkHal.ID_STRING_KEY_FQDN, fqdn);
return extras;
}
}
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiDiagnosticsTest.java b/tests/wifitests/src/com/android/server/wifi/WifiDiagnosticsTest.java
index f8cbf782c..41453d6a7 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiDiagnosticsTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiDiagnosticsTest.java
@@ -33,7 +33,6 @@ import static org.mockito.Mockito.when;
import android.app.test.MockAnswerUtil.AnswerWithArguments;
import android.content.Context;
import android.test.suitebuilder.annotation.SmallTest;
-import android.util.LocalLog;
import com.android.internal.R;
@@ -70,7 +69,6 @@ public class WifiDiagnosticsTest {
private static final int LARGE_RING_BUFFER_SIZE_KB = 1024;
private static final int BYTES_PER_KBYTE = 1024;
private static final long FAKE_CONNECTION_ID = 1;
- private LocalLog mWifiNativeLocalLog;
private WifiNative.RingBufferStatus mFakeRbs;
/**
@@ -94,11 +92,9 @@ public class WifiDiagnosticsTest {
WifiNative.RingBufferStatus[] ringBufferStatuses = new WifiNative.RingBufferStatus[] {
mFakeRbs
};
- mWifiNativeLocalLog = new LocalLog(8192);
when(mWifiNative.getRingBufferStatus()).thenReturn(ringBufferStatuses);
when(mWifiNative.readKernelLog()).thenReturn("");
- when(mWifiNative.getLocalLog()).thenReturn(mWifiNativeLocalLog);
when(mBuildProperties.isEngBuild()).thenReturn(false);
when(mBuildProperties.isUserdebugBuild()).thenReturn(false);
when(mBuildProperties.isUserBuild()).thenReturn(true);
@@ -784,19 +780,6 @@ public class WifiDiagnosticsTest {
assertFalse(sw.toString().contains(WifiDiagnostics.FIRMWARE_DUMP_SECTION_HEADER));
}
- /** Verifies that the dump() includes contents of WifiNative's LocalLog. */
- @Test
- public void dumpIncludesContentOfWifiNativeLocalLog() {
- final String wifiNativeLogMessage = "This is a message";
- mWifiNativeLocalLog.log(wifiNativeLogMessage);
-
- mWifiDiagnostics.startLogging(false /* verbose disabled */);
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- mWifiDiagnostics.dump(new FileDescriptor(), pw, new String[]{});
- assertTrue(sw.toString().contains(wifiNativeLogMessage));
- }
-
@Test
public void dumpRequestsLastMileLoggerDump() {
mWifiDiagnostics.dump(
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiMonitorTest.java b/tests/wifitests/src/com/android/server/wifi/WifiMonitorTest.java
index 5b378a83b..873583954 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiMonitorTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiMonitorTest.java
@@ -19,6 +19,7 @@ package com.android.server.wifi;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
+import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
@@ -41,8 +42,6 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
-import java.lang.reflect.Constructor;
-
/**
* Unit tests for {@link com.android.server.wifi.WifiMonitor}.
*/
@@ -60,10 +59,7 @@ public class WifiMonitorTest {
@Before
public void setUp() throws Exception {
- final Constructor<WifiMonitor> wifiMonitorConstructor =
- WifiMonitor.class.getDeclaredConstructor();
- wifiMonitorConstructor.setAccessible(true);
- mWifiMonitor = spy(wifiMonitorConstructor.newInstance());
+ mWifiMonitor = new WifiMonitor(mock(WifiInjector.class));
mLooper = new TestLooper();
mHandlerSpy = spy(new Handler(mLooper.getLooper()));
mWifiMonitor.setMonitoring(WLAN_IFACE_NAME, true);
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java
index bc6e0d6ac..8f1224120 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java
@@ -21,29 +21,22 @@ 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;
import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import android.net.wifi.IApInterface;
import android.net.wifi.IClientInterface;
-import android.net.wifi.IWificond;
import android.test.suitebuilder.annotation.SmallTest;
import org.junit.Before;
import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
-import java.lang.reflect.Constructor;
-import java.util.Arrays;
-import java.util.HashMap;
import java.util.HashSet;
-import java.util.Map;
import java.util.Set;
-import java.util.TreeSet;
import java.util.regex.Pattern;
/**
@@ -51,16 +44,6 @@ import java.util.regex.Pattern;
*/
@SmallTest
public class WifiNativeTest {
- private static final int NETWORK_ID = 0;
- private static final String NETWORK_EXTRAS_VARIABLE = "test";
- private static final Map<String, String> NETWORK_EXTRAS_VALUES = new HashMap<>();
- static {
- NETWORK_EXTRAS_VALUES.put("key1", "value1");
- NETWORK_EXTRAS_VALUES.put("key2", "value2");
- }
- private static final String NETWORK_EXTRAS_SERIALIZED =
- "\"%7B%22key1%22%3A%22value1%22%2C%22key2%22%3A%22value2%22%7D\"";
-
private static final long FATE_REPORT_DRIVER_TIMESTAMP_USEC = 12345;
private static final byte[] FATE_REPORT_FRAME_BYTES = new byte[] {
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 0, 1, 2, 3, 4, 5, 6, 7};
@@ -159,42 +142,19 @@ public class WifiNativeTest {
networkList[0].ssid = TEST_QUOTED_SSID_1;
networkList[1].ssid = TEST_QUOTED_SSID_2;
}};
+
+ @Mock private WifiVendorHal mWifiVendorHal;
+ @Mock private WificondControl mWificondControl;
+ @Mock private SupplicantStaIfaceHal mStaIfaceHal;
+ @Mock private SupplicantP2pIfaceHal mP2pIfaceHal;
private WifiNative mWifiNative;
- private WifiVendorHal mWifiVendorHal;
@Before
public void setUp() throws Exception {
- final Constructor<WifiNative> wifiNativeConstructor =
- WifiNative.class.getDeclaredConstructor(String.class, Boolean.TYPE);
- wifiNativeConstructor.setAccessible(true);
- mWifiNative = spy(wifiNativeConstructor.newInstance("test", true));
- mWifiVendorHal = mock(WifiVendorHal.class);
+ MockitoAnnotations.initMocks(this);
when(mWifiVendorHal.startVendorHal(anyBoolean())).thenReturn(true);
- mWifiNative.setWifiVendorHal(mWifiVendorHal);
- }
-
- /**
- * Verifies that setNetworkExtra() correctly writes a serialized and URL-encoded JSON object.
- */
- @Test
- public void testSetNetworkExtra() {
- when(mWifiNative.setNetworkVariable(anyInt(), anyString(), anyString())).thenReturn(true);
- assertTrue(mWifiNative.setNetworkExtra(NETWORK_ID, NETWORK_EXTRAS_VARIABLE,
- NETWORK_EXTRAS_VALUES));
- verify(mWifiNative).setNetworkVariable(NETWORK_ID, NETWORK_EXTRAS_VARIABLE,
- NETWORK_EXTRAS_SERIALIZED);
- }
-
- /**
- * Verifies that getNetworkExtra() correctly reads a serialized and URL-encoded JSON object.
- */
- @Test
- public void testGetNetworkExtra() {
- when(mWifiNative.getNetworkVariable(NETWORK_ID, NETWORK_EXTRAS_VARIABLE))
- .thenReturn(NETWORK_EXTRAS_SERIALIZED);
- final Map<String, String> actualValues =
- mWifiNative.getNetworkExtra(NETWORK_ID, NETWORK_EXTRAS_VARIABLE);
- assertEquals(NETWORK_EXTRAS_VALUES, actualValues);
+ mWifiNative = new WifiNative("test0", mWifiVendorHal, mStaIfaceHal, mP2pIfaceHal,
+ mWificondControl);
}
/**
@@ -523,17 +483,13 @@ public class WifiNativeTest {
*/
@Test
public void testSetupDriverForClientMode() {
- WificondControl wificondControl = mock(WificondControl.class);
- IWificond wificond = mock(IWificond.class);
IClientInterface clientInterface = mock(IClientInterface.class);
-
- when(wificondControl.setupDriverForClientMode()).thenReturn(clientInterface);
- mWifiNative.setWificondControl(wificondControl);
+ when(mWificondControl.setupDriverForClientMode()).thenReturn(clientInterface);
IClientInterface returnedClientInterface = mWifiNative.setupForClientMode();
assertEquals(clientInterface, returnedClientInterface);
- verify(mWifiNative).startHal(eq(true));
- verify(wificondControl).setupDriverForClientMode();
+ verify(mWifiVendorHal).startVendorHal(eq(true));
+ verify(mWificondControl).setupDriverForClientMode();
}
/**
@@ -542,16 +498,12 @@ public class WifiNativeTest {
*/
@Test
public void testSetupDriverForClientModeError() {
- WificondControl wificondControl = mock(WificondControl.class);
- IWificond wificond = mock(IWificond.class);
-
- when(wificondControl.setupDriverForClientMode()).thenReturn(null);
- mWifiNative.setWificondControl(wificondControl);
+ when(mWificondControl.setupDriverForClientMode()).thenReturn(null);
IClientInterface returnedClientInterface = mWifiNative.setupForClientMode();
assertEquals(null, returnedClientInterface);
- verify(mWifiNative).startHal(eq(true));
- verify(wificondControl).setupDriverForClientMode();
+ verify(mWifiVendorHal).startVendorHal(eq(true));
+ verify(mWificondControl).setupDriverForClientMode();
}
/**
@@ -559,17 +511,13 @@ public class WifiNativeTest {
*/
@Test
public void testSetupDriverForSoftApMode() {
- WificondControl wificondControl = mock(WificondControl.class);
- IWificond wificond = mock(IWificond.class);
IApInterface apInterface = mock(IApInterface.class);
-
- when(wificondControl.setupDriverForSoftApMode()).thenReturn(apInterface);
- mWifiNative.setWificondControl(wificondControl);
+ when(mWificondControl.setupDriverForSoftApMode()).thenReturn(apInterface);
IApInterface returnedApInterface = mWifiNative.setupForSoftApMode();
assertEquals(apInterface, returnedApInterface);
- verify(mWifiNative).startHal(eq(false));
- verify(wificondControl).setupDriverForSoftApMode();
+ verify(mWifiVendorHal).startVendorHal(eq(false));
+ verify(mWificondControl).setupDriverForSoftApMode();
}
/**
@@ -578,16 +526,12 @@ public class WifiNativeTest {
*/
@Test
public void testSetupDriverForSoftApModeError() {
- WificondControl wificondControl = mock(WificondControl.class);
- IWificond wificond = mock(IWificond.class);
-
- when(wificondControl.setupDriverForSoftApMode()).thenReturn(null);
- mWifiNative.setWificondControl(wificondControl);
-
+ when(mWificondControl.setupDriverForSoftApMode()).thenReturn(null);
IApInterface returnedApInterface = mWifiNative.setupForSoftApMode();
+
assertEquals(null, returnedApInterface);
- verify(mWifiNative).startHal(eq(false));
- verify(wificondControl).setupDriverForSoftApMode();
+ verify(mWifiVendorHal).startVendorHal(eq(false));
+ verify(mWificondControl).setupDriverForSoftApMode();
}
/**
@@ -595,13 +539,10 @@ public class WifiNativeTest {
*/
@Test
public void testEnableSupplicant() {
- WificondControl wificondControl = mock(WificondControl.class);
- IWificond wificond = mock(IWificond.class);
-
- mWifiNative.setWificondControl(wificondControl);
+ when(mWificondControl.enableSupplicant()).thenReturn(true);
mWifiNative.enableSupplicant();
- verify(wificondControl).enableSupplicant();
+ verify(mWificondControl).enableSupplicant();
}
/**
@@ -609,13 +550,10 @@ public class WifiNativeTest {
*/
@Test
public void testDisableSupplicant() {
- WificondControl wificondControl = mock(WificondControl.class);
- IWificond wificond = mock(IWificond.class);
-
- mWifiNative.setWificondControl(wificondControl);
+ when(mWificondControl.disableSupplicant()).thenReturn(true);
mWifiNative.disableSupplicant();
- verify(wificondControl).disableSupplicant();
+ verify(mWificondControl).disableSupplicant();
}
/**
@@ -623,13 +561,10 @@ public class WifiNativeTest {
*/
@Test
public void testTearDown() {
- WificondControl wificondControl = mock(WificondControl.class);
-
- when(wificondControl.tearDownInterfaces()).thenReturn(true);
- mWifiNative.setWificondControl(wificondControl);
+ when(mWificondControl.tearDownInterfaces()).thenReturn(true);
assertTrue(mWifiNative.tearDown());
- verify(wificondControl).tearDownInterfaces();
+ verify(mWificondControl).tearDownInterfaces();
verify(mWifiVendorHal).stopVendorHal();
}
@@ -638,13 +573,10 @@ public class WifiNativeTest {
*/
@Test
public void testSignalPoll() throws Exception {
- WificondControl wificondControl = mock(WificondControl.class);
-
- when(wificondControl.signalPoll()).thenReturn(SIGNAL_POLL_RESULT);
- mWifiNative.setWificondControl(wificondControl);
+ when(mWificondControl.signalPoll()).thenReturn(SIGNAL_POLL_RESULT);
assertEquals(SIGNAL_POLL_RESULT, mWifiNative.signalPoll());
- verify(wificondControl).signalPoll();
+ verify(mWificondControl).signalPoll();
}
/**
@@ -652,13 +584,10 @@ public class WifiNativeTest {
*/
@Test
public void testGetTxPacketCounters() throws Exception {
- WificondControl wificondControl = mock(WificondControl.class);
-
- when(wificondControl.getTxPacketCounters()).thenReturn(PACKET_COUNTERS_RESULT);
- mWifiNative.setWificondControl(wificondControl);
+ when(mWificondControl.getTxPacketCounters()).thenReturn(PACKET_COUNTERS_RESULT);
assertEquals(PACKET_COUNTERS_RESULT, mWifiNative.getTxPacketCounters());
- verify(wificondControl).getTxPacketCounters();
+ verify(mWificondControl).getTxPacketCounters();
}
/**
@@ -666,12 +595,8 @@ public class WifiNativeTest {
*/
@Test
public void testScan() throws Exception {
- WificondControl wificondControl = mock(WificondControl.class);
-
- mWifiNative.setWificondControl(wificondControl);
-
mWifiNative.scan(SCAN_FREQ_SET, SCAN_HIDDEN_NETWORK_SSID_SET);
- verify(wificondControl).scan(SCAN_FREQ_SET, SCAN_HIDDEN_NETWORK_SSID_SET);
+ verify(mWificondControl).scan(SCAN_FREQ_SET, SCAN_HIDDEN_NETWORK_SSID_SET);
}
/**
@@ -679,12 +604,8 @@ public class WifiNativeTest {
*/
@Test
public void testStartPnoScan() throws Exception {
- WificondControl wificondControl = mock(WificondControl.class);
-
- mWifiNative.setWificondControl(wificondControl);
-
mWifiNative.startPnoScan(TEST_PNO_SETTINGS);
- verify(wificondControl).startPnoScan(TEST_PNO_SETTINGS);
+ verify(mWificondControl).startPnoScan(TEST_PNO_SETTINGS);
}
/**
@@ -692,39 +613,7 @@ public class WifiNativeTest {
*/
@Test
public void testStopPnoScan() throws Exception {
- WificondControl wificondControl = mock(WificondControl.class);
-
- mWifiNative.setWificondControl(wificondControl);
-
mWifiNative.stopPnoScan();
- verify(wificondControl).stopPnoScan();
- }
-
- /**
- * Verifies that the ANQP query command is correctly created.
- */
- @Test
- public void testbuildAnqpQueryCommandWithOnlyHsSubtypes() {
- String bssid = "34:12:ac:45:21:12";
- Set<Integer> anqpIds = new TreeSet<>();
- Set<Integer> hs20Subtypes = new TreeSet<>(Arrays.asList(3, 7));
-
- String expectedCommand = "HS20_ANQP_GET " + bssid + " 3,7";
- assertEquals(expectedCommand,
- WifiNative.buildAnqpQueryCommand(bssid, anqpIds, hs20Subtypes));
- }
-
- /**
- * Verifies that the ANQP query command is correctly created.
- */
- @Test
- public void testbuildAnqpQueryCommandWithMixedTypes() {
- String bssid = "34:12:ac:45:21:12";
- Set<Integer> anqpIds = new TreeSet<>(Arrays.asList(1, 2, 5));
- Set<Integer> hs20Subtypes = new TreeSet<>(Arrays.asList(3, 7));
-
- String expectedCommand = "ANQP_GET " + bssid + " 1,2,5,hs20:3,hs20:7";
- assertEquals(expectedCommand,
- WifiNative.buildAnqpQueryCommand(bssid, anqpIds, hs20Subtypes));
+ verify(mWificondControl).stopPnoScan();
}
}
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java
index a56773ec0..59f26bce7 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java
@@ -364,10 +364,12 @@ public class WifiStateMachineTest {
any(WifiConfiguration.class)))
.thenReturn(mSoftApManager);
when(mWifiInjector.getPasspointManager()).thenReturn(mPasspointManager);
+ when(mWifiInjector.getWifiStateTracker()).thenReturn(mWifiStateTracker);
+ when(mWifiInjector.getWifiMonitor()).thenReturn(mWifiMonitor);
+ when(mWifiInjector.getWifiNative()).thenReturn(mWifiNative);
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);
when(mWifiNative.disableSupplicant()).thenReturn(true);
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiSupplicantControlTest.java b/tests/wifitests/src/com/android/server/wifi/WifiSupplicantControlTest.java
deleted file mode 100644
index 884d89f8a..000000000
--- a/tests/wifitests/src/com/android/server/wifi/WifiSupplicantControlTest.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.server.wifi;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import android.telephony.TelephonyManager;
-import android.test.suitebuilder.annotation.SmallTest;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Unit tests for {@link com.android.server.wifi.WifiSupplicantControl}.
- */
-@SmallTest
-public class WifiSupplicantControlTest {
- private static final String KEY_SSID = "ssid";
- private static final String KEY_PSK = "psk";
- private static final String KEY_KEY_MGMT = "key_mgmt";
- private static final String KEY_PRIORITY = "priority";
- private static final String KEY_DISABLED = "disabled";
- private static final String KEY_ID_STR = "id_str";
- // This is not actually present as a key in the wpa_supplicant.conf file, but
- // is used in tests to conveniently access the configKey for a test network.
- private static final String CONFIG_KEY = "configKey";
-
- private static final HashMap<String, String> NETWORK_0_VARS = new HashMap<>();
- static {
- NETWORK_0_VARS.put(KEY_SSID, "\"TestNetwork0\"");
- NETWORK_0_VARS.put(KEY_KEY_MGMT, "NONE");
- NETWORK_0_VARS.put(KEY_PRIORITY, "2");
- NETWORK_0_VARS.put(KEY_ID_STR, ""
- + "\"%7B%22creatorUid%22%3A%221000%22%2C%22configKey%22%3A%22%5C%22"
- + "TestNetwork0%5C%22NONE%22%7D\"");
- NETWORK_0_VARS.put(CONFIG_KEY, "\"TestNetwork0\"NONE");
- }
-
- private static final HashMap<String, String> NETWORK_1_VARS = new HashMap<>();
- static {
- NETWORK_1_VARS.put(KEY_SSID, "\"Test Network 1\"");
- NETWORK_1_VARS.put(KEY_KEY_MGMT, "NONE");
- NETWORK_1_VARS.put(KEY_PRIORITY, "3");
- NETWORK_1_VARS.put(KEY_DISABLED, "1");
- NETWORK_1_VARS.put(KEY_ID_STR, ""
- + "\"%7B%22creatorUid%22%3A%221000%22%2C%22configKey%22%3A%22%5C%22"
- + "Test+Network+1%5C%22NONE%22%7D\"");
- NETWORK_1_VARS.put(CONFIG_KEY, "\"Test Network 1\"NONE");
- }
-
- private static final HashMap<String, String> NETWORK_2_VARS = new HashMap<>();
- static {
- NETWORK_2_VARS.put(KEY_SSID, "\"testNetwork2\"");
- NETWORK_2_VARS.put(KEY_KEY_MGMT, "NONE");
- NETWORK_2_VARS.put(KEY_PRIORITY, "4");
- NETWORK_2_VARS.put(KEY_DISABLED, "1");
- NETWORK_2_VARS.put(KEY_ID_STR, ""
- + "\"%7B%22creatorUid%22%3A%221000%22%2C%22configKey%22%3A%22%5C%22"
- + "testNetwork2%5C%22NONE%22%7D\"");
- NETWORK_2_VARS.put(CONFIG_KEY, "\"testNetwork2\"NONE");
- }
-
- private static final HashMap<String, String> NETWORK_3_VARS = new HashMap<>();
- static {
- NETWORK_3_VARS.put(KEY_SSID, "\"testwpa2psk\"");
- NETWORK_3_VARS.put(KEY_PSK, "blahblah");
- NETWORK_3_VARS.put(KEY_KEY_MGMT, "WPA-PSK");
- NETWORK_3_VARS.put(KEY_PRIORITY, "6");
- NETWORK_3_VARS.put(KEY_DISABLED, "1");
- NETWORK_3_VARS.put(KEY_ID_STR, ""
- + "\"%7B%22creatorUid%22%3A%221000%22%2C%22configKey%22%3A%22%5C%22"
- + "testwpa2psk%5C%22WPA_PSK%22%7D\"");
- NETWORK_3_VARS.put(CONFIG_KEY, "\"testwpa2psk\"WPA_PSK");
- }
-
- private static final ArrayList<HashMap<String, String>> NETWORK_VARS = new ArrayList<>();
- static {
- NETWORK_VARS.add(NETWORK_0_VARS);
- NETWORK_VARS.add(NETWORK_1_VARS);
- NETWORK_VARS.add(NETWORK_2_VARS);
- NETWORK_VARS.add(NETWORK_3_VARS);
- }
-
- // Taken from wpa_supplicant.conf of an actual test device. Some fields modified for privacy
- // reasons.
- private static final String TEST_WPA_SUPPLICANT_CONF = ""
- + "ctrl_interface=/data/misc/wifi/sockets\n"
- + "disable_scan_offload=1\n"
- + "driver_param=use_p2p_group_interface=1p2p_device=1\n"
- + "update_config=1\n"
- + "device_name=testdevice\n"
- + "manufacturer=TestManufacturer\n"
- + "model_name=Testxus\n"
- + "model_number=Testxus\n"
- + "serial_number=1ABCD12345678912\n"
- + "device_type=12-3456A456-7\n"
- + "config_methods=physical_display virtual_push_button\n"
- + "p2p_no_go_freq=5170-5740\n"
- + "pmf=1\n"
- + "external_sim=1\n"
- + "wowlan_triggers=any\n"
- + "p2p_search_delay=0\n"
- + "network={\n"
- + " " + KEY_SSID + "=" + NETWORK_0_VARS.get(KEY_SSID) + "\n"
- + " " + KEY_KEY_MGMT + "=" + NETWORK_0_VARS.get(KEY_KEY_MGMT) + "\n"
- + " " + KEY_PRIORITY + "=" + NETWORK_0_VARS.get(KEY_PRIORITY) + "\n"
- + " " + KEY_ID_STR + "=" + NETWORK_0_VARS.get(KEY_ID_STR) + "\n"
- + "}\n"
- + "\n"
- + "network={\n"
- + " " + KEY_SSID + "=" + NETWORK_1_VARS.get(KEY_SSID) + "\n"
- + " " + KEY_KEY_MGMT + "=" + NETWORK_1_VARS.get(KEY_KEY_MGMT) + "\n"
- + " " + KEY_PRIORITY + "=" + NETWORK_1_VARS.get(KEY_PRIORITY) + "\n"
- + " " + KEY_DISABLED + "=" + NETWORK_1_VARS.get(KEY_DISABLED) + "\n"
- + " " + KEY_ID_STR + "=" + NETWORK_1_VARS.get(KEY_ID_STR) + "\n"
- + "}\n"
- + "\n"
- + "network={\n"
- + " " + KEY_SSID + "=" + NETWORK_2_VARS.get(KEY_SSID) + "\n"
- + " " + KEY_KEY_MGMT + "=" + NETWORK_2_VARS.get(KEY_KEY_MGMT) + "\n"
- + " " + KEY_PRIORITY + "=" + NETWORK_2_VARS.get(KEY_PRIORITY) + "\n"
- + " " + KEY_DISABLED + "=" + NETWORK_2_VARS.get(KEY_DISABLED) + "\n"
- + " " + KEY_ID_STR + "=" + NETWORK_2_VARS.get(KEY_ID_STR) + "\n"
- + "}\n"
- + "\n"
- + "network={\n"
- + " " + KEY_SSID + "=" + NETWORK_3_VARS.get(KEY_SSID) + "\n"
- + " " + KEY_PSK + "=" + NETWORK_3_VARS.get(KEY_PSK) + "\n"
- + " " + KEY_KEY_MGMT + "=" + NETWORK_3_VARS.get(KEY_KEY_MGMT) + "\n"
- + " " + KEY_PRIORITY + "=" + NETWORK_3_VARS.get(KEY_PRIORITY) + "\n"
- + " " + KEY_DISABLED + "=" + NETWORK_3_VARS.get(KEY_DISABLED) + "\n"
- + " " + KEY_ID_STR + "=" + NETWORK_3_VARS.get(KEY_ID_STR) + "\n"
- + "}\n";
-
- @Mock private WifiNative mWifiNative;
- @Mock private TelephonyManager mTelephonyManager;
- private WifiSupplicantControl mWifiSupplicantControl;
-
- /**
- * Initialize |WifiSupplicantControl| instance before each test.
- */
- @Before
- public void setUp() throws Exception {
- MockitoAnnotations.initMocks(this);
- mWifiSupplicantControl = new WifiSupplicantControl(mTelephonyManager, mWifiNative, null);
- }
-
- /**
- * Verifies that readNetworkVariableFromSupplicantFile() properly reads network variables from a
- * wpa_supplicant.conf file.
- */
- @Test
- public void readNetworkVariableFromSupplicantFile() throws Exception {
- Map<String, String> ssidResults = readNetworkVariableFromSupplicantFile(KEY_SSID);
- assertEquals(NETWORK_VARS.size(), ssidResults.size());
- for (HashMap<String, String> single_network_vars : NETWORK_VARS) {
- assertEquals(ssidResults.get(single_network_vars.get(CONFIG_KEY)),
- single_network_vars.get(KEY_SSID));
- }
-
- Map<String, String> pskResults = readNetworkVariableFromSupplicantFile(KEY_PSK);
- // Only network 3 is secured with a password.
- assertEquals(1, pskResults.size());
- assertEquals(pskResults.get(NETWORK_3_VARS.get(CONFIG_KEY)),
- NETWORK_3_VARS.get(KEY_PSK));
-
- Map<String, String> keyMgmtResults = readNetworkVariableFromSupplicantFile(KEY_KEY_MGMT);
- assertEquals(NETWORK_VARS.size(), keyMgmtResults.size());
- for (HashMap<String, String> single_network_vars : NETWORK_VARS) {
- assertEquals(keyMgmtResults.get(single_network_vars.get(CONFIG_KEY)),
- single_network_vars.get(KEY_KEY_MGMT));
- }
-
- Map<String, String> priorityResults = readNetworkVariableFromSupplicantFile(KEY_PRIORITY);
- assertEquals(NETWORK_VARS.size(), priorityResults.size());
- for (HashMap<String, String> single_network_vars : NETWORK_VARS) {
- assertEquals(priorityResults.get(single_network_vars.get(CONFIG_KEY)),
- single_network_vars.get(KEY_PRIORITY));
- }
-
- Map<String, String> disabledResults = readNetworkVariableFromSupplicantFile(KEY_DISABLED);
- // All but network 0 are disabled.
- assertEquals(NETWORK_VARS.size() - 1, disabledResults.size());
- for (int i = 1; i < NETWORK_VARS.size(); ++i) {
- assertEquals(disabledResults.get(NETWORK_VARS.get(i).get(CONFIG_KEY)),
- NETWORK_VARS.get(i).get(KEY_DISABLED));
- }
-
- Map<String, String> idStrResults = readNetworkVariableFromSupplicantFile(KEY_ID_STR);
- assertEquals(NETWORK_VARS.size(), idStrResults.size());
- for (HashMap<String, String> single_network_vars : NETWORK_VARS) {
- assertEquals(idStrResults.get(single_network_vars.get(CONFIG_KEY)),
- single_network_vars.get(KEY_ID_STR));
- }
- }
-
- /**
- * Inject |TEST_WPA_SUPPLICANT_CONF| via the helper method readNetworkVariablesFromReader().
- */
- public Map<String, String> readNetworkVariableFromSupplicantFile(String key) throws Exception {
- Map<String, String> result = new HashMap<>();
- BufferedReader reader = null;
- try {
- reader = new BufferedReader(new StringReader(TEST_WPA_SUPPLICANT_CONF));
- result = mWifiSupplicantControl.readNetworkVariablesFromReader(reader, key);
- } catch (IOException e) {
- fail("Error reading test supplicant conf string");
- } finally {
- try {
- if (reader != null) {
- reader.close();
- }
- } catch (IOException e) {
- // Just ignore if we can't close the reader.
- }
- }
- return result;
- }
-}
diff --git a/tests/wifitests/src/com/android/server/wifi/scanner/HalWifiScannerTest.java b/tests/wifitests/src/com/android/server/wifi/scanner/HalWifiScannerTest.java
index d5ff87797..e8138ca9f 100644
--- a/tests/wifitests/src/com/android/server/wifi/scanner/HalWifiScannerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/scanner/HalWifiScannerTest.java
@@ -34,6 +34,7 @@ public class HalWifiScannerTest extends BaseWifiScannerImplTest {
new int[]{2400, 2450},
new int[]{5150, 5175},
new int[]{5600, 5650});
- mScanner = new HalWifiScannerImpl(mContext, mWifiNative, mLooper.getLooper(), mClock);
+ mScanner = new HalWifiScannerImpl(mContext, mWifiNative, mWifiMonitor, mLooper.getLooper(),
+ mClock);
}
}
diff --git a/tests/wifitests/src/com/android/server/wifi/scanner/SupplicantPnoScannerTest.java b/tests/wifitests/src/com/android/server/wifi/scanner/SupplicantPnoScannerTest.java
index 4976a1610..fb12ca128 100644
--- a/tests/wifitests/src/com/android/server/wifi/scanner/SupplicantPnoScannerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/scanner/SupplicantPnoScannerTest.java
@@ -345,13 +345,15 @@ public class SupplicantPnoScannerTest {
private void createScannerWithHwPnoScanSupport() {
mResources.setBoolean(R.bool.config_wifi_background_scan_support, true);
mScanner =
- new SupplicantWifiScannerImpl(mContext, mWifiNative, mLooper.getLooper(), mClock);
+ new SupplicantWifiScannerImpl(mContext, mWifiNative, mWifiMonitor,
+ mLooper.getLooper(), mClock);
}
private void createScannerWithSwPnoScanSupport() {
mResources.setBoolean(R.bool.config_wifi_background_scan_support, false);
mScanner =
- new SupplicantWifiScannerImpl(mContext, mWifiNative, mLooper.getLooper(), mClock);
+ new SupplicantWifiScannerImpl(mContext, mWifiNative, mWifiMonitor,
+ mLooper.getLooper(), mClock);
}
private WifiNative.PnoNetwork createDummyPnoNetwork(String ssid) {
@@ -388,7 +390,6 @@ public class SupplicantPnoScannerTest {
WifiNative.PnoSettings pnoSettings, WifiNative.ScanEventHandler scanEventHandler,
WifiNative.PnoEventHandler pnoEventHandler) {
reset(mWifiNative);
- when(mWifiNative.setNetworkVariable(anyInt(), anyString(), anyString())).thenReturn(true);
// Scans succeed
when(mWifiNative.scan(any(Set.class), any(Set.class))).thenReturn(true);
when(mWifiNative.startPnoScan(any(WifiNative.PnoSettings.class))).thenReturn(true);
diff --git a/tests/wifitests/src/com/android/server/wifi/scanner/SupplicantWifiScannerTest.java b/tests/wifitests/src/com/android/server/wifi/scanner/SupplicantWifiScannerTest.java
index 8a578c6f6..d5a4b131c 100644
--- a/tests/wifitests/src/com/android/server/wifi/scanner/SupplicantWifiScannerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/scanner/SupplicantWifiScannerTest.java
@@ -48,7 +48,7 @@ public class SupplicantWifiScannerTest extends BaseWifiScannerImplTest {
@Before
public void setup() throws Exception {
- mScanner = new SupplicantWifiScannerImpl(mContext, mWifiNative,
+ mScanner = new SupplicantWifiScannerImpl(mContext, mWifiNative, mWifiMonitor,
mLooper.getLooper(), mClock);
}