summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2020-05-07 03:41:12 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-05-07 03:41:12 +0000
commit1fe289767f5098408dc2e3e7094f8b353ffa34de (patch)
tree482595c46345e569061578d196f815583df35b8c /tests
parent3ee284a8275e91cc22baf987fee486f078f65768 (diff)
parent28036b9b6c6bbe6abfe6622ecb6dbb5fcf548cf6 (diff)
Merge "Add start/stop-softap shell command" into rvc-dev
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiShellCommandTest.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiShellCommandTest.java b/tests/wifitests/src/com/android/server/wifi/WifiShellCommandTest.java
index a1897ded9..1f4af5cc0 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiShellCommandTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiShellCommandTest.java
@@ -16,6 +16,7 @@
package com.android.server.wifi;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
@@ -29,6 +30,7 @@ import static org.mockito.Mockito.when;
import android.content.Context;
import android.net.ConnectivityManager;
+import android.net.wifi.SoftApConfiguration;
import android.os.Binder;
import android.os.Process;
@@ -37,6 +39,7 @@ import androidx.test.filters.SmallTest;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
@@ -396,4 +399,28 @@ public class WifiShellCommandTest extends WifiBaseTest {
verify(mClientModeImpl, times(2)).hasNetworkRequestUserApprovedApp(TEST_PACKAGE);
mWifiShellCommand.getOutPrintWriter().toString().contains("no");
}
+
+ @Test
+ public void testStartSoftAp() {
+ mWifiShellCommand.exec(
+ new Binder(), new FileDescriptor(), new FileDescriptor(), new FileDescriptor(),
+ new String[]{"start-softap", "ap1", "wpa2", "xyzabc321", "-b", "5"});
+ ArgumentCaptor<SoftApConfiguration> softApConfigurationCaptor = ArgumentCaptor.forClass(
+ SoftApConfiguration.class);
+ verify(mWifiService).startTetheredHotspot(softApConfigurationCaptor.capture());
+ assertEquals(SoftApConfiguration.BAND_5GHZ,
+ softApConfigurationCaptor.getValue().getBand());
+ assertEquals(SoftApConfiguration.SECURITY_TYPE_WPA2_PSK,
+ softApConfigurationCaptor.getValue().getSecurityType());
+ assertEquals("\"ap1\"", softApConfigurationCaptor.getValue().getSsid());
+ assertEquals("xyzabc321", softApConfigurationCaptor.getValue().getPassphrase());
+ }
+
+ @Test
+ public void testStopSoftAp() {
+ mWifiShellCommand.exec(
+ new Binder(), new FileDescriptor(), new FileDescriptor(), new FileDescriptor(),
+ new String[]{"stop-softap"});
+ verify(mWifiService).stopSoftAp();
+ }
}