Checks WEP password lengths of Wi-Fi network

- Checks for WEP40 and WEP104 password lengths (5 and 13 bytes)

Bug: 333289235
Flag: None
Test: unit test
atest -c WifiConfigController2Test

Change-Id: I5f96ad67ed0c67a2724960e72464dc0a56c0c1ab
This commit is contained in:
Weng Su
2024-04-11 06:00:14 +08:00
parent b9798f0798
commit 1cd3b6f21f
2 changed files with 40 additions and 1 deletions

View File

@@ -202,6 +202,39 @@ public class WifiConfigController2Test {
assertThat(mController.isSubmittable()).isFalse();
}
@Test
public void isSubmittable_wepPasswordLength5_returnTrue() {
when(mWifiEntry.getSecurity()).thenReturn(WifiEntry.SECURITY_WEP);
createController(mWifiEntry, WifiConfigUiBase2.MODE_CONNECT, false);
final TextView password = mView.findViewById(R.id.password);
assertThat(password).isNotNull();
password.setText("12345");
assertThat(mController.isSubmittable()).isTrue();
}
@Test
public void isSubmittable_wepPasswordLength13_returnTrue() {
when(mWifiEntry.getSecurity()).thenReturn(WifiEntry.SECURITY_WEP);
createController(mWifiEntry, WifiConfigUiBase2.MODE_CONNECT, false);
final TextView password = mView.findViewById(R.id.password);
assertThat(password).isNotNull();
password.setText("1234567890123");
assertThat(mController.isSubmittable()).isTrue();
}
@Test
public void isSubmittable_wepPasswordLength1_returnFalse() {
when(mWifiEntry.getSecurity()).thenReturn(WifiEntry.SECURITY_WEP);
createController(mWifiEntry, WifiConfigUiBase2.MODE_CONNECT, false);
final TextView password = mView.findViewById(R.id.password);
assertThat(password).isNotNull();
password.setText("1");
assertThat(mController.isSubmittable()).isFalse();
}
@Test
public void isSubmittable_longPsk_shouldReturnFalse() {
createController(mWifiEntry, WifiConfigUiBase2.MODE_CONNECT, false);