diff options
author | Jimmy Chen <jimmycmchen@google.com> | 2019-12-11 15:40:42 +0800 |
---|---|---|
committer | Jimmy Chen <jimmycmchen@google.com> | 2019-12-12 02:24:28 +0000 |
commit | 221cd9e93b94def60aa4a5adbdd3bfa91502bdc8 (patch) | |
tree | fc6fe1aafc05100235b565fb5a192d0aa1af9f5f /tests | |
parent | 491c22553879a8d56d761c218177dec6afa80aa9 (diff) |
p2p: validate the network name of a group
The network name of a group is also used as the SSID.
The network name must also comply normal SSID naming rules.
Bug: 144472136
Test: atest FrameworksWifiTests
Change-Id: I63f23fdb51a1e96019025e860832f1db7ec99fd0
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/p2p/WifiP2pServiceImplTest.java | 24 |
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); + } } |