summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/p2p/WifiP2pServiceImplTest.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/p2p/WifiP2pServiceImplTest.java b/tests/wifitests/src/com/android/server/wifi/p2p/WifiP2pServiceImplTest.java
index 15d9ef915..1091c1dac 100644
--- a/tests/wifitests/src/com/android/server/wifi/p2p/WifiP2pServiceImplTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/p2p/WifiP2pServiceImplTest.java
@@ -3812,4 +3812,28 @@ public class WifiP2pServiceImplTest {
mLooper.dispatchAll();
verify(mWifiNative).p2pStopFind();
}
+
+ /**
+ * Verify a network name which is too long is rejected.
+ */
+ @Test
+ public void testSendConnectMsgWithTooLongNetworkName() throws Exception {
+ mTestWifiP2pFastConnectionConfig.networkName = "DIRECT-xy-abcdefghijklmnopqrstuvw";
+ sendConnectMsg(mClientMessenger, mTestWifiP2pFastConnectionConfig);
+ verify(mClientHandler).sendMessage(mMessageCaptor.capture());
+ Message message = mMessageCaptor.getValue();
+ assertEquals(WifiP2pManager.CONNECT_FAILED, message.what);
+ }
+
+ /**
+ * Verify a network name which is too short is rejected.
+ */
+ @Test
+ public void testSendConnectMsgWithTooShortNetworkName() throws Exception {
+ mTestWifiP2pFastConnectionConfig.networkName = "DIRECT-x";
+ sendConnectMsg(mClientMessenger, mTestWifiP2pFastConnectionConfig);
+ verify(mClientHandler).sendMessage(mMessageCaptor.capture());
+ Message message = mMessageCaptor.getValue();
+ assertEquals(WifiP2pManager.CONNECT_FAILED, message.what);
+ }
}