summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMitchell Wills <mwills@google.com>2016-06-10 22:35:12 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-06-10 22:35:12 +0000
commit7684d94aa98d82c82e060ff48326181669184f35 (patch)
tree792908252cc647c151259bbf76792ff60c10e9e6 /tests
parentd8ee2a06475a6d437df11a8c6eeb3138dc384afe (diff)
parentcecab03d5d0ebeaf7876b2e93fd10006114fa21d (diff)
Fix crash when cleaning up WifiScanner client before Wifi enabled am: 3040b86393 am: 82f4aada1c
am: cecab03d5d Change-Id: I1378659fc87d0b419a8f96e4fec779e4251db158
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/scanner/WifiScanningServiceTest.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/scanner/WifiScanningServiceTest.java b/tests/wifitests/src/com/android/server/wifi/scanner/WifiScanningServiceTest.java
index 9c43563ac..59fcb439e 100644
--- a/tests/wifitests/src/com/android/server/wifi/scanner/WifiScanningServiceTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/scanner/WifiScanningServiceTest.java
@@ -263,6 +263,10 @@ public class WifiScanningServiceTest {
private static final int MAX_AP_PER_SCAN = 16;
private void startServiceAndLoadDriver() {
mWifiScanningServiceImpl.startService();
+ setupAndLoadDriver();
+ }
+
+ private void setupAndLoadDriver() {
when(mWifiScannerImpl.getScanCapabilities(any(WifiNative.ScanCapabilities.class)))
.thenAnswer(new AnswerWithArguments() {
public boolean answer(WifiNative.ScanCapabilities capabilities) {
@@ -333,6 +337,17 @@ public class WifiScanningServiceTest {
}
@Test
+ public void disconnectClientBeforeWifiEnabled() throws Exception {
+ mWifiScanningServiceImpl.startService();
+
+ BidirectionalAsyncChannel controlChannel = connectChannel(mock(Handler.class));
+ mLooper.dispatchAll();
+
+ controlChannel.disconnect();
+ mLooper.dispatchAll();
+ }
+
+ @Test
public void loadDriver() throws Exception {
startServiceAndLoadDriver();
verify(mWifiScannerImplFactory, times(1))
@@ -350,6 +365,29 @@ public class WifiScanningServiceTest {
}
@Test
+ public void disconnectClientAfterStartingWifi() throws Exception {
+ mWifiScanningServiceImpl.startService();
+
+ BidirectionalAsyncChannel controlChannel = connectChannel(mock(Handler.class));
+ mLooper.dispatchAll();
+
+ setupAndLoadDriver();
+
+ controlChannel.disconnect();
+ mLooper.dispatchAll();
+ }
+
+ @Test
+ public void connectAndDisconnectClientAfterStartingWifi() throws Exception {
+ startServiceAndLoadDriver();
+
+ BidirectionalAsyncChannel controlChannel = connectChannel(mock(Handler.class));
+ mLooper.dispatchAll();
+ controlChannel.disconnect();
+ mLooper.dispatchAll();
+ }
+
+ @Test
public void sendInvalidCommand() throws Exception {
startServiceAndLoadDriver();