summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRebecca Silberstein <silberst@google.com>2017-03-09 15:04:08 -0800
committerRebecca Silberstein <silberst@google.com>2017-03-15 13:41:22 -0700
commit4e0a1bafa7a86e2840c855846f3fdaee9cd00424 (patch)
treeae8603744a7401290c26ace73bce6ed286c962cf /tests
parentffe8694d14621b679ef06ca2679cf55462b33ea8 (diff)
SoftApManager: retrieve config when null
To support temporary softap configs, SoftApManager will not automatically write out passed in configs to the WifiApConfigStore. This means that Settings will need to continue explicitly saving config changes through the WifiManager API and cannot depend on a call to start softap to write a new config. Bug: 35809698 Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh Test: frameworks/base/wifi/tests/runtests.sh Test: Wifi integration tests Change-Id: I60e138ada3258e29ed4f411616e85b553c7dd34d
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/SoftApManagerTest.java24
1 files changed, 17 insertions, 7 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/SoftApManagerTest.java b/tests/wifitests/src/com/android/server/wifi/SoftApManagerTest.java
index 4420f87da..900e6a61a 100644
--- a/tests/wifitests/src/com/android/server/wifi/SoftApManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/SoftApManagerTest.java
@@ -106,6 +106,9 @@ public class SoftApManagerTest {
when(mApInterface.asBinder()).thenReturn(mApInterfaceBinder);
when(mApInterface.startHostapd()).thenReturn(true);
when(mApInterface.stopHostapd()).thenReturn(true);
+ if (config == null) {
+ when(mWifiApConfigStore.getApConfiguration()).thenReturn(mDefaultApConfig);
+ }
SoftApManager newSoftApManager = new SoftApManager(mLooper.getLooper(),
mWifiNative,
TEST_COUNTRY_CODE,
@@ -116,9 +119,6 @@ public class SoftApManagerTest {
config,
mWifiMetrics);
mLooper.dispatchAll();
- if (config != null) {
- verify(mWifiApConfigStore).setApConfiguration(config);
- }
return newSoftApManager;
}
@@ -140,10 +140,21 @@ public class SoftApManagerTest {
/** Tests softap startup if default config fails to load. **/
@Test
public void startSoftApDefaultConfigFailedToLoad() throws Exception {
- InOrder order = inOrder(mListener);
- mSoftApManager = createSoftApManager(null);
+ when(mApInterface.asBinder()).thenReturn(mApInterfaceBinder);
+ when(mApInterface.startHostapd()).thenReturn(true);
+ when(mApInterface.stopHostapd()).thenReturn(true);
when(mWifiApConfigStore.getApConfiguration()).thenReturn(null);
- mSoftApManager.start();
+ SoftApManager newSoftApManager = new SoftApManager(mLooper.getLooper(),
+ mWifiNative,
+ TEST_COUNTRY_CODE,
+ mListener,
+ mApInterface,
+ mNmService,
+ mWifiApConfigStore,
+ null,
+ mWifiMetrics);
+ mLooper.dispatchAll();
+ newSoftApManager.start();
mLooper.dispatchAll();
verify(mListener).onStateChanged(WifiManager.WIFI_AP_STATE_FAILED,
WifiManager.SAP_START_FAILURE_GENERAL);
@@ -200,7 +211,6 @@ public class SoftApManagerTest {
when(mWifiApConfigStore.getApConfiguration()).thenReturn(mDefaultApConfig);
expectedSSID = mDefaultApConfig.SSID;
} else {
- when(mWifiApConfigStore.getApConfiguration()).thenReturn(config);
expectedSSID = config.SSID;
}
mSoftApManager.start();