summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRebecca Silberstein <silberst@google.com>2017-06-29 14:37:55 -0700
committerRebecca Silberstein <silberst@google.com>2017-07-05 17:39:32 +0000
commit5c5b37f9cc52daff34b8509dbda68e754fbbcacb (patch)
tree062866f356b31f4e7bab083434e345f1e130ea26 /tests
parent2f09c3602b5207d8e8a46b7b9fabe17b42b02315 (diff)
SoftApManager: support hidden ap configs
WifiConfigurations for hostapd may set the hiddenSSID flag to true, intending to start softap without advertising the network. While this is not a valid option through the UI, it can be very useful in a test environment. This CL adds support to start hostapd with the hidden network flag set. Note: an integration test will be added to verify the behavior, but this requires additional plumbing in the test code. Tracking that work with Bug 63141761. Bug: 34209778 Test: ran modified integration test to verify the ssid is not broadcast Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh Change-Id: If5fef73bc069f155572257e4a9c81efd00dccacf
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/SoftApManagerTest.java20
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/SoftApManagerTest.java b/tests/wifitests/src/com/android/server/wifi/SoftApManagerTest.java
index 900e6a61a..892b5975c 100644
--- a/tests/wifitests/src/com/android/server/wifi/SoftApManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/SoftApManagerTest.java
@@ -137,6 +137,20 @@ public class SoftApManagerTest {
startSoftApAndVerifyEnabled(config);
}
+
+ /**
+ * Verifies startSoftAp will start with the hiddenSSID param set when it is set to true in the
+ * supplied config.
+ */
+ @Test
+ public void startSoftApWithHiddenSsidTrueInConfig() throws Exception {
+ WifiConfiguration config = new WifiConfiguration();
+ config.apBand = WifiConfiguration.AP_BAND_2GHZ;
+ config.SSID = TEST_SSID;
+ config.hiddenSSID = true;
+ startSoftApAndVerifyEnabled(config);
+ }
+
/** Tests softap startup if default config fails to load. **/
@Test
public void startSoftApDefaultConfigFailedToLoad() throws Exception {
@@ -200,6 +214,7 @@ public class SoftApManagerTest {
/** Starts soft AP and verifies that it is enabled successfully. */
protected void startSoftApAndVerifyEnabled(WifiConfiguration config) throws Exception {
String expectedSSID;
+ boolean expectedHiddenSsid;
InOrder order = inOrder(mListener, mApInterfaceBinder, mApInterface, mNmService);
when(mWifiNative.isHalStarted()).thenReturn(false);
@@ -210,16 +225,19 @@ public class SoftApManagerTest {
if (config == null) {
when(mWifiApConfigStore.getApConfiguration()).thenReturn(mDefaultApConfig);
expectedSSID = mDefaultApConfig.SSID;
+ expectedHiddenSsid = mDefaultApConfig.hiddenSSID;
} else {
expectedSSID = config.SSID;
+ expectedHiddenSsid = config.hiddenSSID;
}
+
mSoftApManager.start();
mLooper.dispatchAll();
order.verify(mListener).onStateChanged(WifiManager.WIFI_AP_STATE_ENABLING, 0);
order.verify(mApInterfaceBinder).linkToDeath(mDeathListenerCaptor.capture(), eq(0));
order.verify(mNmService).registerObserver(mNetworkObserverCaptor.capture());
order.verify(mApInterface).writeHostapdConfig(
- eq(expectedSSID.getBytes(StandardCharsets.UTF_8)), anyBoolean(),
+ eq(expectedSSID.getBytes(StandardCharsets.UTF_8)), eq(expectedHiddenSsid),
anyInt(), anyInt(), any());
order.verify(mApInterface).startHostapd();
mNetworkObserverCaptor.getValue().interfaceLinkStateChanged(TEST_INTERFACE_NAME, true);